Documentation
¶
Index ¶
- type AfterAppCreateHook
- type AfterMemberAddHook
- type AfterOrganizationCreateHook
- type AfterPermissionEvaluateHook
- type AfterSessionCreateHook
- type AfterSessionRevokeHook
- type AfterSignInHook
- type AfterSignOutHook
- type AfterSignUpHook
- type AfterUserCreateHook
- type AfterUserDeleteHook
- type AfterUserUpdateHook
- type BeforeAppCreateHook
- type BeforeMemberAddHook
- type BeforeOrganizationCreateHook
- type BeforePermissionEvaluateHook
- type BeforeSessionCreateHook
- type BeforeSessionRevokeHook
- type BeforeSignInHook
- type BeforeSignOutHook
- type BeforeSignUpHook
- type BeforeUserCreateHook
- type BeforeUserDeleteHook
- type BeforeUserUpdateHook
- type HookRegistry
- func (h *HookRegistry) DisableDebug()
- func (h *HookRegistry) EnableDebug()
- func (h *HookRegistry) ExecuteAfterAppCreate(ctx context.Context, app interface{}) error
- func (h *HookRegistry) ExecuteAfterMemberAdd(ctx context.Context, member interface{}) error
- func (h *HookRegistry) ExecuteAfterOrganizationCreate(ctx context.Context, org interface{}) error
- func (h *HookRegistry) ExecuteAfterPermissionEvaluate(ctx context.Context, req *PermissionEvaluateRequest, ...) error
- func (h *HookRegistry) ExecuteAfterSessionCreate(ctx context.Context, session *session.Session) error
- func (h *HookRegistry) ExecuteAfterSessionRevoke(ctx context.Context, sessionID xid.ID) error
- func (h *HookRegistry) ExecuteAfterSignIn(ctx context.Context, response *responses.AuthResponse) error
- func (h *HookRegistry) ExecuteAfterSignOut(ctx context.Context, token string) error
- func (h *HookRegistry) ExecuteAfterSignUp(ctx context.Context, response *responses.AuthResponse) error
- func (h *HookRegistry) ExecuteAfterUserCreate(ctx context.Context, user *user.User) error
- func (h *HookRegistry) ExecuteAfterUserDelete(ctx context.Context, userID xid.ID) error
- func (h *HookRegistry) ExecuteAfterUserUpdate(ctx context.Context, user *user.User) error
- func (h *HookRegistry) ExecuteBeforeAppCreate(ctx context.Context, req interface{}) error
- func (h *HookRegistry) ExecuteBeforeMemberAdd(ctx context.Context, orgID string, userID xid.ID) error
- func (h *HookRegistry) ExecuteBeforeOrganizationCreate(ctx context.Context, req interface{}) error
- func (h *HookRegistry) ExecuteBeforePermissionEvaluate(ctx context.Context, req *PermissionEvaluateRequest) error
- func (h *HookRegistry) ExecuteBeforeSessionCreate(ctx context.Context, req *session.CreateSessionRequest) error
- func (h *HookRegistry) ExecuteBeforeSessionRevoke(ctx context.Context, token string) error
- func (h *HookRegistry) ExecuteBeforeSignIn(ctx context.Context, req *auth.SignInRequest) error
- func (h *HookRegistry) ExecuteBeforeSignOut(ctx context.Context, token string) error
- func (h *HookRegistry) ExecuteBeforeSignUp(ctx context.Context, req *auth.SignUpRequest) error
- func (h *HookRegistry) ExecuteBeforeUserCreate(ctx context.Context, req *user.CreateUserRequest) error
- func (h *HookRegistry) ExecuteBeforeUserDelete(ctx context.Context, userID xid.ID) error
- func (h *HookRegistry) ExecuteBeforeUserUpdate(ctx context.Context, userID xid.ID, req *user.UpdateUserRequest) error
- func (h *HookRegistry) ExecuteOnCacheInvalidate(ctx context.Context, scope string, id xid.ID) error
- func (h *HookRegistry) ExecuteOnPolicyChange(ctx context.Context, policyID xid.ID, action string) error
- func (h *HookRegistry) GetHookCounts() map[string]int
- func (h *HookRegistry) RegisterAfterAppCreate(hook AfterAppCreateHook)
- func (h *HookRegistry) RegisterAfterMemberAdd(hook AfterMemberAddHook)
- func (h *HookRegistry) RegisterAfterOrganizationCreate(hook AfterOrganizationCreateHook)
- func (h *HookRegistry) RegisterAfterPermissionEvaluate(hook AfterPermissionEvaluateHook)
- func (h *HookRegistry) RegisterAfterSessionCreate(hook AfterSessionCreateHook)
- func (h *HookRegistry) RegisterAfterSessionRevoke(hook AfterSessionRevokeHook)
- func (h *HookRegistry) RegisterAfterSignIn(hook AfterSignInHook)
- func (h *HookRegistry) RegisterAfterSignOut(hook AfterSignOutHook)
- func (h *HookRegistry) RegisterAfterSignUp(hook AfterSignUpHook)
- func (h *HookRegistry) RegisterAfterUserCreate(hook AfterUserCreateHook)
- func (h *HookRegistry) RegisterAfterUserDelete(hook AfterUserDeleteHook)
- func (h *HookRegistry) RegisterAfterUserUpdate(hook AfterUserUpdateHook)
- func (h *HookRegistry) RegisterBeforeAppCreate(hook BeforeAppCreateHook)
- func (h *HookRegistry) RegisterBeforeMemberAdd(hook BeforeMemberAddHook)
- func (h *HookRegistry) RegisterBeforeOrganizationCreate(hook BeforeOrganizationCreateHook)
- func (h *HookRegistry) RegisterBeforePermissionEvaluate(hook BeforePermissionEvaluateHook)
- func (h *HookRegistry) RegisterBeforeSessionCreate(hook BeforeSessionCreateHook)
- func (h *HookRegistry) RegisterBeforeSessionRevoke(hook BeforeSessionRevokeHook)
- func (h *HookRegistry) RegisterBeforeSignIn(hook BeforeSignInHook)
- func (h *HookRegistry) RegisterBeforeSignOut(hook BeforeSignOutHook)
- func (h *HookRegistry) RegisterBeforeSignUp(hook BeforeSignUpHook)
- func (h *HookRegistry) RegisterBeforeUserCreate(hook BeforeUserCreateHook)
- func (h *HookRegistry) RegisterBeforeUserDelete(hook BeforeUserDeleteHook)
- func (h *HookRegistry) RegisterBeforeUserUpdate(hook BeforeUserUpdateHook)
- func (h *HookRegistry) RegisterOnCacheInvalidate(hook OnCacheInvalidateHook)
- func (h *HookRegistry) RegisterOnPolicyChange(hook OnPolicyChangeHook)
- type OnCacheInvalidateHook
- type OnPolicyChangeHook
- type PermissionDecision
- type PermissionEvaluateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AfterAppCreateHook ¶
type AfterMemberAddHook ¶
type AfterPermissionEvaluateHook ¶ added in v0.0.3
type AfterPermissionEvaluateHook func(ctx context.Context, req *PermissionEvaluateRequest, decision *PermissionDecision) error
type AfterSessionCreateHook ¶
type AfterSessionRevokeHook ¶
type AfterSignInHook ¶
type AfterSignInHook func(ctx context.Context, response *responses.AuthResponse) error
type AfterSignUpHook ¶
type AfterSignUpHook func(ctx context.Context, response *responses.AuthResponse) error
type AfterUserCreateHook ¶
type AfterUserUpdateHook ¶
type BeforeAppCreateHook ¶
App hooks (for multi-app support)
type BeforeMemberAddHook ¶
type BeforeOrganizationCreateHook ¶
Organization hooks (for multi-tenancy plugin)
type BeforePermissionEvaluateHook ¶ added in v0.0.3
type BeforePermissionEvaluateHook func(ctx context.Context, req *PermissionEvaluateRequest) error
type BeforeSessionCreateHook ¶
type BeforeSessionCreateHook func(ctx context.Context, req *session.CreateSessionRequest) error
Session hooks
type BeforeSessionRevokeHook ¶
type BeforeSignInHook ¶
type BeforeSignInHook func(ctx context.Context, req *auth.SignInRequest) error
type BeforeSignUpHook ¶
type BeforeSignUpHook func(ctx context.Context, req *auth.SignUpRequest) error
Auth hooks
type BeforeUserCreateHook ¶
type BeforeUserCreateHook func(ctx context.Context, req *user.CreateUserRequest) error
User hooks
type BeforeUserDeleteHook ¶
type BeforeUserUpdateHook ¶
type HookRegistry ¶
type HookRegistry struct {
// contains filtered or unexported fields
}
HookRegistry manages all hooks for the authentication system. It is thread-safe and timing-independent - hooks can be registered at any point in the application lifecycle and will always be executed.
func NewHookRegistry ¶
func NewHookRegistry() *HookRegistry
NewHookRegistry creates a new hook registry
func (*HookRegistry) DisableDebug ¶ added in v0.0.3
func (h *HookRegistry) DisableDebug()
DisableDebug disables debug logging
func (*HookRegistry) EnableDebug ¶ added in v0.0.3
func (h *HookRegistry) EnableDebug()
EnableDebug enables verbose debug logging for hook registration and execution
func (*HookRegistry) ExecuteAfterAppCreate ¶
func (h *HookRegistry) ExecuteAfterAppCreate(ctx context.Context, app interface{}) error
ExecuteAfterAppCreate executes all after app create hooks
func (*HookRegistry) ExecuteAfterMemberAdd ¶
func (h *HookRegistry) ExecuteAfterMemberAdd(ctx context.Context, member interface{}) error
ExecuteAfterMemberAdd executes all after member add hooks
func (*HookRegistry) ExecuteAfterOrganizationCreate ¶
func (h *HookRegistry) ExecuteAfterOrganizationCreate(ctx context.Context, org interface{}) error
ExecuteAfterOrganizationCreate executes all after organization create hooks
func (*HookRegistry) ExecuteAfterPermissionEvaluate ¶ added in v0.0.3
func (h *HookRegistry) ExecuteAfterPermissionEvaluate(ctx context.Context, req *PermissionEvaluateRequest, decision *PermissionDecision) error
ExecuteAfterPermissionEvaluate executes all after permission evaluate hooks
func (*HookRegistry) ExecuteAfterSessionCreate ¶
func (h *HookRegistry) ExecuteAfterSessionCreate(ctx context.Context, session *session.Session) error
ExecuteAfterSessionCreate executes all after session create hooks
func (*HookRegistry) ExecuteAfterSessionRevoke ¶
ExecuteAfterSessionRevoke executes all after session revoke hooks
func (*HookRegistry) ExecuteAfterSignIn ¶
func (h *HookRegistry) ExecuteAfterSignIn(ctx context.Context, response *responses.AuthResponse) error
ExecuteAfterSignIn executes all after sign in hooks
func (*HookRegistry) ExecuteAfterSignOut ¶
func (h *HookRegistry) ExecuteAfterSignOut(ctx context.Context, token string) error
ExecuteAfterSignOut executes all after sign out hooks
func (*HookRegistry) ExecuteAfterSignUp ¶
func (h *HookRegistry) ExecuteAfterSignUp(ctx context.Context, response *responses.AuthResponse) error
ExecuteAfterSignUp executes all after sign up hooks
func (*HookRegistry) ExecuteAfterUserCreate ¶
ExecuteAfterUserCreate executes all after user create hooks
func (*HookRegistry) ExecuteAfterUserDelete ¶
ExecuteAfterUserDelete executes all after user delete hooks
func (*HookRegistry) ExecuteAfterUserUpdate ¶
ExecuteAfterUserUpdate executes all after user update hooks
func (*HookRegistry) ExecuteBeforeAppCreate ¶
func (h *HookRegistry) ExecuteBeforeAppCreate(ctx context.Context, req interface{}) error
ExecuteBeforeAppCreate executes all before app create hooks
func (*HookRegistry) ExecuteBeforeMemberAdd ¶
func (h *HookRegistry) ExecuteBeforeMemberAdd(ctx context.Context, orgID string, userID xid.ID) error
ExecuteBeforeMemberAdd executes all before member add hooks
func (*HookRegistry) ExecuteBeforeOrganizationCreate ¶
func (h *HookRegistry) ExecuteBeforeOrganizationCreate(ctx context.Context, req interface{}) error
ExecuteBeforeOrganizationCreate executes all before organization create hooks
func (*HookRegistry) ExecuteBeforePermissionEvaluate ¶ added in v0.0.3
func (h *HookRegistry) ExecuteBeforePermissionEvaluate(ctx context.Context, req *PermissionEvaluateRequest) error
ExecuteBeforePermissionEvaluate executes all before permission evaluate hooks
func (*HookRegistry) ExecuteBeforeSessionCreate ¶
func (h *HookRegistry) ExecuteBeforeSessionCreate(ctx context.Context, req *session.CreateSessionRequest) error
ExecuteBeforeSessionCreate executes all before session create hooks
func (*HookRegistry) ExecuteBeforeSessionRevoke ¶
func (h *HookRegistry) ExecuteBeforeSessionRevoke(ctx context.Context, token string) error
ExecuteBeforeSessionRevoke executes all before session revoke hooks
func (*HookRegistry) ExecuteBeforeSignIn ¶
func (h *HookRegistry) ExecuteBeforeSignIn(ctx context.Context, req *auth.SignInRequest) error
ExecuteBeforeSignIn executes all before sign in hooks
func (*HookRegistry) ExecuteBeforeSignOut ¶
func (h *HookRegistry) ExecuteBeforeSignOut(ctx context.Context, token string) error
ExecuteBeforeSignOut executes all before sign out hooks
func (*HookRegistry) ExecuteBeforeSignUp ¶
func (h *HookRegistry) ExecuteBeforeSignUp(ctx context.Context, req *auth.SignUpRequest) error
ExecuteBeforeSignUp executes all before sign up hooks
func (*HookRegistry) ExecuteBeforeUserCreate ¶
func (h *HookRegistry) ExecuteBeforeUserCreate(ctx context.Context, req *user.CreateUserRequest) error
ExecuteBeforeUserCreate executes all before user create hooks
func (*HookRegistry) ExecuteBeforeUserDelete ¶
ExecuteBeforeUserDelete executes all before user delete hooks
func (*HookRegistry) ExecuteBeforeUserUpdate ¶
func (h *HookRegistry) ExecuteBeforeUserUpdate(ctx context.Context, userID xid.ID, req *user.UpdateUserRequest) error
ExecuteBeforeUserUpdate executes all before user update hooks
func (*HookRegistry) ExecuteOnCacheInvalidate ¶ added in v0.0.3
ExecuteOnCacheInvalidate executes all on cache invalidate hooks
func (*HookRegistry) ExecuteOnPolicyChange ¶ added in v0.0.3
func (h *HookRegistry) ExecuteOnPolicyChange(ctx context.Context, policyID xid.ID, action string) error
ExecuteOnPolicyChange executes all on policy change hooks
func (*HookRegistry) GetHookCounts ¶ added in v0.0.3
func (h *HookRegistry) GetHookCounts() map[string]int
GetHookCounts returns the count of registered hooks for diagnostics
func (*HookRegistry) RegisterAfterAppCreate ¶
func (h *HookRegistry) RegisterAfterAppCreate(hook AfterAppCreateHook)
func (*HookRegistry) RegisterAfterMemberAdd ¶
func (h *HookRegistry) RegisterAfterMemberAdd(hook AfterMemberAddHook)
func (*HookRegistry) RegisterAfterOrganizationCreate ¶
func (h *HookRegistry) RegisterAfterOrganizationCreate(hook AfterOrganizationCreateHook)
func (*HookRegistry) RegisterAfterPermissionEvaluate ¶ added in v0.0.3
func (h *HookRegistry) RegisterAfterPermissionEvaluate(hook AfterPermissionEvaluateHook)
RegisterAfterPermissionEvaluate registers an after permission evaluate hook
func (*HookRegistry) RegisterAfterSessionCreate ¶
func (h *HookRegistry) RegisterAfterSessionCreate(hook AfterSessionCreateHook)
func (*HookRegistry) RegisterAfterSessionRevoke ¶
func (h *HookRegistry) RegisterAfterSessionRevoke(hook AfterSessionRevokeHook)
func (*HookRegistry) RegisterAfterSignIn ¶
func (h *HookRegistry) RegisterAfterSignIn(hook AfterSignInHook)
func (*HookRegistry) RegisterAfterSignOut ¶
func (h *HookRegistry) RegisterAfterSignOut(hook AfterSignOutHook)
func (*HookRegistry) RegisterAfterSignUp ¶
func (h *HookRegistry) RegisterAfterSignUp(hook AfterSignUpHook)
func (*HookRegistry) RegisterAfterUserCreate ¶
func (h *HookRegistry) RegisterAfterUserCreate(hook AfterUserCreateHook)
func (*HookRegistry) RegisterAfterUserDelete ¶
func (h *HookRegistry) RegisterAfterUserDelete(hook AfterUserDeleteHook)
func (*HookRegistry) RegisterAfterUserUpdate ¶
func (h *HookRegistry) RegisterAfterUserUpdate(hook AfterUserUpdateHook)
func (*HookRegistry) RegisterBeforeAppCreate ¶
func (h *HookRegistry) RegisterBeforeAppCreate(hook BeforeAppCreateHook)
App hook registration methods (for multi-app support)
func (*HookRegistry) RegisterBeforeMemberAdd ¶
func (h *HookRegistry) RegisterBeforeMemberAdd(hook BeforeMemberAddHook)
func (*HookRegistry) RegisterBeforeOrganizationCreate ¶
func (h *HookRegistry) RegisterBeforeOrganizationCreate(hook BeforeOrganizationCreateHook)
Organization hook registration methods (for multi-tenancy plugin)
func (*HookRegistry) RegisterBeforePermissionEvaluate ¶ added in v0.0.3
func (h *HookRegistry) RegisterBeforePermissionEvaluate(hook BeforePermissionEvaluateHook)
RegisterBeforePermissionEvaluate registers a before permission evaluate hook
func (*HookRegistry) RegisterBeforeSessionCreate ¶
func (h *HookRegistry) RegisterBeforeSessionCreate(hook BeforeSessionCreateHook)
Session hook registration methods
func (*HookRegistry) RegisterBeforeSessionRevoke ¶
func (h *HookRegistry) RegisterBeforeSessionRevoke(hook BeforeSessionRevokeHook)
func (*HookRegistry) RegisterBeforeSignIn ¶
func (h *HookRegistry) RegisterBeforeSignIn(hook BeforeSignInHook)
func (*HookRegistry) RegisterBeforeSignOut ¶
func (h *HookRegistry) RegisterBeforeSignOut(hook BeforeSignOutHook)
func (*HookRegistry) RegisterBeforeSignUp ¶
func (h *HookRegistry) RegisterBeforeSignUp(hook BeforeSignUpHook)
Auth hook registration methods
func (*HookRegistry) RegisterBeforeUserCreate ¶
func (h *HookRegistry) RegisterBeforeUserCreate(hook BeforeUserCreateHook)
User hook registration methods
func (*HookRegistry) RegisterBeforeUserDelete ¶
func (h *HookRegistry) RegisterBeforeUserDelete(hook BeforeUserDeleteHook)
func (*HookRegistry) RegisterBeforeUserUpdate ¶
func (h *HookRegistry) RegisterBeforeUserUpdate(hook BeforeUserUpdateHook)
func (*HookRegistry) RegisterOnCacheInvalidate ¶ added in v0.0.3
func (h *HookRegistry) RegisterOnCacheInvalidate(hook OnCacheInvalidateHook)
RegisterOnCacheInvalidate registers an on cache invalidate hook
func (*HookRegistry) RegisterOnPolicyChange ¶ added in v0.0.3
func (h *HookRegistry) RegisterOnPolicyChange(hook OnPolicyChangeHook)
RegisterOnPolicyChange registers an on policy change hook
type OnCacheInvalidateHook ¶ added in v0.0.3
type OnPolicyChangeHook ¶ added in v0.0.3
type PermissionDecision ¶ added in v0.0.3
type PermissionDecision struct {
Allowed bool
MatchedPolicies []string
EvaluationTimeMs float64
CacheHit bool
Error string
}
PermissionDecision is passed to after permission evaluate hook
type PermissionEvaluateRequest ¶ added in v0.0.3
type PermissionEvaluateRequest struct {
UserID xid.ID
ResourceType string
ResourceID string
Action string
Context map[string]interface{}
}
Permission hooks (for permissions plugin) PermissionEvaluateRequest is passed to before/after permission evaluate hooks