http_handlers

package
v0.0.0-...-cdbd839 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 79 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TemplateFuncMap

func TemplateFuncMap() template.FuncMap

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.

func New

func New(cfg *config.Config, deps *Dependencies) (Provider, error)

New constructs a new http provider with given arguments

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"`
}

type State

type State struct {
	AuthorizerURL string `json:"authorizerURL"`
	RedirectURL   string `json:"redirectURL"`
}

State is the struct that holds authorizer url and redirect url They are provided via query string in the request

Directories

Path Synopsis
Package scim exposes the per-organization inbound SCIM 2.0 HTTP surface (RFC 7644) at /scim/v2/.
Package scim exposes the per-organization inbound SCIM 2.0 HTTP surface (RFC 7644) at /scim/v2/.

Jump to

Keyboard shortcuts

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