session

package
v1.0.0-beta.208 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSessionUserID

func GetSessionUserID(ctx context.Context) *string

GetUserID returns the user ID from the session if any

Types

type AuthenticationSession

type AuthenticationSession struct {
	UserID         string
	OrgID          string
	OrgSlug        string
	OrgRole        string
	OrgPermissions []string
}

AuthenticationSession represents the authentication session for a user

func GetActiveSession

func GetActiveSession(ctx context.Context) *AuthenticationSession

GetActiveSession returns the active session from the context if it exists

func NewAuthenticationSession

func NewAuthenticationSession(orgID, orgSlug, orgRole, userID string, orgPermissions []string) (*AuthenticationSession, error)

NewAuthenticationSession creates a new authentication session

func (AuthenticationSession) Validate

func (s AuthenticationSession) Validate() error

Validate validates the session.

func (AuthenticationSession) WithLogger

func (s AuthenticationSession) WithLogger(logger *slog.Logger) *slog.Logger

WithLogger returns a new logger with the session context

type AuthenticatorContextKey

type AuthenticatorContextKey string
const (
	AuthenticationSessionKey AuthenticatorContextKey = "active_organization_id"
)

Jump to

Keyboard shortcuts

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