Reputation: 11
I'm using "Zuul" as an api gateway for my spring boot based api microservices. I have also implemented a standalone "Auth Server" for JWT token creation and validation.
What I'm trying to achieve is "Zuul" calling the "Auth Server" for token validation before allowing the requests to go to any service.
So basic flow will be like on below
Due to speed, latency concerns I'm looking for a smart way of doing this. There is bunch of examples based on "Zuul Pre Filtering before Downstream Microservice routing". And it is hard to figure out which one is the better approach for my case. Apart from custom approaches is there any standart way of doing this?
Below is the best example I have found so far. Due to my lack of experience, I really don't know if this architecture is a good option to continue.
https://github.com/spring-cloud/spring-cloud-netflix/issues/1392#issuecomment-253267241
Upvotes: 1
Views: 1697
Reputation: 1046
The thing is to know how to setup Authorisation server, for that start with this https://www.baeldung.com/spring-security-zuul-oauth-jwt.
After you setup it correctly, configuration in zuul is not that complicated, in aplication.yaml you should set it like:
security:
oauth2:
client:
clientId: your_clientId
clientSecret: your_clientSecret
accessTokenUri: your_accessTokenUri
userAuthorizationUri: your_userAuthorizationUri
resource:
userInfoUri: your_userInfoUri
preferTokenInfo: true/false
Upvotes: 1