fix: need to subclass StandardClaims to make Issuer any
This commit is contained in:
parent
608cfad501
commit
1c1f78559d
|
@ -25,6 +25,11 @@ const WEBHOOK_CONTEXT_KEY = "webhook"
|
||||||
|
|
||||||
const AuthCookieName = "auth-token"
|
const AuthCookieName = "auth-token"
|
||||||
|
|
||||||
|
type standardClaims struct {
|
||||||
|
Issuer any `json:"iss,omitempty"`
|
||||||
|
jwt.StandardClaims
|
||||||
|
}
|
||||||
|
|
||||||
func findAuthToken(r *http.Request) string {
|
func findAuthToken(r *http.Request) string {
|
||||||
authHeader := parseAuthTokenHeader(r.Header)
|
authHeader := parseAuthTokenHeader(r.Header)
|
||||||
|
|
||||||
|
@ -129,7 +134,7 @@ func githubRestVerifyMiddleware(db *gorm.DB) mux.MiddlewareFunc {
|
||||||
|
|
||||||
publicKey := &privateKey.PublicKey
|
publicKey := &privateKey.PublicKey
|
||||||
|
|
||||||
parseToken, err = jwt.ParseWithClaims(token, &jwt.StandardClaims{}, func(token *jwt.Token) (interface{}, error) {
|
parseToken, err = jwt.ParseWithClaims(token, &standardClaims{}, func(token *jwt.Token) (interface{}, error) {
|
||||||
if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok {
|
if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok {
|
||||||
return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
|
return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue