Documentation
¶
Index ¶
Constants ¶
View Source
const ( ActionCreate = Action("create") ActionRead = Action("read") ActionUpdate = Action("update") ActionDelete = Action("delete") )
actions to authorize
Variables ¶
View Source
var ErrorNotAuthorized = fmt.Errorf("not authorized")
ErrorNotAuthorized indicates 403 Forbidden HTTP status code
Functions ¶
Types ¶
type Auth ¶
type Auth interface { Issuer(*jwt.StandardClaims) Issuer Permission(space string) Permission TokenValidationMiddleware() func(next http.Handler) http.Handler }
Auth is interface containing methods to authenticate and authorize users
func LoadConfiguration ¶
LoadConfiguration loads current TenantAuth configuration
type Permission ¶
type Permission interface { Check(claims *jwt.StandardClaims, action Action, objectValues ...string) error WithContext(ctx context.Context) Permission }
Permission interface contains methods to check authorization
type TenantAuth ¶
type TenantAuth struct { Tenants map[string]*tenant `toml:"authn"` Permissions map[string]*permission `toml:"authz"` }
TenantAuth implements Auth interface using tenants
func (*TenantAuth) Issuer ¶
func (auth *TenantAuth) Issuer(claims *jwt.StandardClaims) Issuer
Issuer instance
func (*TenantAuth) Permission ¶
func (auth *TenantAuth) Permission(space string) Permission
Permission instance
func (*TenantAuth) TokenValidationMiddleware ¶
func (auth *TenantAuth) TokenValidationMiddleware() func(next http.Handler) http.Handler
TokenValidationMiddleware returns middleware for validating JWT
Click to show internal directories.
Click to hide internal directories.