-
Notifications
You must be signed in to change notification settings - Fork 155
Expose ID Token Claims on successful Authentication #294
Copy link
Copy link
Closed
Labels
EnhancementA request or suggestion to improve some aspect of the libraryA request or suggestion to improve some aspect of the library
Description
Some other implementations of MSAL (e.g. Python) make available the decoded ID Token claims for the user immediately upon receiving the token.
Currently, the Java implementation requires the user to import a JWT parsing library, such as this one from nimbusds:
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>9.0.1</version>
</dependency>And extract them as follows:
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.SignedJWT;
...
Future<IAuthenticationResult> future = client.acquireToken(authParams);
IAuthenticationResult result = future.get();
SignedJWT idToken = SignedJWT.parse(result.idToken());
JWTClaimsSet jcs = idToken.getJWTClaimsSet();
Map<String,Object> claimsObjectMap = jcs.getClaimsSet();
Map<String,String> claimsStringMap = new HashMap<>();
claimsObjectMap.forEach((String claim, Object value) -> {
String val = value.toString();
claimsStringMap.put(claim, val);
});We could implement this and expose the claims to the user as a non-breaking change in the library. MSAL4J already includes nimbusds dependency.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
EnhancementA request or suggestion to improve some aspect of the libraryA request or suggestion to improve some aspect of the library