Get groups from the JWT tokens if it feature enabled for account

This commit is contained in:
Givi Khojanashvili
2023-06-19 10:03:34 +04:00
parent 042f124702
commit e41072e2fc
8 changed files with 172 additions and 4 deletions
+3 -1
View File
@@ -73,7 +73,9 @@ func NewClaimsExtractor(options ...ClaimsExtractorOption) *ClaimsExtractor {
// FromToken extracts claims from the token (after auth)
func (c *ClaimsExtractor) FromToken(token *jwt.Token) AuthorizationClaims {
claims := token.Claims.(jwt.MapClaims)
jwtClaims := AuthorizationClaims{}
jwtClaims := AuthorizationClaims{
Raw: claims,
}
userID, ok := claims[c.userIDClaim].(string)
if !ok {
return jwtClaims