Skip to content

Commit

Permalink
added function for jwt claim interface get
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-579 committed Dec 26, 2023
1 parent 718e6d0 commit b6affe4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jwt/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func GetField(claims jwt.MapClaims, fieldName string) string {
return ""
}

// GetFieldInterface extracts a field from the claims as an interface
func GetFieldInterface(claims jwt.MapClaims, fieldName string) interface{} {
return claims[fieldName]
}

// GetScopeValues extracts the values of specified scopes from the claims
func GetScopeValues(claims jwt.MapClaims, scopes []string) []string {
groups := make([]string, 0)
Expand Down

0 comments on commit b6affe4

Please sign in to comment.