Documentation ¶
Index ¶
- Constants
- Variables
- func CreateAccessToken(ctx context.Context, mc model.ClientSet, subjectID object.ID, ...) (*model.Token, error)
- func GetAccessToken(ctx context.Context, mc model.ClientSet, subjectID object.ID, ...) (*model.Token, error)
- type Account
- func (a Account) Authorize(c *gin.Context, p runtime.RouteProfile) int
- func (a Account) CreateToken(req CreateTokenRequest) (CreateTokenResponse, error)
- func (a Account) DeleteToken(req DeleteTokenRequest) error
- func (a Account) Filter(c *gin.Context)
- func (a Account) GetInfo(req GetInfoRequest) (GetInfoResponse, error)
- func (a Account) GetTokens(req GetTokensRequest) (GetTokensResponse, int, error)
- func (a Account) Login(req LoginRequest) (LoginResponse, error)
- func (a Account) Logout(req LogoutRequest) error
- func (a Account) UpdateInfo(req UpdateInfoRequest) error
- type CreateTokenRequest
- type CreateTokenResponse
- type DeleteTokenRequest
- type GetInfoRequest
- type GetInfoResponse
- type GetTokensRequest
- type GetTokensResponse
- type LoginRequest
- type LoginResponse
- type LogoutRequest
- type UpdateInfoRequest
Constants ¶
View Source
const SessionCookieName = "walrus_session"
Variables ¶
View Source
var ( // MaxIdleDurationConfig holds the config of the max idle duration. MaxIdleDurationConfig = vars.SetOnce[time.Duration]{} // SecureConfig holds the config of securing. SecureConfig = vars.SetOnce[bool]{} // EncryptorConfig holds the config of the token encryptor. EncryptorConfig = vars.NewSetOnce[cryptox.Encryptor](cryptox.Null()) )
Functions ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func (Account) CreateToken ¶
func (a Account) CreateToken(req CreateTokenRequest) (CreateTokenResponse, error)
CreateToken creates a new API token for the session subject.
func (Account) DeleteToken ¶
func (a Account) DeleteToken(req DeleteTokenRequest) error
DeleteToken deletes a API token of the session subject.
func (Account) Filter ¶
Filter is a gin middleware that filters the request, and set the subject to the context.
func (Account) GetInfo ¶
func (a Account) GetInfo(req GetInfoRequest) (GetInfoResponse, error)
GetInfo returns the session subject.
func (Account) GetTokens ¶
func (a Account) GetTokens(req GetTokensRequest) (GetTokensResponse, int, error)
func (Account) Login ¶
func (a Account) Login(req LoginRequest) (LoginResponse, error)
Login logins a subject with the given username and password.
func (Account) Logout ¶
func (a Account) Logout(req LogoutRequest) error
Logout logouts the session subject.
func (Account) UpdateInfo ¶
func (a Account) UpdateInfo(req UpdateInfoRequest) error
UpdateInfo updates the session subject.
type CreateTokenRequest ¶
type CreateTokenRequest struct { Name string `json:"name"` ExpirationSeconds *int `json:"expirationSeconds,omitempty"` Context *gin.Context // contains filtered or unexported fields }
func (*CreateTokenRequest) SetGinContext ¶
func (r *CreateTokenRequest) SetGinContext(ctx *gin.Context)
func (*CreateTokenRequest) Validate ¶
func (r *CreateTokenRequest) Validate() error
type CreateTokenResponse ¶
type CreateTokenResponse = *model.TokenOutput
type DeleteTokenRequest ¶
type DeleteTokenRequest struct { model.TokenDeleteInput `path:",inline"` // contains filtered or unexported fields }
type GetInfoRequest ¶
func (*GetInfoRequest) SetGinContext ¶
func (r *GetInfoRequest) SetGinContext(ctx *gin.Context)
type GetInfoResponse ¶
type GetTokensRequest ¶
type GetTokensRequest struct { model.TokenQueryInputs `path:",inline" query:",inline"` runtime.RequestCollection[ predicate.Token, token.OrderOption, ] `query:",inline"` // contains filtered or unexported fields }
type GetTokensResponse ¶
type GetTokensResponse = []*model.TokenOutput
type LoginRequest ¶
type LoginRequest struct { Username string `json:"username"` Password string `json:"password"` Context *gin.Context // contains filtered or unexported fields }
func (*LoginRequest) SetGinContext ¶
func (r *LoginRequest) SetGinContext(ctx *gin.Context)
func (*LoginRequest) Validate ¶
func (r *LoginRequest) Validate() error
type LoginResponse ¶
type LogoutRequest ¶
func (*LogoutRequest) SetGinContext ¶
func (r *LogoutRequest) SetGinContext(ctx *gin.Context)
type UpdateInfoRequest ¶
type UpdateInfoRequest struct { Password string `json:"password,omitempty"` OldPassword string `json:"oldPassword,omitempty"` Context *gin.Context // contains filtered or unexported fields }
func (*UpdateInfoRequest) SetGinContext ¶
func (r *UpdateInfoRequest) SetGinContext(ctx *gin.Context)
func (*UpdateInfoRequest) Validate ¶
func (r *UpdateInfoRequest) Validate() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.