Class AzureAdRefreshTokenFilter
java.lang.Object
com.atlassian.crowd.directory.authentication.AzureAdRefreshTokenFilter
- All Implemented Interfaces:
javax.ws.rs.client.ClientRequestFilter
,javax.ws.rs.client.ClientResponseFilter
public class AzureAdRefreshTokenFilter
extends Object
implements javax.ws.rs.client.ClientRequestFilter, javax.ws.rs.client.ClientResponseFilter
Jersey ClientRequestFilter for Microsoft Entra ID authentication support. Will generate a new authentication token if not present,
add the token to the request and retry the request if the token has expired.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAzureAdRefreshTokenFilter
(com.google.common.cache.LoadingCache<String, String> tokenCache) -
Method Summary
Modifier and TypeMethodDescriptionvoid
filter
(javax.ws.rs.client.ClientRequestContext request) Sets the current authentication token in the request, creating one if necessary, and adds it as a request header.void
filter
(javax.ws.rs.client.ClientRequestContext request, javax.ws.rs.client.ClientResponseContext response) If the response is unauthorized, invalidate the token in cache.void
setTokenInRequest
(javax.ws.rs.client.ClientRequestContext request)
-
Field Details
-
AZURE_AD_TOKEN_CACHE_KEY
- See Also:
-
-
Constructor Details
-
AzureAdRefreshTokenFilter
-
-
Method Details
-
filter
Sets the current authentication token in the request, creating one if necessary, and adds it as a request header. If the token has expired a new one will be generated and the request will be retried.- Specified by:
filter
in interfacejavax.ws.rs.client.ClientRequestFilter
- Throws:
IOException
-
filter
public void filter(javax.ws.rs.client.ClientRequestContext request, javax.ws.rs.client.ClientResponseContext response) throws IOException If the response is unauthorized, invalidate the token in cache.- Specified by:
filter
in interfacejavax.ws.rs.client.ClientResponseFilter
- Throws:
IOException
-
setTokenInRequest
public void setTokenInRequest(javax.ws.rs.client.ClientRequestContext request)
-