Class MsalClientAdapter

All Implemented Interfaces:
com.microsoft.aad.msal4j.IHttpClient, CanUseSharedResource<HttpSession>, FrankElement, HasApplicationContext, HasName, HasPhysicalDestination, IConfigurable, IScopeProvider, ISender, ISenderWithParameters, IWithParameters, NameAware, HasKeystore, HasTruststore, ConfigurableLifecycle, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

@Protected public class MsalClientAdapter extends AbstractHttpSender implements com.microsoft.aad.msal4j.IHttpClient
This class ensures that Microsoft Authentication Library (MSAL) requests are sent through the configured proxy and the correct SSLSocketFactory.
See Also:
  • Constructor Details

    • MsalClientAdapter

      public MsalClientAdapter()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from interface: IConfigurable
      Configure this component.

      configure() is called once at startup of the framework in the configure method of the owner of this IConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in the configure(), to improve performance.

      In the case of a container, this will propagate the configure signal to all components that apply.

      Specified by:
      configure in interface IConfigurable
      Overrides:
      configure in class AbstractHttpSender
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • start

      public void start()
      Description copied from interface: ISender
      This method will be called to start the sender. After this method is called the sendMessage method may be called. Purpose of this method is to reduce creating connections to databases etc. in the sendMessage() method.
      Specified by:
      start in interface ISender
      Specified by:
      start in interface org.springframework.context.Lifecycle
      Overrides:
      start in class AbstractHttpSender
    • stop

      public void stop()
      Description copied from interface: ISender
      Stop/close the sender and deallocate resources.
      Specified by:
      stop in interface ISender
      Specified by:
      stop in interface org.springframework.context.Lifecycle
      Overrides:
      stop in class AbstractHttpSender
    • createGraphClient

      public MsalClientAdapter.GraphClient createGraphClient(String tenantId, CredentialFactory credentials) throws IOException
      Throws:
      IOException
    • getAuthenticationToken

      protected String getAuthenticationToken() throws IOException
      Throws:
      IOException
    • send

      public com.microsoft.aad.msal4j.IHttpResponse send(com.microsoft.aad.msal4j.HttpRequest httpRequest) throws Exception
      Specified by:
      send in interface com.microsoft.aad.msal4j.IHttpClient
      Throws:
      Exception
    • getMethod

      protected org.apache.http.client.methods.HttpRequestBase getMethod(URI uri, Message message, @Nonnull ParameterValueList parameters, PipeLineSession session) throws SenderException
      Description copied from class: AbstractHttpSender
      Custom implementation to create a HttpRequest object.
      Specified by:
      getMethod in class AbstractHttpSender
      Parameters:
      uri - endpoint to send the message to
      message - to be sent
      parameters - ParameterValueList that contains all the senders parameters
      session - PipeLineSession to retrieve or store data from, or NULL when not set
      Returns:
      a HttpRequest object
      Throws:
      SenderException
    • extractResult

      protected Message extractResult(HttpResponseHandler responseHandler, PipeLineSession session)
      Description copied from class: AbstractHttpSender
      Custom implementation to extract the response and format it to a String result.
      It is important that the response will be read or will be closed.
      Specified by:
      extractResult in class AbstractHttpSender
      Parameters:
      responseHandler - HttpResponseHandler that contains the response information
      session - PipeLineSession which may be null
      Returns:
      a string that will be passed to the pipeline