Skip to content

Commit 8cf8a4b

Browse files
authored
- add function to get jwtclaim value directly(Azure#17166)
Add function to get jwtclaim value directly
1 parent 1b0f502 commit 8cf8a4b

File tree

1 file changed

+8
-0
lines changed
  • sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad

1 file changed

+8
-0
lines changed

sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/UserPrincipal.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,13 @@ public Map<String, Object> getClaims() {
100100
public Object getClaim(String name) {
101101
return jwtClaimsSet == null ? null : jwtClaimsSet.getClaim(name);
102102
}
103+
104+
public String getName() {
105+
return jwtClaimsSet == null ? null : (String) jwtClaimsSet.getClaim("name");
106+
}
107+
108+
public String getUserPrincipalName() {
109+
return jwtClaimsSet == null ? null : (String) jwtClaimsSet.getClaim("preferred_username");
110+
}
103111
}
104112

0 commit comments

Comments
 (0)