Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewJwtAuthorizer ¶
func NewJwtAuthorizer(e *casbin.Enforcer) gin.HandlerFunc
NewJwtAuthorizer returns the authorizer, uses a Casbin enforcer as input
Types ¶
type JwtAuthorizer ¶
type JwtAuthorizer struct {
// contains filtered or unexported fields
}
JwtAuthorizer stores the casbin handler
func (*JwtAuthorizer) CheckPermission ¶
func (a *JwtAuthorizer) CheckPermission(c *gin.Context) bool
CheckPermission checks the user/method/path combination from the request. Returns true (permission granted) or false (permission forbidden)
func (*JwtAuthorizer) GetUserName ¶
func (a *JwtAuthorizer) GetUserName(r *http.Request) string
GetUserName gets the user name from the request. Currently, only HTTP basic authentication is supported
func (*JwtAuthorizer) RequirePermission ¶
func (a *JwtAuthorizer) RequirePermission(c *gin.Context)
RequirePermission returns the 403 Forbidden to the client
Click to show internal directories.
Click to hide internal directories.