Documentation
¶
Index ¶
- func Optional(v *verify.Verifier) gin.HandlerFunc
- func Principal(c *gin.Context) (authkit.Principal, bool)
- func RegisterAPI(r gin.IRouter, svc *authhttp.Service, options ...APIOption)
- func RegisterAll(r gin.IRouter, svc *authhttp.Service)
- func RegisterJWKS(r gin.IRouter, svc *authhttp.Service)
- func RegisterOIDC(r gin.IRouter, svc *authhttp.Service, mountPath string)
- func RegisterRoutes(r gin.IRouter, routes []authhttp.RouteSpec, ...)
- func RequirePermission(checker verify.PermissionChecker, perm string, ...) gin.HandlerFunc
- func Required(v *verify.Verifier) gin.HandlerFunc
- func Use(mw ...func(http.Handler) http.Handler) gin.HandlerFunc
- type APIOption
- type APIOptions
- type UserClaimsData
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 RegisterAll ¶ added in v0.80.0
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 RegisterRoutes ¶
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))
Types ¶
type APIOption ¶
type APIOption func(*APIOptions)
func WithGroups ¶ added in v0.72.0
func WithGroups(groups ...authhttp.RouteGroup) APIOption
func WithRouteWrapper ¶
func WithRoutes ¶
type APIOptions ¶
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)