Documentation
¶
Overview ¶
Package authentication uses Casbin(https://github.com/casbin/casbin) to load auth rules from database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
type Authentication interface { AddPolicies(rules [][]string) (bool, error) AddPoliciesEx(rules [][]string) (bool, error) AddPolicy(params ...any) (bool, error) RemovePolicy(params ...any) (bool, error) RemovePolicies(rules [][]string) (bool, error) GetFilteredPolicy(fieldIndex int, fieldValues ...string) [][]string GetCasbinEnforcer() *casbin.Enforcer }
func NewAuthentication ¶
func NewAuthentication(rep repository.Repository) (Authentication, error)
NewAuthentication is constructor for authentication
type CasbinRule ¶
type CasbinRule struct { ID uint `gorm:"primaryKey;autoIncrement"` Ptype string `gorm:"size:16"` V0 string `gorm:"size:128;comment:'role keyword'"` V1 string `gorm:"size:128;comment:'request path'"` V2 string `gorm:"size:256;comment:'request method'"` V3 string `gorm:"size:100"` V4 string `gorm:"size:100"` V5 string `gorm:"size:100"` }
CasbinRule represents casbin rules
Click to show internal directories.
Click to hide internal directories.