Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
FEAT: Adding new method to return data
Browse files Browse the repository at this point in the history
  • Loading branch information
fmattioli committed Jul 21, 2024
1 parent e1a7d29 commit 8f2d1fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ public string GetTenantFromToken()
return tenantClaim;
}

public Guid GetUserFromToken()
public string GetInfoFromToken(string infoName)
{
string jwtToken = GetToken();
var tokenInfos = _tokenHandler.ReadJwtToken(jwtToken);
var userClaim = tokenInfos.Claims.FirstOrDefault(c => c.Type == infoName)?.Value!;
return userClaim;
}

public Guid GetUserIdFromToken()
{
string jwtToken = GetToken();
var tokenInfos = _tokenHandler.ReadJwtToken(jwtToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public interface IAuthService
string GetClientSecret();
string GetServerUrl();
Realm GetRealm(string realmName);
Guid GetUserFromToken();
Guid GetUserIdFromToken();
}
}

0 comments on commit 8f2d1fc

Please sign in to comment.