casdoor

package
v0.5.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuiltinOrg          = "built-in"
	BuiltinApp          = "app-built-in"
	BuiltinAdmin        = "admin"
	BuiltinAdminInitPwd = "Admin@123"
)

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(ctx context.Context, clientID, clientSecret, app, org, usr, pwd string) error

func DeleteToken

func DeleteToken(ctx context.Context, clientID, clientSecret, owner, name string) error

func DeleteUser

func DeleteUser(ctx context.Context, clientID, clientSecret, org, usr string) error

func IsConnected

func IsConnected(ctx context.Context) error

func SignInUser

func SignInUser(ctx context.Context, app, org, usr, pwd string) ([]*req.HttpCookie, error)

func SignOutUser

func SignOutUser(ctx context.Context, userSessions []*req.HttpCookie) error

func UnwrapSession

func UnwrapSession(sessions []*req.HttpCookie) string

UnwrapSession returns the value of casdoor login succeeded session.

func UpdateUserPassword

func UpdateUserPassword(ctx context.Context, clientID, clientSecret, org, usr, oldPwd, newPwd string) error

func Wait

func Wait(ctx context.Context, serverUrl string) (err error)

func WrapSession

func WrapSession(value string) []*req.HttpCookie

WrapSession wraps the value as casdoor login succeeded session.

Types

type ApplicationCredential

type ApplicationCredential struct {
	ClientID     string `json:"clientId,omitempty"`
	ClientSecret string `json:"clientSecret,omitempty"`
}

func GetApplicationCredential

func GetApplicationCredential(
	ctx context.Context,
	adminSession []*req.HttpCookie,
	appz string,
) (*ApplicationCredential, error)

type Embedded

type Embedded struct{}

func (Embedded) GetAddress

func (Embedded) GetAddress(ctx context.Context) (string, error)

func (Embedded) Run

func (Embedded) Run(ctx context.Context, dataSourceAddress string) error

type Introspection

type Introspection struct {
	Organization string `json:"organization"`
	UserName     string `json:"username"`
	Active       bool   `json:"active"`
	Exp          int64  `json:"exp"`
}

func IntrospectToken

func IntrospectToken(ctx context.Context, clientID, clientSecret, token string) (*Introspection, error)

type Token

type Token struct {
	Owner        string `json:"owner"`
	Name         string `json:"name"`
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
	ExpiresIn    int    `json:"expiresIn"`
}

func CreateToken

func CreateToken(
	ctx context.Context,
	clientID,
	clientSecret string,
	usr string,
	expiryInSecondsPtr *int,
) (*Token, error)

type User

type User struct {
	Owner         string `json:"owner"`
	Name          string `json:"name"`
	Type          string `json:"type"`
	DisplayName   string `json:"displayName"`
	IsAdmin       bool   `json:"isAdmin"`
	IsGlobalAdmin bool   `json:"isGlobalAdmin"`
}

func GetUser

func GetUser(ctx context.Context, clientID, clientSecret, org, usr string) (*User, error)

type UserInfo

type UserInfo struct {
	Organization string `json:"organization"`
	Name         string `json:"name"`
}

func GetUserInfo

func GetUserInfo(ctx context.Context, userSessions []*req.HttpCookie) (*UserInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL