When implementing the microservice architecture at my previous work, we decided that the best approach was consistent with No. 1, adding an identification service and allowing access to it through it. In our case, this was done with tokens. If the request came with an authorization token, we could check this token using the authentication service, if this was the first call in a user session with the service. After the token was confirmed, it was saved in the session, so subsequent calls in the user session did not have to make an additional call. You can also create a scheduled task if tokens are to be updated in this session.
In this situation, we authenticated with the OAuth 2.0 endpoint, and the token was added to the HTTP header for calls to our domain. All services were redirected from this domain so that we can get the token from the HTTP header. Since we were all part of the same application ecosystem, the initial authorization of OAuth 2.0 will reflect the application services that the user will provide for their account.
In addition to this approach, it was found that the authentication service will provide a proxy client library that will be added to the HTTP request filter chain and will handle the authorization process for this service. The service will be configured to use the proxy client library from the identity service. Since we used Dropwizard, this proxy server would become the Dropwizard module, loading the filter into the running service process. This allowed the identity service to be updated, which also had a free client-side update that would be easily consumed by dependent services until the interface changed significantly.
Our deployment architecture has been distributed through AWS Virtual Private Cloud (VPC) and our own company data centers. OAuth 2.0 authentication was located in the company's data center, and all of our applications were deployed to AWS VPC.
I hope that the approach we have taken is useful for your decision. Let me know if you have any other questions.
Chris Sterling Dec 04 '14 at 0:29 2014-12-04 00:29
source share