Your organization may not permit basic authentication, may require some other form of authentication,
or may already have some third-party authentication mechanism in place. In these scenarios, knowing how to extend Atoti Limits’s machine-to-machine authentication mechanisms is useful.
How to add custom MtM authentication
The steps are as follows:
1. Configure your Connected Server Rest client
In your connected Atoti Server project, implement an instance of ILimitsRestClientProvider (for Atoti Server version 6.1.x or 6.0.x-sb3) or ILimitsRestTemplateProvider (for Atoti Server version 6.0.x).
Your implementation should return the RestClient or RestTemplate that you intend to use.
These are used to create Http clients used to send REST requests from the connected servers to Atoti Limits.
ILimitsRestClientProvider
/**
* <b>ILimitsRestClientProvider</b>
*
* <p>Used to provide a {@link RestClient} for sending authenticated requests to Atoti Limits from
* the connected server.
*
* @author ActiveViam
*/@FunctionalInterfacepublicinterfaceILimitsRestClientProvider{
RestClient getLimitsRestClient();}
ILimitsRestTemplateProvider
/**
* <b>ILimitsRestTemplateProvider</b>
*
* <p>Used to provide a {@link RestTemplate} for sending authenticated requests to Atoti Limits from
* the connected server.
*
* @author ActiveViam
*/@FunctionalInterfacepublicinterfaceILimitsRestTemplateProvider{
RestTemplate getLimitsRestTemplate();}
2. Configure your Atoti Limits Rest client
In your Atoti Limits project, implement an instance of ILimitsRestClientBuilderProvider. This is used to create an Http client
used to send REST requests from Atoti Limits to the connected servers.
ILimitsRestClientBuilderProvider
/**
* <b>ILimitsRestClientBuilderProvider</b>
*
* <p>Used to provide a {@link RestClient.Builder} for building and sending authenticated requests
* from Atoti Limits to the connected servers.
*
* @author ActiveViam
*/@FunctionalInterfacepublicinterfaceILimitsRestClientBuilderProvider{
RestClient.BuildergetLimitsRestClientBuilder();}
3. Import your custom implementations as Spring Beans