Search in sources :

Example 6 with GraphServiceException

use of com.microsoft.graph.http.GraphServiceException in project opencga by opencb.

the class AzureADAuthenticationManager method getRemoteUserInformation.

@Override
public List<User> getRemoteUserInformation(List<String> userStringList) throws CatalogException {
    List<com.microsoft.graph.models.extensions.User> graphUserList = new ArrayList<>(userStringList.size());
    for (String userId : userStringList) {
        com.microsoft.graph.models.extensions.User graphUser;
        try {
            graphUser = graphServiceClient.users(userId).buildRequest().get();
        } catch (GraphServiceException e) {
            logger.error("User '{}' not found", userId);
            throw new CatalogException("User '" + userId + "' not found");
        } catch (ClientException e) {
            logger.error("Graph query could not be performed: {}", e.getMessage());
            throw e;
        }
        graphUserList.add(graphUser);
    }
    return extractUserInformation(graphUserList);
}
Also used : GraphServiceException(com.microsoft.graph.http.GraphServiceException) CatalogException(org.opencb.opencga.catalog.exceptions.CatalogException) ClientException(com.microsoft.graph.core.ClientException)

Aggregations

GraphServiceException (com.microsoft.graph.http.GraphServiceException)6 GraphErrorResponse (com.microsoft.graph.http.GraphErrorResponse)3 DefaultSerializer (com.microsoft.graph.serializer.DefaultSerializer)3 ISerializer (com.microsoft.graph.serializer.ISerializer)3 ClientException (com.microsoft.graph.core.ClientException)2 DefaultLogger (com.microsoft.graph.logger.DefaultLogger)2 Test (org.junit.jupiter.api.Test)2 AccessToken (com.azure.core.credential.AccessToken)1 TokenRequestContext (com.azure.core.credential.TokenRequestContext)1 ClientSecretCredential (com.azure.identity.ClientSecretCredential)1 ClientSecretCredentialBuilder (com.azure.identity.ClientSecretCredentialBuilder)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Cache (com.github.benmanes.caffeine.cache.Cache)1 Caffeine (com.github.benmanes.caffeine.cache.Caffeine)1 ServiceBuilder (com.github.scribejava.core.builder.ServiceBuilder)1 OAuth20Service (com.github.scribejava.core.oauth.OAuth20Service)1 Supplier (com.google.common.base.Supplier)1 Suppliers (com.google.common.base.Suppliers)1 TokenCredentialAuthProvider (com.microsoft.graph.authentication.TokenCredentialAuthProvider)1 HttpClients (com.microsoft.graph.httpcore.HttpClients)1