We are designing a RESTFUL API that needs to support several login services.
Custom login: ptgapi/v1/clients/{clientId}/users?mode=custom
FB login: ptgapi/v1/clients/{clientId}/users?mode=facebook
Twitter login: ptgapi/v1/clients/{clientId}/users?mode=twitter
LinkedIn login: ptgapi/v1/clients/{clientId}/users?mode=linkedin
Create user: ptgapi/v1/clients/{clientId}/users
We have an Spring Integration layer in top of the services, so in based of the provided path, one of the services will need to be activated.
The idea would be to have a router that catches the inbound-gateway input and redirect the flow based on the payload value.
<int-http:inbound-gateway id="v1.login.inbound.gateway" path="/ptgapi/{apiVersion}/clients/{clientId}/users" .../>
But here 'create user' has the same routing process than the other ones...and I think this is a bad smell.
Is a better approach to obtain it with a better separation of concerns?
Thanks!