Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zuul - Api Gateway Authentication

I want to introduce Zuul through Spring Cloud as an API Gateway in front of a few services.

I have some design doubts around Authentication. The Authentication would be handled by Spring Security, which comes before Zuul in the servlet filter chain.

My concern:

  • the Gateway would sit in front of many services

  • some services may expose endpoints which do not require authentication

  • some services may expose endpoints which need a Session Id and some with a token", an arbitrary opaque value (for example downloading a file if you know a "hard to guess" url) In the API Gateway/Spring Security you can configure all the endpoints with their specific authentication requirements.

In terms of managing the API Gateway:

  • how do you enforce the actual Service Teams to provide the required settings per downstream service?
  • how do you allow frequent Authentication settings changes in the Gateway (as per service needs) without having to stop the entire Gateway?

Thanks, Adrian

like image 464
Adrian Ivan Avatar asked Nov 25 '15 16:11

Adrian Ivan


People also ask

How does Zuul API gateway work?

It handles all the requests and performs the dynamic routing of microservice applications. It works as a front door for all the requests. It is also known as Edge Server. Zuul is built to enable dynamic routing, monitoring, resiliency, and security.

Is Zuul API gateway deprecated?

Zuul 1 and Archaius 1 have both been superseded by later versions that are not backward compatible. The following Spring Cloud Netflix modules and corresponding starters will be placed into maintenance mode: spring-cloud-netflix-archaius. spring-cloud-netflix-hystrix-contract.

Is Zuul a gateway?

Zuul is a gateway service that provides dynamic routing, monitoring, resiliency, security, and more.

How to launch individual services from Zuul as an API gateway?

Spring boot to launch individual services Netflix Zuul as the API gateway I have also written a Zuul PRE filter that checks for an Access Token, contacts the IDP and create a JWT. The JWT is then added to the header for the request forwarded to the downstream service.

How many Zuul-API gateway authentication are there?

6 Zuul Gateway - setSendZuulResponse & removeRouteHost Related 38 Zuul - Api Gateway Authentication 25 Spring Cloud + Zuul + JWT for Value/Reference Tokens 0 zuul : Bearer authentication not accepted

How do I use Zuul authentication in spring?

Zuul Auth Example. Use Zuul and Spring Security for a global authentication via the popular JWT token. The service to issue the JWT token. The client POST {username,password} to /login. This service will authenticate the username and password via Spring Security, generate the token, and issue it to client.

How to use Netflix Zuul as an API gateway?

Netflix Zuul as the API gateway I have also written a Zuul PRE filter that checks for an Access Token, contacts the IDP and create a JWT. The JWT is then added to the header for the request forwarded to the downstream service.


1 Answers

We are using Spring Session to replicate the session across all of our services that sit behind a Zuul Edge Server. Zuul will authenticate the user which populates the users credentials and inserts the authenticated user into the session. This is then replicated across all the services and each service is responsible for their own security rules and settings. So really, all Zuul is doing is looking the user up in spring security and the services on the backend are enforcing the security rules as they apply to their needs. This way, you can change each service independently making the Gateway just a dumb proxy.

A good example of this is in Dave Syers tutorial about Spring Security and an Angular JS app. I also posted another question related to this which contained a sample of how we are doing this as well which might help.

like image 117
Andrew Serff Avatar answered Oct 06 '22 16:10

Andrew Serff