Documentation ¶
Index ¶
- Constants
- Variables
- func NewAuthz(config ...Config) openapi.StrictMiddlewareFunc
- func NewChecker(c *client.OpenFgaClient) *fgaImpl
- func NewNoop() *noopImpl
- func NoopResolvers() map[string]AuthzResolverFunc
- type AuthzResolverFunc
- type Checker
- type Config
- type Object
- type Relation
- type ResolverMap
- type User
Constants ¶
View Source
const ( NoopUser User = "" NoopRelation Relation = "" NoopObject Object = "" )
Variables ¶
View Source
var DefaultConfig = Config{ Checker: NewNoop(), Resolvers: NoopResolvers(), DefaultError: fiber.ErrForbidden, }
DefaultConfig contains the default configuration.
Functions ¶
func NewAuthz ¶
func NewAuthz(config ...Config) openapi.StrictMiddlewareFunc
NewAuthz returns a new authz middleware. nolint:contextcheck
func NewChecker ¶
func NewChecker(c *client.OpenFgaClient) *fgaImpl
NewChecker returns a new FGA authz checker.
func NoopResolvers ¶
func NoopResolvers() map[string]AuthzResolverFunc
NoopResolvers is a map of Noop resolvers.
Types ¶
type AuthzResolverFunc ¶
AuthzResolverFunc is a function to resolve the authz values.
func NoopResolver ¶
func NoopResolver() AuthzResolverFunc
NoopResolver is a resolver that always returns Noop values.
type Checker ¶
type Checker interface {
Allowed(ctx context.Context, user User, relation Relation, object Object) (bool, error)
}
Checker is the interface for the FGA authz checker.
type Config ¶
type Config struct { // Next defines a function to skip the current middleware. Next func(c *fiber.Ctx) bool // Checker defines a function to check the authorization. Checker Checker // Resolvers defines the resolvers for a specific operation. Resolvers ResolverMap // DefaultError defines the default error. DefaultError error }
Config ...
Click to show internal directories.
Click to hide internal directories.