Documentation
¶
Index ¶
- Constants
- func CodeChallengeToOIDC(challenge *OIDCCodeChallenge) *protocol.CodeChallenge
- func MaxAgeToInternal(maxAge *uint) *time.Duration
- func PromptToInternal(oidcPrompt protocol.SpaceDelimitedArray) []string
- type AuthRequest
- func (a *AuthRequest) Done() bool
- func (a *AuthRequest) ExtraIDTokenClaims() map[string]any
- func (a *AuthRequest) GetACR() string
- func (a *AuthRequest) GetAMR() []string
- func (a *AuthRequest) GetAudience() []string
- func (a *AuthRequest) GetAuthTime() time.Time
- func (a *AuthRequest) GetClaims() *protocol.ClaimsRequest
- func (a *AuthRequest) GetClientID() string
- func (a *AuthRequest) GetCodeChallenge() *protocol.CodeChallenge
- func (a *AuthRequest) GetID() string
- func (a *AuthRequest) GetNonce() string
- func (a *AuthRequest) GetRedirectURI() string
- func (a *AuthRequest) GetResources() []string
- func (a *AuthRequest) GetResponseMode() protocol.ResponseMode
- func (a *AuthRequest) GetResponseType() protocol.ResponseType
- func (a *AuthRequest) GetSID() string
- func (a *AuthRequest) GetScopes() []string
- func (a *AuthRequest) GetState() string
- func (a *AuthRequest) GetSubject() string
- func (a *AuthRequest) LogValue() slog.Value
- type Client
- func BackChannelLogoutWebClient(id, secret, uri string, redirectURIs ...string) *Client
- func DeviceClient(id, secret string) *Client
- func EncryptedWebClient(id, secret string, alg, enc string, redirectURIs ...string) *Client
- func EncryptedWebClientWithKey(id, secret string, alg, enc string, key interface{}, redirectURIs ...string) *Client
- func FAPIClient(id string, clientJWKS []jwk.Key, redirectURIs ...string) *Client
- func FAPIClientMTLS(id string, clientJWKS []jwk.Key, redirectURIs ...string) *Client
- func FAPIClientMTLSDPoP(id string, clientJWKS []jwk.Key, redirectURIs ...string) *Client
- func FAPIClientWithJWKSURI(id, jwksURI string, redirectURIs ...string) *Client
- func NativeClient(id string, redirectURIs ...string) *Client
- func OIDFBackChannelLogoutEncryptedTestClient(id, secret, backChannelLogoutURI, alg, enc string, key interface{}, ...) *Client
- func OIDFBackChannelLogoutTestClient(id, secret, backChannelLogoutURI string, redirectURIs ...string) *Client
- func OIDFEncryptedTestClient(id, secret string, alg, enc string, key interface{}, redirectURIs ...string) *Client
- func OIDFTestClient(id, secret string, redirectURIs ...string) *Client
- func OIDFTestClientSecretPost(id, secret string, redirectURIs ...string) *Client
- func WebClient(id, secret string, redirectURIs ...string) *Client
- func (c *Client) AuthMethod() protocol.AuthMethod
- func (c *Client) BackChannelLogoutURI() string
- func (c *Client) ClientEncryptionKey() interface{}
- func (c *Client) ClientJWKS() []jwk.Key
- func (c *Client) ClientJWKSURI() string
- func (c *Client) ClockSkew() time.Duration
- func (c *Client) DevMode() bool
- func (c *Client) FAPIProfile() bool
- func (c *Client) GetID() string
- func (c *Client) GrantTypes() []protocol.GrantType
- func (c *Client) IDTokenEncryptionAlg() string
- func (c *Client) IDTokenEncryptionEnc() string
- func (c *Client) IDTokenLifetime() time.Duration
- func (c *Client) IDTokenSignedResponseAlg() string
- func (c *Client) IDTokenUserinfoClaimsAssertion() bool
- func (c *Client) IsScopeAllowed(scope string) bool
- func (c *Client) LoginURL(id string) string
- func (c *Client) LogoURI() string
- func (c *Client) NotificationEndpoint() string
- func (c *Client) PolicyURI() string
- func (c *Client) PostLogoutRedirectURIs() []string
- func (c *Client) RedirectURIs() []string
- func (c *Client) RequestObjectSigningAlg() string
- func (c *Client) RequireDPoP() bool
- func (c *Client) RequireMtls() bool
- func (c *Client) ResponseTypes() []protocol.ResponseType
- func (c *Client) TOSURI() string
- func (c *Client) ValidateClientCert(cert *x509.Certificate, clientID string) error
- func (c *Client) WithCertCN(cn string) *Client
- func (c *Client) WithIDTokenSignedResponseAlg(alg string) *Client
- func (c *Client) WithNotificationEndpoint(endpoint string) *Client
- func (c *Client) WithRequestObjectSigningAlg(alg string) *Client
- func (c *Client) WithRequireDPoP() *Client
- func (c *Client) WithRequireMtls() *Client
- type DeviceAuthStore
- func (d *DeviceAuthStore) ApproveDeviceAuthorization(_ context.Context, userCode, subject string) error
- func (d *DeviceAuthStore) DenyDeviceAuthorization(_ context.Context, userCode string) error
- func (d *DeviceAuthStore) GetDeviceAuthorizationByUserCode(_ context.Context, userCode string) (*storm.DeviceAuthorizationState, error)
- func (d *DeviceAuthStore) GetDeviceAuthorizationState(_ context.Context, _, deviceCode string) (*storm.DeviceAuthorizationState, error)
- func (d *DeviceAuthStore) StartCleanup(interval time.Duration) *time.Ticker
- func (d *DeviceAuthStore) StoreDeviceAuthorization(_ context.Context, clientID, deviceCode, userCode string, expires time.Time, ...) error
- func (d *DeviceAuthStore) UpdateDeviceAuthorizationInterval(_ context.Context, _, deviceCode string, increment int) error
- func (d *DeviceAuthStore) UpdateDeviceAuthorizationPoll(_ context.Context, _, deviceCode string, lastPoll time.Time) error
- type OIDCCodeChallenge
- type PARStore
- type RefreshToken
- type RefreshTokenRequest
- func (r *RefreshTokenRequest) GetAMR() []string
- func (r *RefreshTokenRequest) GetAudience() []string
- func (r *RefreshTokenRequest) GetAuthTime() time.Time
- func (r *RefreshTokenRequest) GetClientID() string
- func (r *RefreshTokenRequest) GetCodeChallenge() *protocol.CodeChallenge
- func (r *RefreshTokenRequest) GetDPoPJKT() string
- func (r *RefreshTokenRequest) GetID() string
- func (r *RefreshTokenRequest) GetNonce() string
- func (r *RefreshTokenRequest) GetScopes() []string
- func (r *RefreshTokenRequest) GetSessionID() string
- func (r *RefreshTokenRequest) GetSubject() string
- func (r *RefreshTokenRequest) SetCurrentScopes(scopes []string)
- type Service
- type Storage
- func (s *Storage) AuthRequestByCode(_ context.Context, code string) (storm.AuthRequest, error)
- func (s *Storage) AuthRequestByID(_ context.Context, id string) (storm.AuthRequest, error)
- func (s *Storage) AuthorizeClientIDSecret(_ context.Context, clientID, clientSecret string) error
- func (s *Storage) CheckUsernamePassword(username, password, id string) error
- func (s *Storage) ClientCredentials(_ context.Context, clientID, clientSecret string) (storm.Client, error)
- func (s *Storage) ClientCredentialsTokenRequest(_ context.Context, clientID string, scopes []string) (storm.TokenRequest, error)
- func (s *Storage) ClientsForSession(_ context.Context, sub, sid string) ([]storm.Client, error)
- func (s *Storage) CompleteAuthRequest(_ context.Context, id string, subject string, authTime time.Time, sid string) error
- func (s *Storage) CreateAccessAndRefreshTokens(ctx context.Context, req storm.TokenRequest, currentRefreshToken string, ...) (accessTokenID, newRefreshToken string, expiration time.Time, err error)
- func (s *Storage) CreateAccessToken(ctx context.Context, req storm.TokenRequest, cnf map[string]any) (string, time.Time, error)
- func (s *Storage) CreateAuthRequest(_ context.Context, req *protocol.AuthRequest, userID string) (storm.AuthRequest, error)
- func (s *Storage) CreateClient(_ context.Context, req *storm.RegistrationRequest, ...) (*storm.ClientRegistration, error)
- func (s *Storage) CreateSession(subject string, authTime time.Time, sid string)
- func (s *Storage) CreateSessionWithClient(subject, clientID string, authTime time.Time, sid string)
- func (s *Storage) CreateTokenExchangeRequest(_ context.Context, _ storm.TokenExchangeRequest) error
- func (s *Storage) DeleteAuthRequest(_ context.Context, id string) error
- func (s *Storage) DeleteCIBARequest(_ context.Context, authReqID string) error
- func (s *Storage) DeleteClientRegistration(_ context.Context, clientID string) error
- func (s *Storage) GetAuthRequestDPoPJKT(_ context.Context, authRequestID string) (string, error)
- func (s *Storage) GetAuthRequestSessionID(id string) string
- func (s *Storage) GetCIBARequestByAuthReqID(_ context.Context, authReqID string) (*storm.CIBARequest, error)
- func (s *Storage) GetClientByClientID(_ context.Context, clientID string) (storm.Client, error)
- func (s *Storage) GetClientRegistration(_ context.Context, clientID string) (*storm.ClientRegistration, error)
- func (s *Storage) GetClientRegistrationByToken(_ context.Context, token string) (*storm.ClientRegistration, error)
- func (s *Storage) GetPendingCIBARequests(_ context.Context, subject string) ([]*storm.CIBARequest, error)
- func (s *Storage) GetRefreshTokenInfo(_ context.Context, clientID, token string) (userID, tokenID string, err error)
- func (s *Storage) GetSession(_ context.Context, r *http.Request, clientID string) (string, time.Time, string, bool)
- func (s *Storage) GetSessionBySubject(subject string, clientID ...string) (authTime time.Time, sid string, ok bool)
- func (s *Storage) Health(_ context.Context) error
- func (s *Storage) KeySet(_ context.Context) ([]storm.Key, error)
- func (s *Storage) OnCIBAStatusChange(_ context.Context, req *storm.CIBARequest) error
- func (s *Storage) RecordClientSession(subject, clientID, sid string)
- func (s *Storage) RegisterClients(registerClients ...*Client)
- func (s *Storage) RemoveClientSession(subject, clientID string)
- func (s *Storage) RevokeToken(_ context.Context, tokenOrTokenID, userID, clientID string) *protocol.Error
- func (s *Storage) RevokeTokensForUsedCode(code string) string
- func (s *Storage) RotateSigningKey() error
- func (s *Storage) SaveAuthCode(_ context.Context, id, code string) error
- func (s *Storage) SetAuthRequestDPoPJKT(_ context.Context, authRequestID string, jkt string) error
- func (s *Storage) SetIntrospectionFromToken(_ context.Context, resp *protocol.IntrospectionResponse, ...) error
- func (s *Storage) SetTokenCNF(_ context.Context, tokenID string, cnf map[string]any) error
- func (s *Storage) SetUserinfoFromToken(_ context.Context, userinfo *protocol.UserInfo, ...) error
- func (s *Storage) SignatureAlgorithms(_ context.Context) ([]string, error)
- func (s *Storage) SigningKey(_ context.Context) (storm.SigningKey, error)
- func (s *Storage) SigningKeyByAlg(_ context.Context, alg string) (storm.SigningKey, error)
- func (s *Storage) SigningKeyCount() int
- func (s *Storage) StoreCIBARequest(_ context.Context, req *storm.CIBARequest) error
- func (s *Storage) TerminateSession(_ context.Context, userID, clientID string) error
- func (s *Storage) TokenCNF(_ context.Context, tokenID string) (map[string]any, error)
- func (s *Storage) TokenClientID(_ context.Context, tokenID string) (string, error)
- func (s *Storage) TokenRequestByRefreshToken(_ context.Context, refreshToken string) (storm.RefreshTokenRequest, error)
- func (s *Storage) TrackTokenForAuthRequest(authRequestID, tokenID string)
- func (s *Storage) UpdateCIBAInterval(_ context.Context, authReqID string, increment int) error
- func (s *Storage) UpdateCIBAPoll(_ context.Context, authReqID string, lastPoll time.Time) error
- func (s *Storage) UpdateCIBARequestStatus(_ context.Context, authReqID string, status protocol.CIBAStatus, ...) error
- func (s *Storage) UpdateClientRegistration(_ context.Context, clientID string, update *storm.RegistrationRequest) (*storm.ClientRegistration, error)
- func (s *Storage) UserInfoResponseAlg(_ context.Context, clientID string) (string, error)
- func (s *Storage) ValidateJWTProfileScopes(_ context.Context, userID string, scopes []string) ([]string, error)
- func (s *Storage) ValidateTokenExchangeRequest(_ context.Context, req storm.TokenExchangeRequest) error
- type Token
- type TokenCrypto
- func (c *TokenCrypto) AlgorithmSuite() string
- func (c *TokenCrypto) Decrypt(_ context.Context, ciphertext []byte) ([]byte, error)
- func (c *TokenCrypto) Encrypt(_ context.Context, plaintext []byte) ([]byte, error)
- func (c *TokenCrypto) EncryptToken(tokenID string) string
- func (c *TokenCrypto) Hash(_ context.Context, sigAlgorithm string, data []byte) ([]byte, error)
- func (c *TokenCrypto) Sign(_ context.Context, keyID string, payload []byte) (string, error)
- type User
- type UserStore
Constants ¶
const ( CustomScope = "custom_scope" CustomClaim = "custom_claim" CustomScopeImpersonatePrefix = "custom_scope:impersonate:" )
const ( // ServiceUserID is the ID of the service user. ServiceUserID = "service" // ServiceUserKeyID is the key ID of the service user. ServiceUserKeyID = "key1" )
Variables ¶
This section is empty.
Functions ¶
func CodeChallengeToOIDC ¶
func CodeChallengeToOIDC(challenge *OIDCCodeChallenge) *protocol.CodeChallenge
func MaxAgeToInternal ¶
func PromptToInternal ¶
func PromptToInternal(oidcPrompt protocol.SpaceDelimitedArray) []string
Types ¶
type AuthRequest ¶
type AuthRequest struct {
ID string
CreationDate time.Time
ApplicationID string
CallbackURI string
TransferState string
Prompt []string
UiLocales []language.Tag
LoginHint string
MaxAuthAge *time.Duration
UserID string
Scopes []string
ResponseType protocol.ResponseType
ResponseMode protocol.ResponseMode
Nonce string
CodeChallenge *OIDCCodeChallenge
ACRValues []string
Claims *protocol.ClaimsRequest
Resources []string // RFC 8707: Resource Indicators
// contains filtered or unexported fields
}
func (*AuthRequest) Done ¶
func (a *AuthRequest) Done() bool
func (*AuthRequest) ExtraIDTokenClaims ¶
func (a *AuthRequest) ExtraIDTokenClaims() map[string]any
ExtraIDTokenClaims implements idTokenClaimsExtender for the token plugin. Returns claims requested via the OIDC §5.5 claims.id_token parameter.
func (*AuthRequest) GetACR ¶
func (a *AuthRequest) GetACR() string
func (*AuthRequest) GetAMR ¶
func (a *AuthRequest) GetAMR() []string
func (*AuthRequest) GetAudience ¶
func (a *AuthRequest) GetAudience() []string
func (*AuthRequest) GetAuthTime ¶
func (a *AuthRequest) GetAuthTime() time.Time
func (*AuthRequest) GetClaims ¶
func (a *AuthRequest) GetClaims() *protocol.ClaimsRequest
func (*AuthRequest) GetClientID ¶
func (a *AuthRequest) GetClientID() string
func (*AuthRequest) GetCodeChallenge ¶
func (a *AuthRequest) GetCodeChallenge() *protocol.CodeChallenge
func (*AuthRequest) GetID ¶
func (a *AuthRequest) GetID() string
func (*AuthRequest) GetNonce ¶
func (a *AuthRequest) GetNonce() string
func (*AuthRequest) GetRedirectURI ¶
func (a *AuthRequest) GetRedirectURI() string
func (*AuthRequest) GetResources ¶
func (a *AuthRequest) GetResources() []string
GetResources implements storm.ResourceIndicator (RFC 8707). Returns the resource indicator values from the authorization request.
func (*AuthRequest) GetResponseMode ¶
func (a *AuthRequest) GetResponseMode() protocol.ResponseMode
func (*AuthRequest) GetResponseType ¶
func (a *AuthRequest) GetResponseType() protocol.ResponseType
func (*AuthRequest) GetSID ¶
func (a *AuthRequest) GetSID() string
func (*AuthRequest) GetScopes ¶
func (a *AuthRequest) GetScopes() []string
func (*AuthRequest) GetState ¶
func (a *AuthRequest) GetState() string
func (*AuthRequest) GetSubject ¶
func (a *AuthRequest) GetSubject() string
func (*AuthRequest) LogValue ¶
func (a *AuthRequest) LogValue() slog.Value
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an OAuth/OIDC client. It implements storm.Client and various optional interfaces checked via type assertions by plugins.
func DeviceClient ¶
func EncryptedWebClient ¶
func EncryptedWebClientWithKey ¶
func EncryptedWebClientWithKey(id, secret string, alg, enc string, key interface{}, redirectURIs ...string) *Client
EncryptedWebClientWithKey creates a web client with ID token encryption using the provided public key (RSA, ECDH, or symmetric key).
func FAPIClient ¶
FAPIClient creates a FAPI-compliant client using private_key_jwt authentication. The client supports authorization_code and client_credentials grants, and uses the provided JWK set for JWT bearer verification.
func FAPIClientMTLS ¶
FAPIClientMTLS creates a FAPI-compliant client using tls_client_auth authentication. This client is used for mtls CIBA variants where the client authenticates via TLS client certificate instead of client_assertion. clientJWKS is still needed for request object signature verification.
func FAPIClientMTLSDPoP ¶
FAPIClientMTLSDPoP creates a FAPI-compliant client using tls_client_auth authentication with DPoP sender constraining only (requireDPoP=true, requireMtls=false). Used for sender_constrain=dpop variants where the server should reject requests without a DPoP proof, even if mTLS certificates are present.
func FAPIClientWithJWKSURI ¶
FAPIClientWithJWKSURI creates a FAPI-compliant client using private_key_jwt authentication with a jwks_uri for key discovery.
func NativeClient ¶
func OIDFBackChannelLogoutEncryptedTestClient ¶
func OIDFBackChannelLogoutEncryptedTestClient(id, secret, backChannelLogoutURI, alg, enc string, key interface{}, redirectURIs ...string) *Client
OIDFBackChannelLogoutEncryptedTestClient creates an OIDF test client with back-channel logout and ID token encryption support.
func OIDFEncryptedTestClient ¶
func OIDFEncryptedTestClient(id, secret string, alg, enc string, key interface{}, redirectURIs ...string) *Client
OIDFEncryptedTestClient creates an OIDF test client with ID token encryption using jwk.Key (which includes kid in the JWE header per OIDCC-10.2.1).
func OIDFTestClient ¶
func (*Client) AuthMethod ¶
func (c *Client) AuthMethod() protocol.AuthMethod
func (*Client) BackChannelLogoutURI ¶
func (*Client) ClientEncryptionKey ¶
func (c *Client) ClientEncryptionKey() interface{}
func (*Client) ClientJWKS ¶
func (*Client) ClientJWKSURI ¶
func (*Client) FAPIProfile ¶
func (*Client) GrantTypes ¶
func (*Client) IDTokenEncryptionAlg ¶
func (*Client) IDTokenEncryptionEnc ¶
func (*Client) IDTokenLifetime ¶
func (*Client) IDTokenSignedResponseAlg ¶
func (*Client) IDTokenUserinfoClaimsAssertion ¶
func (*Client) IsScopeAllowed ¶
func (*Client) NotificationEndpoint ¶
NotificationEndpoint returns the client's CIBA notification endpoint (CIBA Core 1.0 §10). Implements storm.NotificationEndpointProvider for SSRF validation.
func (*Client) PostLogoutRedirectURIs ¶
func (*Client) RedirectURIs ¶
func (*Client) RequestObjectSigningAlg ¶
func (*Client) RequireDPoP ¶
func (*Client) RequireMtls ¶
func (*Client) ResponseTypes ¶
func (c *Client) ResponseTypes() []protocol.ResponseType
func (*Client) ValidateClientCert ¶
func (c *Client) ValidateClientCert(cert *x509.Certificate, clientID string) error
ValidateClientCert implements shared.ClientCertBoundAuthenticator. It checks that the presented TLS certificate's CN matches the expected value. This allows the SDK to distinguish between clients that share mTLS infrastructure but have different certificate identities (e.g. OIDF test suite mtls variants).
func (*Client) WithCertCN ¶
WithCertCN sets the expected TLS client certificate CN for tls_client_auth. When set, ValidateClientCert will reject certificates whose CN does not match.
func (*Client) WithIDTokenSignedResponseAlg ¶
WithIDTokenSignedResponseAlg sets the id_token_signed_response_alg for this client.
func (*Client) WithNotificationEndpoint ¶
WithNotificationEndpoint sets the client_notification_endpoint for CIBA ping mode.
func (*Client) WithRequestObjectSigningAlg ¶
WithRequestObjectSigningAlg sets the request_object_signing_alg for this client and returns the client for chaining. Use "PS256" for FAPI 2.0 signed_non_repudiation.
func (*Client) WithRequireDPoP ¶
WithRequireDPoP enables DPoP sender-constraining for this client.
func (*Client) WithRequireMtls ¶
WithRequireMtls enables mTLS sender-constraining for this client.
type DeviceAuthStore ¶
type DeviceAuthStore struct {
// contains filtered or unexported fields
}
func (*DeviceAuthStore) ApproveDeviceAuthorization ¶
func (d *DeviceAuthStore) ApproveDeviceAuthorization(_ context.Context, userCode, subject string) error
func (*DeviceAuthStore) DenyDeviceAuthorization ¶
func (d *DeviceAuthStore) DenyDeviceAuthorization(_ context.Context, userCode string) error
func (*DeviceAuthStore) GetDeviceAuthorizationByUserCode ¶
func (d *DeviceAuthStore) GetDeviceAuthorizationByUserCode(_ context.Context, userCode string) (*storm.DeviceAuthorizationState, error)
func (*DeviceAuthStore) GetDeviceAuthorizationState ¶
func (d *DeviceAuthStore) GetDeviceAuthorizationState(_ context.Context, _, deviceCode string) (*storm.DeviceAuthorizationState, error)
func (*DeviceAuthStore) StartCleanup ¶
func (d *DeviceAuthStore) StartCleanup(interval time.Duration) *time.Ticker
StartCleanup starts a background goroutine that cleans up expired entries every interval.
func (*DeviceAuthStore) StoreDeviceAuthorization ¶
func (*DeviceAuthStore) UpdateDeviceAuthorizationInterval ¶
func (*DeviceAuthStore) UpdateDeviceAuthorizationPoll ¶
type OIDCCodeChallenge ¶
type PARStore ¶
type PARStore struct {
// contains filtered or unexported fields
}
PARStore implements storm.PARStore for in-memory pushed authorization requests.
func NewPARStore ¶
func NewPARStore() *PARStore
func (*PARStore) GetPushedAuthRequest ¶
type RefreshToken ¶
type RefreshToken struct {
ID string
Token string
AuthTime time.Time
AMR []string
Audience []string
UserID string
ApplicationID string
Expiration time.Time
Scopes []string
AccessToken string
SessionID string
// DPoPJKT stores the JWK thumbprint bound to this refresh token.
// Inherited from the associated access token's cnf.jkt when the token
// is DPoP-bound (RFC 9449 §7.2).
DPoPJKT string
}
type RefreshTokenRequest ¶
type RefreshTokenRequest struct {
*RefreshToken
}
RefreshTokenRequest wraps a RefreshToken to implement storm.RefreshTokenRequest.
func (*RefreshTokenRequest) GetAMR ¶
func (r *RefreshTokenRequest) GetAMR() []string
func (*RefreshTokenRequest) GetAudience ¶
func (r *RefreshTokenRequest) GetAudience() []string
func (*RefreshTokenRequest) GetAuthTime ¶
func (r *RefreshTokenRequest) GetAuthTime() time.Time
func (*RefreshTokenRequest) GetClientID ¶
func (r *RefreshTokenRequest) GetClientID() string
func (*RefreshTokenRequest) GetCodeChallenge ¶
func (r *RefreshTokenRequest) GetCodeChallenge() *protocol.CodeChallenge
func (*RefreshTokenRequest) GetDPoPJKT ¶
func (r *RefreshTokenRequest) GetDPoPJKT() string
func (*RefreshTokenRequest) GetID ¶
func (r *RefreshTokenRequest) GetID() string
func (*RefreshTokenRequest) GetNonce ¶
func (r *RefreshTokenRequest) GetNonce() string
func (*RefreshTokenRequest) GetScopes ¶
func (r *RefreshTokenRequest) GetScopes() []string
func (*RefreshTokenRequest) GetSessionID ¶
func (r *RefreshTokenRequest) GetSessionID() string
func (*RefreshTokenRequest) GetSubject ¶
func (r *RefreshTokenRequest) GetSubject() string
func (*RefreshTokenRequest) SetCurrentScopes ¶
func (r *RefreshTokenRequest) SetCurrentScopes(scopes []string)
type Storage ¶
type Storage struct {
// deviceAuthStore handles device authorization grant (RFC 8628).
*DeviceAuthStore
// parStore handles pushed authorization requests (RFC 9126).
*PARStore
// contains filtered or unexported fields
}
Storage implements storm.Storage and all capability interfaces.
func NewStorage ¶
func (*Storage) AuthRequestByCode ¶
func (*Storage) AuthRequestByID ¶
func (*Storage) AuthorizeClientIDSecret ¶
func (*Storage) CheckUsernamePassword ¶
func (*Storage) ClientCredentials ¶
func (*Storage) ClientCredentialsTokenRequest ¶
func (*Storage) ClientsForSession ¶
ClientsForSession implements storm.BackChannelStore. Returns all clients that have active sessions for the given subject. If sid is provided, only returns clients with matching session ID.
func (*Storage) CompleteAuthRequest ¶
func (s *Storage) CompleteAuthRequest(_ context.Context, id string, subject string, authTime time.Time, sid string) error
CompleteAuthRequest implements storm.AutoCompleteAuthRequest. It marks an auth request as done with the given subject and the original authentication time, without going through the login UI. Used for prompt=none with active sessions.
func (*Storage) CreateAccessAndRefreshTokens ¶
func (*Storage) CreateAccessToken ¶
func (*Storage) CreateAuthRequest ¶
func (s *Storage) CreateAuthRequest(_ context.Context, req *protocol.AuthRequest, userID string) (storm.AuthRequest, error)
func (*Storage) CreateClient ¶
func (s *Storage) CreateClient(_ context.Context, req *storm.RegistrationRequest, clientID, clientSecret, accessToken, uri string) (*storm.ClientRegistration, error)
func (*Storage) CreateSession ¶
CreateSession records a subject as having an active session. The session is stored with the session ID as the key. Default session expiry is 24 hours.
func (*Storage) CreateSessionWithClient ¶
CreateSessionWithClient records a subject as having an active session for a specific client. The session is stored with the session ID as the key. Default session expiry is 24 hours.
func (*Storage) CreateTokenExchangeRequest ¶
func (*Storage) DeleteAuthRequest ¶
func (*Storage) DeleteCIBARequest ¶
func (*Storage) DeleteClientRegistration ¶
func (*Storage) GetAuthRequestDPoPJKT ¶
GetAuthRequestDPoPJKT implements storm.DPoPCodeBindingStore.
func (*Storage) GetAuthRequestSessionID ¶
GetAuthRequestSessionID returns the session ID for the given auth request. Used by the login handler to set the session_id cookie after successful login.
func (*Storage) GetCIBARequestByAuthReqID ¶
func (*Storage) GetClientByClientID ¶
func (*Storage) GetClientRegistration ¶
func (*Storage) GetClientRegistrationByToken ¶
func (*Storage) GetPendingCIBARequests ¶
func (*Storage) GetRefreshTokenInfo ¶
func (*Storage) GetSession ¶
func (s *Storage) GetSession(_ context.Context, r *http.Request, clientID string) (string, time.Time, string, bool)
GetSession implements authorization.SessionProvider. It checks whether the given subject has an active session and returns the original authentication time and session ID. The session is identified by the "session_id" cookie in the request.
func (*Storage) GetSessionBySubject ¶
func (s *Storage) GetSessionBySubject(subject string, clientID ...string) (authTime time.Time, sid string, ok bool)
GetSessionBySubject returns the most recent active session for a given subject. Used by prompt=none when the caller provides id_token_hint or login_hint instead of a session cookie. If clientID is provided, only returns sessions for that client.
func (*Storage) OnCIBAStatusChange ¶
OnCIBAStatusChange sends a ping notification to the client's notification endpoint when a CIBA request is approved or denied (CIBA Core 1.0 §10).
func (*Storage) RecordClientSession ¶
RecordClientSession records that a client has an active session for a subject. Call this when issuing tokens to a client. Only records sessions for clients that have a backchannel_logout_uri configured, since only those clients need to be notified on logout.
func (*Storage) RegisterClients ¶
func (*Storage) RemoveClientSession ¶
RemoveClientSession removes a client session for a subject.
func (*Storage) RevokeToken ¶
func (*Storage) RevokeTokensForUsedCode ¶
RevokeTokensForUsedCode revokes all tokens that were issued for a used code. Returns the auth request ID if the code was found, or empty string if not.
func (*Storage) RotateSigningKey ¶
RotateSigningKey generates a new RSA-2048/RS256 signing key and prepends it to the key set. Old keys remain in KeySet() for token verification. Note: this is an example server that restarts between test sessions, so unbounded key accumulation is not a concern in practice.
func (*Storage) SaveAuthCode ¶
func (*Storage) SetAuthRequestDPoPJKT ¶
SetAuthRequestDPoPJKT implements storm.DPoPCodeBindingStore.
func (*Storage) SetIntrospectionFromToken ¶
func (*Storage) SetTokenCNF ¶
SetTokenCNF stores the cnf (confirmation) claim for a token (RFC 8705 / RFC 9449).
func (*Storage) SetUserinfoFromToken ¶
func (*Storage) SignatureAlgorithms ¶
func (*Storage) SigningKey ¶
func (*Storage) SigningKeyByAlg ¶
SigningKeyByAlg returns a signing key matching the requested algorithm. Returns an error if no exact match is found — never silently falls back to the default signing key. Silent fallback masks misconfiguration (e.g. a client requesting PS256 silently getting RS256), which breaks FAPI/conformance tests and is the opposite of what Keycloak and other OPs do.
func (*Storage) SigningKeyCount ¶
SigningKeyCount returns the number of signing keys.
func (*Storage) StoreCIBARequest ¶
func (*Storage) TerminateSession ¶
func (*Storage) TokenCNF ¶
TokenCNF retrieves the cnf (confirmation) claim for a token (RFC 8705 / RFC 9449). Returns nil map if the token has no cnf (not sender-constrained).
func (*Storage) TokenClientID ¶
TokenClientID returns the client_id that the token was issued to. Implements storm.TokenClientProvider for UserInfo JWT response (OIDC Core §5.3.2).
func (*Storage) TokenRequestByRefreshToken ¶
func (*Storage) TrackTokenForAuthRequest ¶
TrackTokenForAuthRequest records that a token was issued for an auth request. This is used to revoke tokens when an authorization code is reused.
func (*Storage) UpdateCIBAInterval ¶
func (*Storage) UpdateCIBAPoll ¶
func (*Storage) UpdateCIBARequestStatus ¶
func (*Storage) UpdateClientRegistration ¶
func (s *Storage) UpdateClientRegistration(_ context.Context, clientID string, update *storm.RegistrationRequest) (*storm.ClientRegistration, error)
func (*Storage) UserInfoResponseAlg ¶
UserInfoResponseAlg returns the client's registered userinfo_signed_response_alg. Implements storm.UserInfoResponseAlgProvider for OIDC Core §5.3.2.
func (*Storage) ValidateJWTProfileScopes ¶
func (*Storage) ValidateTokenExchangeRequest ¶
type TokenCrypto ¶
type TokenCrypto struct {
// contains filtered or unexported fields
}
func NewTokenCrypto ¶
func NewTokenCrypto(key [32]byte, method string) *TokenCrypto
func (*TokenCrypto) AlgorithmSuite ¶
func (c *TokenCrypto) AlgorithmSuite() string
AlgorithmSuite implements storm.UniCrypto.AlgorithmSuite.
func (*TokenCrypto) EncryptToken ¶
func (c *TokenCrypto) EncryptToken(tokenID string) string