authkitgin

package
v0.80.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Optional added in v0.78.0

func Optional(v *verify.Verifier) gin.HandlerFunc

Optional is the gin-native form of verify.Optional (#209): parses and stores claims when a valid Bearer token is present, and passes through anonymously otherwise. See Required for usage.

func Principal added in v0.72.0

func Principal(c *gin.Context) (authkit.Principal, bool)

func RegisterAPI

func RegisterAPI(r gin.IRouter, svc *authhttp.Service, options ...APIOption)

func RegisterAll added in v0.80.0

func RegisterAll(r gin.IRouter, svc *authhttp.Service)

RegisterAll mounts the full AuthKit surface in one call (#211): JWKS at /.well-known/jwks.json, the browser OIDC flows under /oidc (plus the bare /oidc→/oidc/ redirect every host hand-wrote), and the default API route set (including the generated permission-group routes) at the router root.

func RegisterJWKS

func RegisterJWKS(r gin.IRouter, svc *authhttp.Service)

func RegisterOIDC

func RegisterOIDC(r gin.IRouter, svc *authhttp.Service, mountPath string)

func RegisterRoutes

func RegisterRoutes(r gin.IRouter, routes []authhttp.RouteSpec, wrap func(authhttp.RouteSpec, http.Handler) http.Handler)

func RequirePermission added in v0.72.0

func RequirePermission(checker verify.PermissionChecker, perm string, resolve func(*gin.Context) verify.PermissionScope) gin.HandlerFunc

func Required added in v0.78.0

func Required(v *verify.Verifier) gin.HandlerFunc

Required is the gin-native form of verify.Required (#209): validates the Bearer token and stores claims in the request context, aborting with the verifier's 401 on failure. Use it directly on gin routes/groups instead of hand-writing an http.Handler↔gin.HandlerFunc shim:

api := r.Group("/api", authkitgin.Required(verifier))

func Use added in v0.72.0

func Use(mw ...func(http.Handler) http.Handler) gin.HandlerFunc

Types

type APIOption

type APIOption func(*APIOptions)

func WithGroups added in v0.72.0

func WithGroups(groups ...authhttp.RouteGroup) APIOption

func WithRouteWrapper

func WithRouteWrapper(wrap func(authhttp.RouteSpec, http.Handler) http.Handler) APIOption

func WithRoutes

func WithRoutes(routes []authhttp.RouteSpec) APIOption

type APIOptions

type APIOptions struct {
	Routes []authhttp.RouteSpec
	Groups []authhttp.RouteGroup
	Wrap   func(authhttp.RouteSpec, http.Handler) http.Handler
	// contains filtered or unexported fields
}

type UserClaimsData added in v0.72.0

type UserClaimsData struct {
	UserID        string
	Email         string
	EmailVerified bool
	Username      string
	SessionID     string
	Entitlements  []string
	AMR           []string
	ACR           string
	AuthTime      time.Time
	MFAEnrolled   bool
}

func UserClaims added in v0.72.0

func UserClaims(c *gin.Context) (UserClaimsData, bool)

Jump to

Keyboard shortcuts

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