Class AzureADGraphClient


  • public class AzureADGraphClient
    extends Object
    Microsoft Graph client encapsulation.
    • Method Detail

      • getGroups

        public Set<String> getGroups​(String graphApiToken)
                              throws IOException
        Parameters:
        graphApiToken - token used to access graph api.
        Returns:
        groups in graph api.
        Throws:
        IOException - throw exception if get groups failed by IOException.
      • toGrantedAuthoritySet

        public Set<org.springframework.security.core.authority.SimpleGrantedAuthority> toGrantedAuthoritySet​(Set<String> groups)
        Converts a set of groups to their granted authority set.
        Parameters:
        groups - a set of groups
        Returns:
        the granted authority set
      • acquireTokenForGraphApi

        public com.microsoft.aad.msal4j.IAuthenticationResult acquireTokenForGraphApi​(String idToken,
                                                                                      String tenantId)
                                                                               throws ServiceUnavailableException
        Acquire access token for calling Graph API.
        Parameters:
        idToken - The token used to perform an OBO request.
        tenantId - The tenant id.
        Returns:
        The access token for Graph service.
        Throws:
        ServiceUnavailableException - If fail to acquire the token.
        com.microsoft.aad.msal4j.MsalServiceException - If MsalServiceException has occurred.