auth

package
v2.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 JwtIssuerFromRequestContext

func JwtIssuerFromRequestContext(c *gin.Context) (string, bool)

func LoginClientFromRequestContext

func LoginClientFromRequestContext(ctx *gin.Context) (string, bool)

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 RawTokenFromRequestContext

func RawTokenFromRequestContext(c *gin.Context) (string, bool)

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 SetJwtIssuerIntoRequestContext

func SetJwtIssuerIntoRequestContext(ctx *gin.Context, jwtIssuer string)

func SetLoginClientIntoRequestContext

func SetLoginClientIntoRequestContext(ctx *gin.Context, loginClient string)

func SetRawTokenIntoRequestContext

func SetRawTokenIntoRequestContext(ctx *gin.Context, rawToken string)

func SetRawTokenMiddleware

func SetRawTokenMiddleware(c *gin.Context)

func StaticJwtIssuerMiddleware

func StaticJwtIssuerMiddleware(jwtIssuer string) gin.HandlerFunc

func StaticLoginClientMiddleware

func StaticLoginClientMiddleware(loginClient string) gin.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL