authrules

package
v0.322.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsecureAlwaysGrantAccess

func InsecureAlwaysGrantAccess(ctx context.Context) (context.Context, error)

Types

type JWTClaimsBasedAuthorizationRule added in v0.108.0

type JWTClaimsBasedAuthorizationRule func(ctx context.Context, claims jwtauth.Claims) (bool, error)

ClaimsBasedAuthorizationRule decides if access is approved or denied based on the given claims. Returning true, nil indicates access is approved. Returning false, nil indicates access is denied. Returning *, err endicates an error occurred when evaluating the rule.

func MakeDefaultJWTClaimsBasedAuthorizationRule added in v0.108.0

func MakeDefaultJWTClaimsBasedAuthorizationRule(authorizationRuleExpression string) (JWTClaimsBasedAuthorizationRule, error)

type Rule

type Rule func(ctx context.Context) (context.Context, error)

Rule is an authorization rule that is is responsible for deciding if access to a resource should be allowed or denied. If a Rule returns a nil error, this indicates access is allowed. If a Rule returns a non-nil error, this indicates that either access is denied or some other error was encountered during Rule evaluation. If the Rule returns a nil error, it must return a non-nil Context. The returned Context may be the input ctx or a new Context derived from the input ctx, capturing additional values.

func MakeGRPCJWTAuthorizationRule added in v0.108.0

func MakeGRPCJWTAuthorizationRule(authRule JWTClaimsBasedAuthorizationRule, authenticator jwtauth.Authenticator) (Rule, error)

MakeGRPCAuthorizationRule creates an authorization Rule from a claims-based authorization Rule and a jwtauth Authenticator.

func MakeRESTJWTAuthorizationRule added in v0.109.0

func MakeRESTJWTAuthorizationRule(authRule JWTClaimsBasedAuthorizationRule, authenticator jwtauth.Authenticator) (Rule, error)

MakeRESTJWTAuthorizationRule creates an authorization Rule from a claims-based authorization Rule and a jwtauth Authenticator.

Jump to

Keyboard shortcuts

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