Documentation
¶
Index ¶
- Constants
- type Claims
- type Manager
- func (m *Manager) BCLogout(ctx context.Context, logoutJWT string) error
- func (m *Manager) FinaliseOIDCLogin(ctx context.Context, stateID, code string) (OIDCSessionData, error)
- func (m *Manager) IsValidRequestURI(requestURI string) bool
- func (m *Manager) LoadState(ctx context.Context, stateID string) (State, error)
- func (m *Manager) Logout(ctx context.Context, sessionID, postLogoutRedirectURL string) (string, error)
- func (m *Manager) MakeAuthURI(ctx context.Context, tenantID, requestURI, errorURI string) (string, string, error)
- func (m *Manager) MakeCSRFCookie(ctx context.Context, tenantID, value string) (*http.Cookie, error)
- func (m *Manager) MakeLoginCSRFCookie(ctx context.Context, value string) (*http.Cookie, error)
- func (m *Manager) MakeSessionCookie(ctx context.Context, tenantID, value string) (*http.Cookie, error)
- func (m *Manager) TriggerHousekeeping(ctx context.Context, concurrencyLimit int, ...) error
- func (m *Manager) ValidateCSRFToken(token, sessionID string) bool
- type ManagerOption
- type OIDCSessionData
- type Repository
- type Session
- type State
Constants ¶
View Source
const (
LoginCSRFCookieName = "__Host-LoginCSRF"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager( ctx context.Context, cfg *config.SessionManager, trust sessionmanager.Trust, sessionsRepo Repository, auditLogger *otlpaudit.AuditLogger, opts ...ManagerOption, ) (*Manager, error)
func (*Manager) FinaliseOIDCLogin ¶
func (*Manager) IsValidRequestURI ¶ added in v0.18.0
IsValidRequestURI returns true if the URI is relative (no scheme or host), or if its scheme and host exactly match a configured base URL and its path is rooted under that base path.
func (*Manager) MakeAuthURI ¶
func (m *Manager) MakeAuthURI(ctx context.Context, tenantID, requestURI, errorURI string) (string, string, error)
MakeAuthURI returns an OIDC authentication URI.
func (*Manager) MakeCSRFCookie ¶
func (*Manager) MakeLoginCSRFCookie ¶ added in v0.17.1
func (*Manager) MakeSessionCookie ¶
func (*Manager) TriggerHousekeeping ¶ added in v0.16.0
func (*Manager) ValidateCSRFToken ¶
type ManagerOption ¶ added in v0.17.1
type ManagerOption func(*Manager)
func WithAllowHttpScheme ¶ added in v0.17.1
func WithAllowHttpScheme(allowHttpScheme bool) ManagerOption
func WithTransportCredentials ¶ added in v0.17.1
func WithTransportCredentials(b credentials.Builder) ManagerOption
type OIDCSessionData ¶
type OIDCSessionData struct {
SessionID string
TenantID string
CSRFToken string
RequestURI string
ErrorURI string // Error URI for redirecting to UI error page on failure (optional)
}
OIDCSessionData represents a data from the last step of the OIDC flow.
type Repository ¶
type Repository interface {
// State operations
LoadState(ctx context.Context, stateID string) (State, error)
StoreState(ctx context.Context, state State) error
DeleteState(ctx context.Context, stateID string) error
// Session operations
ListSessions(ctx context.Context) ([]Session, error)
LoadSession(ctx context.Context, sessionID string) (Session, error)
LoadSessionByProviderID(ctx context.Context, providerID string) (Session, error)
StoreSession(ctx context.Context, session Session) error
DeleteSession(ctx context.Context, session Session) error
IsActive(ctx context.Context, sessionID string) (bool, error)
BumpActive(ctx context.Context, sessionID string, timeout time.Duration) error
}
type Session ¶
type Session struct {
ID string // Session ID in our system
TenantID string // Tenant ID for which the session is created
ProviderID string // Provider session ID defined by the OIDC provider (`sid` claim)
CSRFToken string // CSRF token to prevent CSRF attacks
Issuer string // Issuer of the OIDC tokens
Claims Claims // Claims from the ID token
AccessToken string // Access token from the identity provider
RefreshToken string // Refresh token from the identity provider
Expiry time.Time // Expiry time of the session
AccessTokenExpiry time.Time // Expiry time of the Access Token
AuthContext map[string]string // Additional authentication context
}
Session represents a user session in our system.
type State ¶
type State struct {
ID string // State ID to align the auth request with the callback
TenantID string // Tenant ID for which the login is done
PKCEVerifier string // PKCE verifier to validate the PKCE challenge
RequestURI string // Request URI for the eventual redirect
ErrorURI string // Error URI for redirecting to UI error page on failure (optional)
Expiry time.Time // Expiry time of the login process
LoginCSRFToken string // CSRF token to prevent CSRF attacks
}
State represents the state of an authentication process according to the OIDC spec. It is used to align the auth request with the callback and to store necessary information for completing the authentication process.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.