Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientProvider ¶
func NewClientProvider() qcontext.ClientProvider[Client]
Types ¶
type Admin ¶
type Admin interface {
Execute(ctx context.Context, fn func(context.Context) error) error
EnsureSetup(ctx context.Context) error
GetOrCreateClient(ctx context.Context, clientID string) (Client, error)
CreateUser(ctx context.Context, username, password string) error
DeleteUser(ctx context.Context, username string) error
GetUser(ctx context.Context, username string) (User, error)
GetUsers(ctx context.Context) (map[string]User, error)
UpdateUser(ctx context.Context, user User) error
ProcessEvents(ctx context.Context, eventEmitter EventEmitter) error
}
func NewAdmin ¶
func NewAdmin(core Core, opts ...AdminOption) Admin
type AdminOption ¶
type AdminOption func(*adminConfig)
func MasterRealm ¶
func MasterRealm(masterRealm string) AdminOption
func Password ¶
func Password(password string) AdminOption
func Realm ¶
func Realm(realm string) AdminOption
func Username ¶
func Username(username string) AdminOption
type Client ¶
type Client interface {
GetID() string
GetSecret() string
GetSession(ctx context.Context) Session
CreateUserSession(ctx context.Context, username, password string) Session
AccessTokenToSession(ctx context.Context, accessToken string) Session
RefreshTokenToSession(ctx context.Context, refreshToken string) Session
}
type CoreOption ¶
type CoreOption func(*coreConfig)
func BaseURL ¶
func BaseURL(url string) CoreOption
type EmittedEvent ¶
type EventEmitter ¶
type EventEmitter interface {
Signal() qss.Signal[EmittedEvent]
GetLastEventTime() time.Time
SetLastEventTime(time.Time)
ProcessNextBatch(ctx context.Context, accessToken, realm string) error
}
func NewEventEmitter ¶
func NewEventEmitter(core Core, opts ...EventEmitterOption) EventEmitter
type EventEmitterOption ¶
type EventEmitterOption func(*eventEmitterConfig)
func BatchSize ¶
func BatchSize(size int) EventEmitterOption
func EventTypes ¶
func EventTypes(types ...EventType) EventEmitterOption
type EventType ¶
type EventType string
const ( // Login Events EventLogin EventType = "LOGIN" EventLoginError EventType = "LOGIN_ERROR" EventLogout EventType = "LOGOUT" EventLogoutError EventType = "LOGOUT_ERROR" // Registration Events EventRegister EventType = "REGISTER" EventRegisterError EventType = "REGISTER_ERROR" EventDeleteAccount EventType = "DELETE_ACCOUNT" EventDeleteError EventType = "DELETE_ACCOUNT_ERROR" // User Profile Events EventUpdateProfile EventType = "UPDATE_PROFILE" EventUpdatePassword EventType = "UPDATE_PASSWORD" EventUpdateEmail EventType = "UPDATE_EMAIL" EventVerifyEmail EventType = "VERIFY_EMAIL" EventUpdateLocale EventType = "UPDATE_LOCALE" // Identity Provider Events EventLinkIDP EventType = "IDENTITY_PROVIDER_LINK" EventUnlinkIDP EventType = "IDENTITY_PROVIDER_UNLINK" EventLoginIDP EventType = "IDENTITY_PROVIDER_LOGIN" EventFirstLoginIDP EventType = "IDENTITY_PROVIDER_FIRST_LOGIN" EventPostLoginIDP EventType = "IDENTITY_PROVIDER_POST_LOGIN" EventResponseIDP EventType = "IDENTITY_PROVIDER_RESPONSE" // 2FA/MFA Events EventRemoveTotp EventType = "REMOVE_TOTP" EventUpdateTotp EventType = "UPDATE_TOTP" EventGrantConsent EventType = "GRANT_CONSENT" EventUpdateConsent EventType = "UPDATE_CONSENT" EventRevokeConsent EventType = "REVOKE_CONSENT" EventCodeToToken EventType = "CODE_TO_TOKEN" EventCustomRequired EventType = "CUSTOM_REQUIRED_ACTION" // Client Events EventClientLogin EventType = "CLIENT_LOGIN" EventClientLogout EventType = "CLIENT_LOGOUT" EventClientRegister EventType = "CLIENT_REGISTER" EventClientDelete EventType = "CLIENT_DELETE" EventClientUpdate EventType = "CLIENT_UPDATE" EventClientInfo EventType = "CLIENT_INFO" EventClientInitLogin EventType = "CLIENT_INITIATED_ACCOUNT_LINKING" // Token Events EventTokenRefresh EventType = "REFRESH_TOKEN" EventTokenExchange EventType = "TOKEN_EXCHANGE" EventIntrospectToken EventType = "INTROSPECT_TOKEN" EventValidateToken EventType = "VALIDATE_ACCESS_TOKEN" // Role Events EventGrantRole EventType = "GRANT_ROLE" EventRemoveRole EventType = "REMOVE_ROLE" EventUpdateRole EventType = "UPDATE_ROLE" // Permission Events EventPermissionGrant EventType = "PERMISSION_GRANT" EventPermissionRevoke EventType = "PERMISSION_REVOKE" // Group Events EventGroupMembership EventType = "GROUP_MEMBERSHIP" EventJoinGroup EventType = "JOIN_GROUP" EventLeaveGroup EventType = "LEAVE_GROUP" // Session Events EventRestart EventType = "RESTART_AUTHENTICATION" EventImpersonate EventType = "IMPERSONATE" EventBackchannelLogin EventType = "BACKCHANNEL_LOGIN" EventBackchannelLogout EventType = "BACKCHANNEL_LOGOUT" EventClientSessionExpired EventType = "CLIENT_SESSION_EXPIRED" EventSessionExpired EventType = "SESSION_EXPIRED" )
type Session ¶
type Session interface {
Refresh(context.Context) error
Revoke(context.Context) error
PastHalfLife(context.Context) bool
GetOwnerName(context.Context) (string, error)
IsValid() bool
CheckIsValid(context.Context) bool
AccessToken() string
RefreshToken() string
Realm() string
ClientID() string
ClientSecret() string
// New methods for automatic refresh
StartAutoRefresh(ctx context.Context) error
StopAutoRefresh()
Valid() qss.Signal[bool]
}
Click to show internal directories.
Click to hide internal directories.