Documentation
¶
Index ¶
- Constants
- func FiberRequestID(c fiber.Ctx) string
- func GetActiveOrganizationSlug(c fiber.Ctx, store *session.Store) slug.Slug
- func GetClientIP(ctx context.Context) string
- func GetRequestID(ctx context.Context) *string
- func GetUserSlug(c fiber.Ctx, store *session.Store) slug.Slug
- func ResetAndSetAuthenticatedUser(c fiber.Ctx, store *session.Store, userSlug slug.Slug, version int64, ...) error
- func ResetAndSetUserSlug(c fiber.Ctx, store *session.Store, userSlug slug.Slug) error
- func SessionAuthentication(c fiber.Ctx, store *session.Store) (int64, time.Time)
- func SetAPIKeyPrincipal(c fiber.Ctx, principal APIKeyPrincipal)
- func SetActiveOrganizationSlug(c fiber.Ctx, store *session.Store, orgSlug slug.Slug) error
- func SetUserPrincipal(c fiber.Ctx, principal UserPrincipal)
- func SetUserSlug(c fiber.Ctx, store *session.Store, userSlug slug.Slug) error
- func WithClientIP(ctx context.Context, clientIP string) context.Context
- func WithRequestID(ctx context.Context, requestID string) context.Context
- type APIKeyPrincipal
- type UserPrincipal
- type UserPrincipalSource
Constants ¶
const ( SessionUserKey = "user" SessionAuthenticationVersionKey = "authentication_version" SessionAuthenticatedAtKey = "authenticated_at" SessionGoogleSignupKey = "google_signup" SessionGoogleSignupExpiresKey = "google_signup_expires" )
Variables ¶
This section is empty.
Functions ¶
func FiberRequestID ¶
FiberRequestID reads the middleware ID or the application-owned fallback.
func GetActiveOrganizationSlug ¶
GetActiveOrganizationSlug retrieves the selected organization slug from the session.
func GetClientIP ¶
GetClientIP retrieves the trusted browser client IP from context when available.
func GetRequestID ¶
GetRequestID retrieves the request ID from context when available.
func GetUserSlug ¶
GetUserSlug retrieves the authenticated user's slug from the session.
func ResetAndSetAuthenticatedUser ¶
func ResetAndSetAuthenticatedUser(c fiber.Ctx, store *session.Store, userSlug slug.Slug, version int64, passwordOrMFA bool) error
ResetAndSetAuthenticatedUser captures the credential generation proven at sign-in.
func ResetAndSetUserSlug ¶
ResetAndSetUserSlug rotates the session identifier and stores the authenticated user.
func SessionAuthentication ¶
SessionAuthentication reads server-owned proof; missing generations fail closed.
func SetAPIKeyPrincipal ¶
func SetAPIKeyPrincipal(c fiber.Ctx, principal APIKeyPrincipal)
func SetActiveOrganizationSlug ¶
SetActiveOrganizationSlug stores the selected organization slug in the session.
func SetUserPrincipal ¶
func SetUserPrincipal(c fiber.Ctx, principal UserPrincipal)
func SetUserSlug ¶
SetUserSlug stores the user's slug in the session.
func WithClientIP ¶
WithClientIP returns a derived context carrying the trusted browser client IP for an internal frontend-to-backend call.
Types ¶
type APIKeyPrincipal ¶
type APIKeyPrincipal struct {
Slug slug.Slug
OrgSlug slug.Slug
Role slug.Slug
CanManageAPIKeys bool
}
func GetAPIKeyPrincipal ¶
func GetAPIKeyPrincipal(c fiber.Ctx) (APIKeyPrincipal, bool)
type UserPrincipal ¶
type UserPrincipal struct {
Slug slug.Slug
Source UserPrincipalSource
PersonalAccessTokenSlug slug.Slug
CanManagePersonalAccessTokens bool
}
func GetUserPrincipal ¶
type UserPrincipalSource ¶
type UserPrincipalSource string
const ( UserPrincipalSourceSession UserPrincipalSource = "session" UserPrincipalSourcePersonalAccessToken UserPrincipalSource = "personal_access_token" )