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

wrap ServerWebExchange to support .getPrincipal() #6599

Closed
wants to merge 1 commit into from
Closed

wrap ServerWebExchange to support .getPrincipal() #6599

wants to merge 1 commit into from

Conversation

Dav1dde
Copy link
Contributor

@Dav1dde Dav1dde commented Mar 8, 2019

Fixes #6598

Properly wraps the ServerWebExchange so that in a mocked environment without active SecurityFilterChain the principal can still be received.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 7, 2019
@eleftherias
Copy link
Contributor

@Dav1dde please see my comment on the GitHub issue gh-6598.
We do not want to wrap the context in a SecurityContextServerWebExchange, since that does not mimic what is happening when the application is running.
Instead, I suggest creating an HttpBasicMutator, which will include the HTTP basic Authorization header in the request.

@eleftherias eleftherias self-assigned this Oct 17, 2019
@eleftherias eleftherias added status: feedback-provided Feedback has been provided and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 17, 2019
@eleftherias
Copy link
Contributor

@Dav1dde Can you confirm that this issue was fixed in gh-7687 and if so please close this PR?

@Dav1dde
Copy link
Contributor Author

Dav1dde commented Dec 12, 2019

@eleftherias my current issue is resolved with that, but now it's more of a question of how the spring security context interacts with exchange.getPrincipal(). But from my understanding and as we discussed in gh-6598, you (the spring-security team) think the request has to go through a security-filter in order to "get" a principal, which is fair and makes sense - this makes the PR obselete.

@Dav1dde Dav1dde closed this Dec 12, 2019
@eleftherias eleftherias added status: declined A suggestion or change that we don't feel we should currently apply and removed status: feedback-provided Feedback has been provided labels Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In Test @AuthenticationPrincipal is null because ServerWebExchange is not wrapped
3 participants