1 Star 0 Fork 0

bolo-tourism / go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
jwt.go 948 Bytes
一键复制 编辑 原始数据 按行查看 历史
kevin 提交于 2023-05-08 16:50 . 初始化16:50
// Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package auth
import (
ginjwt "github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
"gitee.com/bolo-tourism/go/internal/pkg/middleware"
)
// AuthzAudience defines the value of jwt audience field.
const AuthzAudience = "iam.authz.marmotedu.com"
// JWTStrategy defines jwt bearer authentication strategy.
type JWTStrategy struct {
ginjwt.GinJWTMiddleware
}
var _ middleware.AuthStrategy = &JWTStrategy{}
// NewJWTStrategy create jwt bearer strategy with GinJWTMiddleware.
func NewJWTStrategy(gjwt ginjwt.GinJWTMiddleware) JWTStrategy {
return JWTStrategy{gjwt}
}
// AuthFunc defines jwt bearer strategy as the gin authentication middleware.
func (j JWTStrategy) AuthFunc() gin.HandlerFunc {
return j.MiddlewareFunc()
}
Go
1
https://gitee.com/bolo-tourism/go.git
git@gitee.com:bolo-tourism/go.git
bolo-tourism
go
go
772bc38bfa1d

搜索帮助