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

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    AzureAdRefreshTokenFilter(com.google.common.cache.LoadingCache<String,String> tokenCache)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AzureAdRefreshTokenFilter

      public AzureAdRefreshTokenFilter(com.google.common.cache.LoadingCache<String,String> tokenCache)
  • Method Details

    • filter

      public void filter(javax.ws.rs.client.ClientRequestContext request) throws IOException
      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 interface javax.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 interface javax.ws.rs.client.ClientResponseFilter
      Throws:
      IOException
    • setTokenInRequest

      public void setTokenInRequest(javax.ws.rs.client.ClientRequestContext request)