Documentation ¶
Index ¶
- Variables
- func CheckRolesFromLoginClientMiddleware(loginClient string, roleCheckingHandlerFunc auth.RoleCheckingHandlerFunc) gin.HandlerFunc
- func CheckRolesMiddleware(roleCheckingHandlerFunc auth.RoleCheckingHandlerFunc) gin.HandlerFunc
- func CustomSetRawTokenMiddleware(extractor HeaderExtractor) gin.HandlerFunc
- func DefaultHeaderExtraction(c *gin.Context) (string, error)
- func JwtIssuerFromRequestContext(c *gin.Context) (string, bool)
- func LoginClientFromRequestContext(ctx *gin.Context) (string, bool)
- func PerformRoleChecking(gCtx *gin.Context, loginClient string, ...)
- func RawTokenFromRequestContext(c *gin.Context) (string, bool)
- func RequireRolesFromLoginClientMiddleware(loginClient string, roles ...string) gin.HandlerFunc
- func RequireRolesMiddleware(roles ...string) gin.HandlerFunc
- func SetJwtIssuerIntoRequestContext(ctx *gin.Context, jwtIssuer string)
- func SetLoginClientIntoRequestContext(ctx *gin.Context, loginClient string)
- func SetRawTokenIntoRequestContext(ctx *gin.Context, rawToken string)
- func StaticJwtIssuerMiddleware(jwtIssuer string) gin.HandlerFunc
- func StaticLoginClientMiddleware(loginClient string) gin.HandlerFunc
- type HeaderExtractor
Constants ¶
This section is empty.
Variables ¶
var SetRawTokenMiddleware = CustomSetRawTokenMiddleware(DefaultHeaderExtraction)
Functions ¶
func CheckRolesFromLoginClientMiddleware ¶
func CheckRolesFromLoginClientMiddleware(loginClient string, roleCheckingHandlerFunc auth.RoleCheckingHandlerFunc) gin.HandlerFunc
CheckRolesFromLoginClientMiddleware takes the <raw token> and the <jwt issuer> from the current ginContext and uses the given handler <roleCheckingHandlerFunc> Any error returned from <roleCheckingHandlerFunc> will result in a rejected request It requires SetRawTokenIntoRequestContext and SetJwtIssuerIntoRequestContext to be called before its usage the target login client will be taken from <loginClient>
func CheckRolesMiddleware ¶
func CheckRolesMiddleware(roleCheckingHandlerFunc auth.RoleCheckingHandlerFunc) gin.HandlerFunc
CheckRolesMiddleware takes all needed information from the current ginContext and uses the given handler <roleCheckingHandlerFunc> Any error returned from <roleCheckingHandlerFunc> will result in a rejected request It requires SetRawTokenIntoRequestContext, SetJwtIssuerIntoRequestContext and SetLoginClientIntoRequestContext to be called before its usage
func CustomSetRawTokenMiddleware ¶ added in v2.16.0
func CustomSetRawTokenMiddleware(extractor HeaderExtractor) gin.HandlerFunc
func DefaultHeaderExtraction ¶ added in v2.16.0
func PerformRoleChecking ¶
func PerformRoleChecking(gCtx *gin.Context, loginClient string, roleCheckingHandlerFunc auth.RoleCheckingHandlerFunc)
PerformRoleChecking takes the <raw token> and the <jwt issuer> from the current ginContext and uses the given handler <roleCheckingHandlerFunc> It requires SetRawTokenIntoRequestContext and SetJwtIssuerIntoRequestContext to be called before its usage the target login client will be taken from <loginClient>
func RequireRolesFromLoginClientMiddleware ¶
func RequireRolesFromLoginClientMiddleware(loginClient string, roles ...string) gin.HandlerFunc
RequireRolesFromLoginClientMiddleware takes the <raw token> and the <jwt issuer> from the current ginContext and checks the existence of the required roles It requires SetRawTokenIntoRequestContext and SetJwtIssuerIntoRequestContext to be called before its usage the target login client will be taken from <loginClient>
func RequireRolesMiddleware ¶
func RequireRolesMiddleware(roles ...string) gin.HandlerFunc
RequireRolesMiddleware takes all needed information from the current ginContext and checks the existence of the required roles within the current loginClient (taken from LoginClientFromRequestContext) It requires SetRawTokenIntoRequestContext, SetJwtIssuerIntoRequestContext and SetLoginClientIntoRequestContext to be called before its usage
func StaticJwtIssuerMiddleware ¶
func StaticJwtIssuerMiddleware(jwtIssuer string) gin.HandlerFunc
func StaticLoginClientMiddleware ¶
func StaticLoginClientMiddleware(loginClient string) gin.HandlerFunc