Documentation
¶
Index ¶
Constants ¶
View Source
const ( RBACPermissionUsersReadSelf = "users:read_self" RBACPermissionUsersUpdateSelf = "users:update_self" RBACPermissionUsersList = "users:list" RBACPermissionUsersReadOthers = "users:read_others" RBACPermissionUsersCreate = "users:create" RBACPermissionUsersUpdate = "users:update" RBACPermissionUsersDelete = "users:delete" )
View Source
const ( UserStatusActive = "active" UserStatusInactive = "inactive" UserListDefaultLimit = 10 UserListMaximumLimit = 100 )
View Source
const ( TopicNameAuthEvents = "auth_events_topic" EventTypeAuthSignUp = "auth.signup" EventTypeAuthLogin = "auth.login" EventTypeAuthLogout = "auth.logout" EventTypeUserCreate = "user.create" EventTypeUserUpdate = "user.update" EventTypeUserDelete = "user.delete" )
View Source
const ( AuthenticationTypeCredentials = "credentials" AuthenticationTypeApiToken = "api_token" )
View Source
const (
RBACRoleUser = "user"
)
Variables ¶
View Source
var ( ErrEntityNotFound = errors.New("entity not found") ErrUserAlreadyExists = errors.New("user already exists") ErrInvalidCredentials = errors.New("invalid credentials") ErrInvalidToken = errors.New("invalid token") ErrPasswordWeak = errors.New("password is too weak") ErrInvalidPagination = errors.New("invalid pagination") )
View Source
var RBACAllPermissions = []string{ RBACPermissionUsersReadSelf, RBACPermissionUsersUpdateSelf, RBACPermissionUsersList, RBACPermissionUsersReadOthers, RBACPermissionUsersCreate, RBACPermissionUsersUpdate, RBACPermissionUsersDelete, }
View Source
var RBACAllRoles = []string{ RBACRoleUser, }
View Source
var UserStatuses = []string{ UserStatusActive, UserStatusInactive, }
Functions ¶
This section is empty.
Types ¶
type AuthenticationType ¶
type AuthenticationType string
type ContextAuthInfo ¶
type ContextAuthInfo struct {
ID int
UUID string
Type AuthenticationType
// contains filtered or unexported fields
}
ContextAuthInfo holds authentication information in the request context. ID and UUID identify the authenticated user; Type identifies the authentication method.
func (*ContextAuthInfo) HasPermission ¶
func (ctx *ContextAuthInfo) HasPermission(permission string) bool
func (*ContextAuthInfo) SetPermissions ¶
func (ctx *ContextAuthInfo) SetPermissions(permissions []string)
type CreateUserData ¶
type JWTClaims ¶
type JWTClaims struct {
jwt.RegisteredClaims
KID string `json:"kid,omitempty"`
TokenUse JWTTokenPurpose `json:"token_use"`
}
type JWTTokenPurpose ¶
type JWTTokenPurpose string
const ( JWTTokenPurposeAccess JWTTokenPurpose = "access" JWTTokenPurposeRefresh JWTTokenPurpose = "refresh" )
type TokenWasUsed ¶
TokenWasUsed is a message passed to channel for outside consumers.
type Tokens ¶
type Tokens struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
}
Tokens represents the structure of JWT authentication tokens.
type UpdateUserData ¶
Click to show internal directories.
Click to hide internal directories.