Class GraphClientProvider
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.extrausermgt.users.aad.GraphClientProvider
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
public class GraphClientProvider
extends AbstractLogEnabled
implements Initializable, Serviceable, Component
Provide a Graph client for a user.
Depending on the configuration, the client can either be authenticated
using an application credentials or the current user Entra id token
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Exception related to the Graph client -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.microsoft.graph.requests.GraphServiceClient
Get an authenticated Graph clientcom.microsoft.graph.requests.UserRequestBuilder
getUserRequestBuilder
(UserIdentity userIdentity) Get a graph client for the user.void
void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The avalon role
-
-
Constructor Details
-
GraphClientProvider
public GraphClientProvider()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
-
getUserRequestBuilder
public com.microsoft.graph.requests.UserRequestBuilder getUserRequestBuilder(UserIdentity userIdentity) throws GraphClientProvider.GraphClientException Get a graph client for the user. No check is performed to ensure that the user is actually a valid graph user- Parameters:
userIdentity
- the user identity- Returns:
- the client
- Throws:
GraphClientProvider.GraphClientException
- when its not possible to retrieve a client for the user
-
getGraphClient
public com.microsoft.graph.requests.GraphServiceClient getGraphClient() throws GraphClientProvider.GraphClientExceptionGet an authenticated Graph client- Returns:
- a Graph client
- Throws:
GraphClientProvider.GraphClientException
- when its not possible to retrieve a client for the user
-