Documentation
¶
Index ¶
- func ClientIDFromContext(ctx context.Context) (string, bool)
- func ContextWithClaims(ctx context.Context, claims RequestClaims) context.Context
- func ContextWithClientID(ctx context.Context, clientID string) context.Context
- func GroupsFromContext(ctx context.Context) ([]string, bool)
- func SubjectFromContext(ctx context.Context) (string, bool)
- type ProviderConfig
- type RequestClaims
- type RoleProvider
- type RoleProviderFactory
- type RoleRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientIDFromContext ¶ added in v0.17.0
ClientIDFromContext returns the configured client ID claim resolved for the request, if present.
func ContextWithClaims ¶ added in v0.17.0
func ContextWithClaims(ctx context.Context, claims RequestClaims) context.Context
ContextWithClaims returns a child context carrying configured authorization claims resolved for a request.
func ContextWithClientID ¶ added in v0.17.0
ContextWithClientID returns a child context carrying the request client ID resolved from configured authentication claims.
func GroupsFromContext ¶ added in v0.17.0
GroupsFromContext returns the request groups resolved from configured authorization claims, if present.
Types ¶
type ProviderConfig ¶
type ProviderConfig struct {
Config map[string]any
UsernameClaim string
GroupsClaim string
ClientIDClaim string
}
ProviderConfig carries provider-specific configuration and claim selectors.
type RequestClaims ¶ added in v0.17.0
RequestClaims contains configured authorization claims resolved for a request.
func ClaimsFromContext ¶ added in v0.17.0
func ClaimsFromContext(ctx context.Context) (RequestClaims, bool)
ClaimsFromContext returns configured authorization claims resolved for a request, if present.
type RoleProvider ¶
type RoleProvider interface {
Roles(ctx context.Context, token jwt.Token, req RoleRequest) ([]string, error)
}
RoleProvider returns role/group identifiers used as Casbin subjects.
type RoleProviderFactory ¶
type RoleProviderFactory func(ctx context.Context, cfg ProviderConfig) (RoleProvider, error)
RoleProviderFactory constructs a RoleProvider at startup.
type RoleRequest ¶
RoleRequest provides request context to role providers.