Documentation ¶
Index ¶
Constants ¶
const ( ScopeAll string = "all" ScopeGlobal string = "all:all:all" )
Variables ¶
This section is empty.
Functions ¶
func CheckScopesGlobals ¶
CheckScopesGlobals checks if the global or service global scope exists in the list of scope strings
func ScopeServiceGlobal ¶
ScopeServiceGlobal returns the global scope
Types ¶
type Authorization ¶
type Authorization interface { Any(values []string, object string, action string) error All(values []string, object string, action string) error }
Authorization is a standard authorization interface that can be reused by various auth types.
type CasbinAuthorization ¶
type CasbinAuthorization struct {
// contains filtered or unexported fields
}
CasbinAuthorization is a Casbin implementation of the authorization interface.
func NewCasbinAuthorization ¶
func NewCasbinAuthorization(modelPath string, policyPath string) *CasbinAuthorization
NewCasbinAuthorization returns a new Casbin enforcer
func NewCasbinStringAuthorization ¶
func NewCasbinStringAuthorization(policyPath string) *CasbinAuthorization
NewCasbinStringAuthorization returns a new Casbin enforcer with the string model
type CasbinScopeAuthorization ¶
type CasbinScopeAuthorization struct {
// contains filtered or unexported fields
}
CasbinScopeAuthorization is a Casbin implementation of the authorization interface for scope values.
func NewCasbinScopeAuthorization ¶
func NewCasbinScopeAuthorization(policyPath string, serviceID string) *CasbinScopeAuthorization
NewCasbinScopeAuthorization returns a new casbin enforcer
type Scope ¶
type Scope struct { ServiceID string `json:"service_id" bson:"service_id"` Resource string `json:"resource" bson:"resource"` Operation string `json:"operation" bson:"operation"` }
-------------------------- Scope -------------------------- Scope represents a scope entity
func ScopeFromString ¶
ScopeFromString creates a scope object from the string representation
func (*Scope) IsServiceGlobal ¶
IsServiceGlobal returns true if the scope is the service-level global scope