Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TemplateFuncMap ¶
TemplateFuncMap is the FuncMap the HTML templates are rendered with. It is shared by the router and the handler tests so the tests exercise the exact production escaping.
json encodes v for embedding inside an inline <script> block. json.Marshal already escapes <, > and &; "</" and "<!--" are additionally neutralised so a value can never terminate the script element or open an HTML comment.
Types ¶
type AppleUserInfo ¶
type AppleUserInfo struct {
Email string `json:"email"`
Name struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
} `json:"name"`
}
AppleUserInfo is the struct for apple user info
type Dependencies ¶
type Dependencies struct {
Log *zerolog.Logger
// Providers for various services
// AuditProvider is used to log audit events
AuditProvider audit.Provider
// AuthenticatorProvider is used to register authenticators like totp (Google Authenticator)
AuthenticatorProvider authenticators.Provider
// EmailProvider is used to send emails
EmailProvider email.Provider
// EventsProvider is used to register events
EventsProvider events.Provider
// MemoryStoreProvider is used to store data in memory
MemoryStoreProvider memory_store.Provider
// SMSProvider is used to send SMS
SMSProvider sms.Provider
// StorageProvider is used to register storage like database
StorageProvider storage.Provider
// TokenProvider is used to generate tokens
TokenProvider token.Provider
// ClientMetadataProvider resolves Client ID Metadata Documents (CIMD):
// client_ids that are HTTPS URLs. nil disables the feature entirely, which
// is the default — it changes the authorization endpoint's trust model for
// every client, so it is opt-in via --enable-client-id-metadata-document.
ClientMetadataProvider *clientmetadata.Provider
// OAuthProvider is used to register oauth providers
OAuthProvider oauth.Provider
// RateLimitProvider is used for per-IP rate limiting
RateLimitProvider rate_limit.Provider
// ServiceProvider hosts the transport-agnostic public-API operations.
// Migrated GraphQL resolvers delegate here.
ServiceProvider service.Provider
// AuthzEngine is the fine-grained authorization (FGA) engine.
// It is nil unless an FGA store is configured (--fga-store).
AuthzEngine engine.AuthorizationEngine
}
Dependencies for a graphql provider
type Provider ¶
type Provider interface {
// AppHandler is the main handler that handles all the app requests
AppHandler() gin.HandlerFunc
// OrgDiscoveryHandler serves the public home-realm-discovery endpoint that
// maps a login email's verified domain to the owning org's SSO login URL.
OrgDiscoveryHandler() gin.HandlerFunc
// AuthorizeHandler is the main handler that handles all the authorize requests
AuthorizeHandler() gin.HandlerFunc
// DashboardHandler is the main handler that handles all the dashboard requests
DashboardHandler() gin.HandlerFunc
// GraphqlHandler is the main handler that handles all the graphql requests
GraphqlHandler() gin.HandlerFunc
// HealthHandler is the handler for the /healthz liveness probe
HealthHandler() gin.HandlerFunc
// ReadyHandler is the handler for the /readyz readiness probe
ReadyHandler() gin.HandlerFunc
// IntrospectHandler is the main handler for RFC 7662 Token Introspection
IntrospectHandler() gin.HandlerFunc
// JWKsHandler is the main handler that handles all the jwks requests
JWKsHandler() gin.HandlerFunc
// LogoutHandler is the main handler that handles all the logout requests
LogoutHandler() gin.HandlerFunc
// OAuthCallbackHandler is the main handler that handles all the oauth callback requests
OAuthCallbackHandler() gin.HandlerFunc
// OAuthLoginHandler is the main handler that handles all the oauth login requests
OAuthLoginHandler() gin.HandlerFunc
// SSOLoginHandler starts a per-org enterprise OIDC SSO broker login.
SSOLoginHandler() gin.HandlerFunc
// SSOCallbackHandler completes a per-org enterprise OIDC SSO broker login.
SSOCallbackHandler() gin.HandlerFunc
// SAMLMetadataHandler serves a per-org SP SAML metadata document.
SAMLMetadataHandler() gin.HandlerFunc
// SAMLLoginHandler starts a per-org SP-initiated SAML SSO login.
SAMLLoginHandler() gin.HandlerFunc
// SAMLACSHandler consumes a per-org SAML assertion (Assertion Consumer Service).
SAMLACSHandler() gin.HandlerFunc
// SAMLIDPMetadataHandler serves a per-org SAML IdP metadata document
// (Authorizer acting as the Identity Provider).
SAMLIDPMetadataHandler() gin.HandlerFunc
// SAMLIDPSSOHandler handles SP-initiated SAML SSO (Authorizer as IdP).
SAMLIDPSSOHandler() gin.HandlerFunc
// SAMLIDPInitiatedHandler handles IdP-initiated SAML SSO to a registered SP.
SAMLIDPInitiatedHandler() gin.HandlerFunc
// OpenIDConfigurationHandler is the main handler that handles all the openid configuration requests
OpenIDConfigurationHandler() gin.HandlerFunc
// ProtectedResourceMetadataHandler serves RFC 9728 OAuth 2.0 Protected
// Resource Metadata for the MCP surface. Registered only when MCP is enabled.
ProtectedResourceMetadataHandler() gin.HandlerFunc
// MCPAuthMiddleware authenticates /mcp and issues the RFC 9728 §5.1
// WWW-Authenticate challenge when it cannot.
MCPAuthMiddleware() gin.HandlerFunc
// ConsentHandler processes the approve/deny decision for a CIMD client.
ConsentHandler() gin.HandlerFunc
// BackchannelAuthenticationHandler is the OpenID CIBA backchannel
// authentication endpoint (POST /oauth/bc-authorize).
BackchannelAuthenticationHandler() gin.HandlerFunc
// CIBAApproveHandler is the CIBA approval page (GET/POST /oauth/bc-approve).
CIBAApproveHandler() gin.HandlerFunc
// RegisterClientHandler implements RFC 7591 dynamic client registration.
// Only routed when EnableDynamicClientRegistration is set.
RegisterClientHandler() gin.HandlerFunc
// PlaygroundHandler is the main handler that handles all the playground requests
PlaygroundHandler() gin.HandlerFunc
// RevokeRefreshTokenHandler is the main handler that handles all the revoke refresh token requests
RevokeRefreshTokenHandler() gin.HandlerFunc
// RootHandler is the main handler that handles all the root requests
RootHandler() gin.HandlerFunc
// TokenHandler is the main handler that handles all the token requests
TokenHandler() gin.HandlerFunc
// UserInfoHandler is the main handler that handles all the user info requests
UserInfoHandler() gin.HandlerFunc
// VerifyEmailHandler is the main handler that handles all the verify email requests
VerifyEmailHandler() gin.HandlerFunc
// ClientCheckMiddleware is the middleware that checks if the client is valid
ClientCheckMiddleware() gin.HandlerFunc
// ContextMiddleware is the middleware that adds the context to the request
ContextMiddleware() gin.HandlerFunc
// CORSMiddleware is the middleware that adds the cors headers to the response
CORSMiddleware() gin.HandlerFunc
// CSRFMiddleware protects against CSRF on state-changing requests
CSRFMiddleware() gin.HandlerFunc
// LoggerMiddleware is the middleware that logs the request
LoggerMiddleware() gin.HandlerFunc
// RateLimitMiddleware is the middleware that rate limits requests per IP
RateLimitMiddleware() gin.HandlerFunc
// MetricsMiddleware records HTTP request count and duration for prometheus.
MetricsMiddleware() gin.HandlerFunc
// MetricsHandler serves the Prometheus metrics scrape endpoint.
MetricsHandler() gin.HandlerFunc
// SecurityHeadersMiddleware sets standard security headers on every response.
SecurityHeadersMiddleware() gin.HandlerFunc
}
Provider is the interface that provides the methods to interact with the http handlers.
type RequestBody ¶
type RequestBody struct {
CodeVerifier string `form:"code_verifier" json:"code_verifier"`
Code string `form:"code" json:"code"`
ClientID string `form:"client_id" json:"client_id"`
ClientSecret string `form:"client_secret" json:"client_secret"`
GrantType string `form:"grant_type" json:"grant_type"`
RefreshToken string `form:"refresh_token" json:"refresh_token"`
RedirectURI string `form:"redirect_uri" json:"redirect_uri"`
// Scope is the space-delimited OAuth2 scope parameter (RFC 6749 §3.3),
// used by the client_credentials grant to request a subset of the service
// account's allowed scopes.
Scope string `form:"scope" json:"scope"`
// ClientAssertion / ClientAssertionType carry the RFC 7523 JWT-bearer client
// credential — the secretless workload-identity path (K8s SA tokens etc.).
ClientAssertion string `form:"client_assertion" json:"client_assertion"`
ClientAssertionType string `form:"client_assertion_type" json:"client_assertion_type"`
// RFC 8693 token-exchange parameters. SubjectToken carries the authority
// being exercised (the user's token); ActorToken carries the actor (the
// agent's token) — its presence selects the delegation profile. The `resource`
// parameter (RFC 8707) is read separately via PostFormArray so a repeated
// value can be rejected.
SubjectToken string `form:"subject_token" json:"subject_token"`
SubjectTokenType string `form:"subject_token_type" json:"subject_token_type"`
ActorToken string `form:"actor_token" json:"actor_token"`
ActorTokenType string `form:"actor_token_type" json:"actor_token_type"`
// AuthReqID is the CIBA auth_req_id (OpenID CIBA Core 1.0 §10.1).
AuthReqID string `form:"auth_req_id" json:"auth_req_id"`
}
Source Files
¶
- app.go
- authorize.go
- ciba.go
- ciba_approve.go
- ciba_authorize.go
- ciba_token.go
- client_check.go
- client_redirect.go
- consent.go
- context.go
- cors.go
- csrf.go
- dashboard.go
- graphql.go
- health.go
- introspect.go
- jwks.go
- logger.go
- logout.go
- metrics.go
- oauth_account_state.go
- oauth_authorize_state.go
- oauth_callback.go
- oauth_login.go
- oauth_sso.go
- oauth_state.go
- oidc_provider_cache.go
- openid_config.go
- org_discovery.go
- org_group_roles.go
- playground.go
- protected_resource.go
- provider.go
- public_error.go
- rate_limit.go
- register_client.go
- revoke_refresh_token.go
- root.go
- saml_idp.go
- saml_sp.go
- security_headers.go
- session_lookup.go
- social_login_resume.go
- template_funcs.go
- token.go
- token_exchange.go
- userinfo.go
- verify_email.go