Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Definitions = []di.Def{ { Build: func(ctn di.Container) (interface{}, error) { accessControl := ctn.Get("focus.accessControl").(*AccessControl) newAction := ctn.Get("focus.access.createActionRule").(CreateActionRule) return NewAccessMiddleware(accessControl, newAction), nil }, Name: "focus.accessMiddleware", }, { Build: func(ctn di.Container) (interface{}, error) { jwtRSACert := ctn.Get("focus.access.jwtRSACert").(string) rsaPub, err := jwt.ParseRSAPublicKeyFromPEM([]byte(jwtRSACert)) if err != nil { return nil, err } return NewAccessControl(rsaPub), nil }, Name: "focus.accessControl", }, { Build: func(ctn di.Container) (interface{}, error) { rolesFile := ctn.Get("focus.access.rolesFile").(string) return RolesFromFile(rolesFile), nil }, Name: "focus.access.roles", }, }
Functions ¶
This section is empty.
Types ¶
type AccessClaims ¶
type AccessControl ¶
type AccessControl struct {
// contains filtered or unexported fields
}
func NewAccessControl ¶
func NewAccessControl(jwtRSACert *rsa.PublicKey) *AccessControl
func (AccessControl) CheckAccess ¶
func (s AccessControl) CheckAccess(tokenString string, action *Action) error
CheckAccess проверяет доступ пользователя к определенному действию
func (AccessControl) GetClaims ¶
func (s AccessControl) GetClaims(tokenString string) (*AccessClaims, error)
type AccessMiddleware ¶
type AccessMiddleware struct {
// contains filtered or unexported fields
}
func NewAccessMiddleware ¶
func NewAccessMiddleware(accessControl *AccessControl, newAction CreateActionRule) *AccessMiddleware
func (AccessMiddleware) CheckAccess ¶
func (m AccessMiddleware) CheckAccess(c *gin.Context)
type CreateActionRule ¶
type Privilege ¶
type Privilege struct {
// contains filtered or unexported fields
}
func NewPrivilege ¶
type Privileges ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.