Help us shape the future of Go! Take the 2026 Go Developer Survey

domain

package
v0.9.78 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: MIT Imports: 3 Imported by: 0

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")
	ErrAuthenticationUnavailable = errors.New("authentication unavailable")
	ErrPasswordWeak              = errors.New("password is too weak")
	ErrInvalidPagination         = errors.New("invalid pagination")
)
View Source
var RBACAllRoles = []string{
	RBACRoleUser,
}

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 CreateUserData struct {
	Email    string
	Password string
}

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

type TokenWasUsed struct {
	ID   int
	When time.Time
}

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

type UpdateUserData struct {
	Email    *string
	Password *string
}

Jump to

Keyboard shortcuts

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