Class UserPrincipal
- java.lang.Object
-
- com.azure.spring.cloud.autoconfigure.aad.filter.UserPrincipal
-
- All Implemented Interfaces:
Serializable
public class UserPrincipal extends Object implements Serializable
entity class of UserPrincipal- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UserPrincipal(String aadIssuedBearerToken, com.nimbusds.jose.JWSObject jwsObject, com.nimbusds.jwt.JWTClaimsSet jwtClaimsSet)Creates a new instance ofUserPrincipal.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAadIssuedBearerToken()Gets the AAD issued bearer token.StringgetAccessTokenForGraphApi()Gets the access token for Graph API.ObjectgetClaim(String name)Gets a claim.Map<String,Object>getClaims()Gets the claims.Set<String>getGroups()Gets the set of groups.StringgetIssuer()Gets the issuer.StringgetKeyId()Gets the KID.StringgetName()Gets the name.Set<String>getRoles()Gets the set of roles.StringgetSubject()Gets the subject.StringgetTenantId()gets the tenant ID.StringgetUserPrincipalName()Gets the user principal name.booleanisMemberOf(AadAuthenticationProperties aadAuthenticationProperties, String group)Whether the group is a member of the user principal.booleanisPersonalAccount()Whether the user principal is a personal account.voidsetAccessTokenForGraphApi(String accessTokenForGraphApi)Sets the access token for Graph API.voidsetGroups(Set<String> groups)Sets the set of groups.voidsetRoles(Set<String> roles)Sets the set of roles.
-
-
-
Constructor Detail
-
UserPrincipal
public UserPrincipal(String aadIssuedBearerToken, com.nimbusds.jose.JWSObject jwsObject, com.nimbusds.jwt.JWTClaimsSet jwtClaimsSet)
Creates a new instance ofUserPrincipal.- Parameters:
aadIssuedBearerToken- the AAD issued bearer tokenjwsObject- the JWS objectjwtClaimsSet- the JWT claims set
-
-
Method Detail
-
getAadIssuedBearerToken
public String getAadIssuedBearerToken()
Gets the AAD issued bearer token.- Returns:
- the AAD issued bearer token
-
setGroups
public void setGroups(Set<String> groups)
Sets the set of groups.- Parameters:
groups- the set of groups
-
setRoles
public void setRoles(Set<String> roles)
Sets the set of roles.- Parameters:
roles- the set of roles
-
getAccessTokenForGraphApi
public String getAccessTokenForGraphApi()
Gets the access token for Graph API.- Returns:
- the access token for Graph API
-
setAccessTokenForGraphApi
public void setAccessTokenForGraphApi(String accessTokenForGraphApi)
Sets the access token for Graph API.- Parameters:
accessTokenForGraphApi- the access token for Graph API
-
isMemberOf
public boolean isMemberOf(AadAuthenticationProperties aadAuthenticationProperties, String group)
Whether the group is a member of the user principal.- Parameters:
aadAuthenticationProperties- the AAD authentication propertiesgroup- the group- Returns:
- whether the group is a member of the user principal
-
getKeyId
public String getKeyId()
Gets the KID.- Returns:
- the KID
-
getIssuer
public String getIssuer()
Gets the issuer.- Returns:
- the issuer
-
getSubject
public String getSubject()
Gets the subject.- Returns:
- the subject
-
getClaim
public Object getClaim(String name)
Gets a claim.- Parameters:
name- the claim name- Returns:
- a claim
-
getName
public String getName()
Gets the name.- Returns:
- the name
-
getTenantId
public String getTenantId()
gets the tenant ID.- Returns:
- the tenant ID
-
getUserPrincipalName
public String getUserPrincipalName()
Gets the user principal name.- Returns:
- the user principal name
-
isPersonalAccount
public boolean isPersonalAccount()
Whether the user principal is a personal account.- Returns:
- whether the user principal is a personal account
-
-