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

Suggested optimization: LoopbackIpRedirectFilter #114

Open
Lvbuqing opened this issue Jan 3, 2023 · 1 comment
Open

Suggested optimization: LoopbackIpRedirectFilter #114

Lvbuqing opened this issue Jan 3, 2023 · 1 comment

Comments

@Lvbuqing
Copy link

Lvbuqing commented Jan 3, 2023

\spring-security-samples\servlet\spring-boot\java\oauth2\login\src\main\java\example\filter\LoopbackIpRedirectFilter.java

Should not be configured:

if (request.getServerName().equals("localhost") && request.getHeader("host") != null) {
UriComponents uri = UriComponentsBuilder.fromHttpRequest(new ServletServerHttpRequest(request))
.host("127.0.0.1").build();
response.sendRedirect(uri.toUriString());
return;
}

In the oauth2 of Google login and GitHub login, there will be a prompt error that the callback address is different from the callback address configured by the application, and an error will be reported.

Because Google login does not allow setting the callback URL of 127.0.0.1, it needs a domain name, similar to localhost, but LoopbackIpRedirectFilter will change it to 127.0.0.1

@nahuel-soldevilla
Copy link

With facebook login it also happens that https is mandatory in the redirect uri, except for localhost.
Removing this filter and using localhost and http for the demo works for the facebook login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants