Your organization may not permit JWT 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 ILimitsRestClientBuilder (for Atoti Server version 6.1.x or 6.0.x-sb3) or ILimitsRestTemplateBuilder (for Atoti Server version 6.0.x).
Your implementation should return the RestClient.Builder or RestTemplateBuilder that you intend to use.
These are used to create Http clients used to send REST requests from the connected servers to Atoti Limits.
ILimitsRestClientBuilder
/**
* <b>ILimitsRestClientBuilder</b>
*
* <p>Used to provide a {@link RestClient.Builder} for sending authenticated requests to Atoti
* Limits from the connected server.
*
* @author ActiveViam
*/@FunctionalInterfacepublicinterfaceILimitsRestClientBuilder{
RestClient.BuildergetRestClientBuilder();}
ILimitsRestTemplateBuilder
/**
* <b>ILimitsRestTemplateBuilder</b>
*
* <p>Used to provide a {@link RestTemplateBuilder} for sending authenticated requests to Atoti
* Limits from the connected server.
*
* @author ActiveViam
*/@FunctionalInterfacepublicinterfaceILimitsRestTemplateBuilder{
RestTemplateBuilder getRestTemplateBuilder();}
2. Configure your Atoti Limits Rest client
In your Atoti Limits project, implement an instance of ILimitsRestClientBuilder. This is used to create an Http client
used to send REST requests from Atoti Limits to the connected servers. This interface is the
same as the ILimitsRestClientBuilder in the previous section.
ILimitsRestClientBuilder
/**
* <b>ILimitsRestClientBuilder</b>
*
* <p>Used to provide a {@link RestClient.Builder} for building and sending authenticated requests
* from Atoti Limits to the connected servers.
*
* @author ActiveViam
*/@FunctionalInterfacepublicinterfaceILimitsRestClientBuilder{
RestClient.BuildergetLimitsRestClientBuilder();}
3. Import your custom implementations as Spring Beans