middleware

package
v0.0.0-...-8c66a01 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CasbinModel string = `` /* 235-byte string literal not displayed */

CasbinModel casbin model in string

Variables

View Source
var CasbinEnforcer *casbin.Enforcer

CasbinEnforcer global casbin instance

Functions

func CasbinMiddleware

func CasbinMiddleware() gin.HandlerFunc

CasbinMiddleware Casbin middleware, load authorize policy and enforce authorize check

func HandleOAuth2Callback

func HandleOAuth2Callback(c *gin.Context)

func InitCasbin

func InitCasbin() *casbin.Enforcer

InitCasbin init casbin instance

func InitOidc

func InitOidc(providerUrl string, clientID string, clientSecret string, redirectURL string, ctx context.Context)

func OidcMiddleware

func OidcMiddleware(provider string, clientID string, clientSecret string, redirectURL string) gin.HandlerFunc

func SetUserToSession

func SetUserToSession(c *gin.Context, user *User) bool

Types

type User

type User struct {
	UserID   string `json:"sub"`
	Email    string `json:"email"`
	Username string `json:"preferred_username"`
}

func GetUserBySession

func GetUserBySession(c *gin.Context) *User

Jump to

Keyboard shortcuts

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