Documentation ¶
Index ¶
Constants ¶
View Source
const ( RoleClaim = "roles" SubClaim = "sub" )
View Source
const RequestID = "x-request-id"
Variables ¶
This section is empty.
Functions ¶
func JWTMiddlewareExtract ¶
func JWTMiddlewareExtract() gin.HandlerFunc
JWTExtract Extracts the JWT from the header and place the role claim and the sub claim as part of the context to be used latter.
func RBACMiddleware ¶
func RBACMiddleware(allowedRoles ...string) gin.HandlerFunc
RBACMiddleware Validates if a given token has the needed permissions to continue the request. It accepts a list of allowed roles for that endpoint. If the user don't own the resource the role will determine if the user can access it or not. The path must have an owner parameter.
func RequestIDMiddleware ¶
func RequestIDMiddleware() gin.HandlerFunc
RequestIDMiddleware provides an ID to the request for traceback purposes.
func ResponseIDMiddleware ¶
func ResponseIDMiddleware() gin.HandlerFunc
ResponseMiddleware sets the header with the request header.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.