authz

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: BSD-3-Clause-Clear Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIDFromContext added in v0.17.0

func ClientIDFromContext(ctx context.Context) (string, bool)

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

func ContextWithClientID(ctx context.Context, clientID string) context.Context

ContextWithClientID returns a child context carrying the request client ID resolved from configured authentication claims.

func GroupsFromContext added in v0.17.0

func GroupsFromContext(ctx context.Context) ([]string, bool)

GroupsFromContext returns the request groups resolved from configured authorization claims, if present.

func SubjectFromContext added in v0.17.0

func SubjectFromContext(ctx context.Context) (string, bool)

SubjectFromContext returns the configured subject claim resolved for the request, 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

type RequestClaims struct {
	Subject  string
	Groups   []string
	ClientID string
}

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

type RoleRequest struct {
	Issuer   string
	Resource string
	Action   string
}

RoleRequest provides request context to role providers.

Jump to

Keyboard shortcuts

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