http_handlers

package
v0.0.0-...-1726717 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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
	// OAuthProvider is used to register oauth providers
	OAuthProvider oauth.Provider
	// RateLimitProvider is used for per-IP rate limiting
	RateLimitProvider rate_limit.Provider
}

Dependencies for a graphql provider

type Provider

type Provider interface {
	// AppHandler is the main handler that handels all the app requests
	AppHandler() gin.HandlerFunc
	// AuthorizeHandler is the main handler that handels all the authorize requests
	AuthorizeHandler() gin.HandlerFunc
	// DashboardHandler is the main handler that handels all the dashboard requests
	DashboardHandler() gin.HandlerFunc
	// GraphqlHandler is the main handler that handels 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 handels all the jwks requests
	JWKsHandler() gin.HandlerFunc
	// LogoutHandler is the main handler that handels all the logout requests
	LogoutHandler() gin.HandlerFunc
	// OAuthCallbackHandler is the main handler that handels all the oauth callback requests
	OAuthCallbackHandler() gin.HandlerFunc
	// OAuthLoginHandler is the main handler that handels all the oauth login requests
	OAuthLoginHandler() gin.HandlerFunc
	// OpenIDConfigurationHandler is the main handler that handels all the openid configuration requests
	OpenIDConfigurationHandler() gin.HandlerFunc
	// PlaygroundHandler is the main handler that handels all the playground requests
	PlaygroundHandler() gin.HandlerFunc
	// RevokeRefreshTokenHandler is the main handler that handels all the revoke refresh token requests
	RevokeRefreshTokenHandler() gin.HandlerFunc
	// RootHandler is the main handler that handels all the root requests
	RootHandler() gin.HandlerFunc
	// TokenHandler is the main handler that handels all the token requests
	TokenHandler() gin.HandlerFunc
	// UserInfoHandler is the main handler that handels all the user info requests
	UserInfoHandler() gin.HandlerFunc
	// VerifyEmailHandler is the main handler that handels 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"`
}

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

Jump to

Keyboard shortcuts

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