Skip to content

Commit

Permalink
Merge pull request #133 from krakend/support_non_http_jwt
Browse files Browse the repository at this point in the history
Support non HTTP JWT validation
  • Loading branch information
kpacha authored Jun 19, 2024
2 parents 4329232 + 71de8c7 commit 6099726
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jose.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ var supportedAlgorithms = map[string]jose.SignatureAlgorithm{
"PS512": jose.PS512,
}

func SupportedAlgorithm(s string) (jose.SignatureAlgorithm, bool) {
a, ok := supportedAlgorithms[s]
return a, ok
}

func convertToStringSlice(input []interface{}) []string {
result := make([]string, len(input))

Expand Down
4 changes: 4 additions & 0 deletions jwk_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ func (j *JWKClient) GetSecret(r *http.Request) (interface{}, error) {
if err != nil {
return nil, err
}
return j.SecretFromToken(token)
}

// SecretFromToken implements the GetSecret method of the SecretProvider interface.
func (j *JWKClient) SecretFromToken(token *jwt.JSONWebToken) (interface{}, error) {
if len(token.Headers) < 1 {
return nil, auth0.ErrNoJWTHeaders
}
Expand Down

0 comments on commit 6099726

Please sign in to comment.