-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] How would you manage authentication/authorization? #6
Comments
Hi, For authentication, I would most likely use an Identity provider eg. Azure AD, AWS Cognito, or Auth0. Once the identity provider is up and running the token is validated in the ApiGateway and/or each microservice. |
So should the identity server be integrated in all the microservice or only the Gateway ??? Please @madslundt can you help as soon as possible ? This is how I configured the swagger in the other service (movies and review, users)
|
It depends, if you are wanting to program logic based on the user being "authorised" to do something. If this is the case then you will need to handle authentication in the gateway and authorisation in the service. If you are looking to control this based on urls e.g. not allowing people to create movies post -> /movies, then you can just add the authentication and authorisation in the gateway itself. This is what I would recommend as it makes things easier and is less of a performance hit! though if it can't be avoided to add programmed logic, then I would actually use a combination of both e.g. authentication and authorisation in the gateway and authorisation on the service, though this will come at a performance hit! When it comes to performance, you can predetermine how much of a hit it is by thinking how soon in the process can I stop people e.g. if someone can query the api, lets say create a movie, if the request is stopped at the gateway then that is only two services (identity service and the gateway) processing that request, otherwise if it is at the services side you are using three services (identity, gateway, movies) and possibly four services the fourth being the users service, depending on where the logic ends. Though it could be more than that again depending on logic. So the best way depends on how your services are laid out as a whole. If almost every service is using programmed logic, go the services route, if little services are programmed logic go the gateway and services route, if no services are programmed logic go the gateway route. It's just finding the balance. Saying this, I hope you know the difference between authorisation and authentication!
Not true, the gateway is the only thing that is front facing, all other services are inaccessible to the outside world. If you would like an analogy, the gateway is a form of firewall if you like. By the way, Ocelot (the gateway) has options for identity server https://ocelot.readthedocs.io/en/latest/features/authentication.html#identity-server-bearer-tokens |
Thanks for the clarification. |
Hi!
I really appreciate your work on this project.
I would like to ask you something, how would you handle authentication in this type of architecture?
Like an IdentityServer or a microservice delegated to authentication (implementing also AspNetIdentity Core)?
Thanks in advance
The text was updated successfully, but these errors were encountered: