authrules

package
v0.104.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: Apache-2.0 Imports: 5 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 JWTClaimsBasedAuthorisationRule

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

ClaimsBasedAuthorisationRule 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 MakeDefaultJWTClaimsBasedAuthorisationRule

func MakeDefaultJWTClaimsBasedAuthorisationRule(authorisationRuleExpression string) (JWTClaimsBasedAuthorisationRule, error)

type Rule

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

Rule is an authorisation 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 MakeGRPCJWTAuthorisationRule

func MakeGRPCJWTAuthorisationRule(authRule JWTClaimsBasedAuthorisationRule, authenticator jwtauth.Authenticator) (Rule, error)

MakeGRPCAuthorisationRule creates an authorisation Rule from a claims-based authorisation Rule and a jwtauth Authenticator.

Jump to

Keyboard shortcuts

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