Skip to content

Commit

Permalink
chore: add authz controller
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Jun 27, 2024
1 parent 4bc8c8f commit e642428
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ctrl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package authz

import "github.com/gofiber/fiber/v2"

// AuthzController is the controller that holds the authz checker.
type AuthzController interface {
// Resolve is the resolver.
Resolve(ctx *fiber.Ctx) (AuthzPrincipal, AuthzObject, AuthzAction, error)
}

var _ AuthzController = (*DefaultAuthzController)(nil)

// DefaultAuthzController is the default implementation of the AuthzController.
type DefaultAuthzController struct{}

// NewDefaultAuthzController returns a new DefaultAuthzController.
func NewDefaultAuthzController() *DefaultAuthzController {
return &DefaultAuthzController{}
}

// ResolvePrincipal is the principal resolver.
func (d *DefaultAuthzController) Resolve(ctx *fiber.Ctx) (AuthzPrincipal, AuthzObject, AuthzAction, error) {
return AuthzNoPrincipial, AuthzNoObject, AuthzNoAction, nil
}

0 comments on commit e642428

Please sign in to comment.