Skip to content
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

How-to: Use Spring Authorization server behind Spring Cloud Gateway #564

Open
rcbandit111 opened this issue Jan 2, 2022 · 16 comments
Open
Assignees
Labels
type: documentation A documentation update

Comments

@rcbandit111
Copy link

Publish a guide on How-to: Implement the core services behind Spring Cloud Gateway:

@rcbandit111 rcbandit111 added the type: enhancement A general enhancement label Jan 2, 2022
@sjohnr
Copy link
Member

sjohnr commented Jan 3, 2022

Related #499

@rcbandit111
Copy link
Author

When I can expect this guide?

@rcbandit111
Copy link
Author

rcbandit111 commented Jan 27, 2022

Kind remind guys. I will appreciate it if someone write me some configuration steps before official documentation is ready.

@jgrandja
Copy link
Collaborator

jgrandja commented Jan 27, 2022

@rcbandit111 It will be a while before we get to this as there are a few higher priority tasks we need to work on first.

If someone in the community can help that would be great. cc @spencergibb

@rcbandit111
Copy link
Author

@jgrandja Thank you for the response. I will wait further information.

@jgrandja jgrandja changed the title How to: Use Spring Authorization server behind Spring Cloud Gateway How-to: Use Spring Authorization server behind Spring Cloud Gateway Feb 8, 2022
@jacko9et
Copy link

No additional configuration is required if it is only used behind a gateway. However, in the case of load balancing, spring session support is required, because the server uses session to associate authentication actions.

@salutonmondo
Copy link

salutonmondo commented Jul 22, 2022

Is this suit your needs #807

@sjohnr
Copy link
Member

sjohnr commented Jul 22, 2022

@salutonmondo I believe this issue is addressing using Spring Authorization Server behind Spring Cloud Gateway, whereas the sample you submitted treats SAS as an identity provider but does not route the requests to it. When we look more deeply at this issue, we'll have to think about what use cases make sense for putting SAS behind the gateway. One that I can think of, for example, is rate limiting to protect the authorization server or specific endpoints from malicious clients.

@uniquejava
Copy link

@salutonmondo Thanks for your demo, I added some comments there in your #807, could you shed some light?

@sjohnr sjohnr self-assigned this Jan 3, 2023
@zhoyq-work
Copy link

use database to share data between auth servers, this can reslove load balancing problem.

@zhenhe
Copy link

zhenhe commented Mar 7, 2023

any update recently?

@maradanasai
Copy link

Hi, any update?

@uniquejava
Copy link

I once needed this, after some research, I found what I really need is how to use spring cloud gateway as resource server and verify token from this single point. Finally I managed to do this, and I don't think I need the auth server sit behind spring cloud gateway now. Here is my current demo architecture.

image

The benefit: I just verify token from spring cloud gateway and pass the resolved user id as http header to my downstream micro-services and all my microservices now don't even have a dependency on spring security.

I once used spring cloud gateway as oauth2 client, --- almost each tutorial on the internet do this, and I think that is too academic/complex and not feasible at all in a real large application.

@zhenhe
Copy link

zhenhe commented Mar 15, 2023

I once needed this, after some research, I found what I really need is how to use spring cloud gateway as resource server and verify token from this single point. Finally I managed to do this, and I don't think I need the auth server sit behind spring cloud gateway now. Here is my current demo architecture.

image

The benefit: I just verify token from spring cloud gateway and pass the resolved user id as http header to my downstream micro-services and all my microservices now don't even have a dependency on spring security.

I once used spring cloud gateway as oauth2 client, --- almost each tutorial on the internet do this, and I think that is too academic/complex and not feasible at all in a real large application.

good advice,how scg do both verify token and then pass request ? use filter?

@uniquejava
Copy link

@zhenhe Yes, a single UserHeaderFilter will do the job, and here is an example: https://stackoverflow.com/a/71485398/2497876

@dangfsix
Copy link

I once needed this, after some research, I found what I really need is how to use spring cloud gateway as resource server and verify token from this single point. Finally I managed to do this, and I don't think I need the auth server sit behind spring cloud gateway now. Here is my current demo architecture.

image

The benefit: I just verify token from spring cloud gateway and pass the resolved user id as http header to my downstream micro-services and all my microservices now don't even have a dependency on spring security.

I once used spring cloud gateway as oauth2 client, --- almost each tutorial on the internet do this, and I think that is too academic/complex and not feasible at all in a real large application.

Hi. Can you make a sample repo? Many thanks.

@jgrandja jgrandja added type: documentation A documentation update and removed type: enhancement A general enhancement labels May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
Status: Planning
Development

No branches or pull requests

10 participants