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

Resteasy Reactive Security Context Exception #14850

Closed
akoufa opened this issue Feb 5, 2021 · 4 comments · Fixed by #14921
Closed

Resteasy Reactive Security Context Exception #14850

akoufa opened this issue Feb 5, 2021 · 4 comments · Fixed by #14921

Comments

@akoufa
Copy link

akoufa commented Feb 5, 2021

Hello. I am trying to update the security context in a RequestFilter like this:
context.securityContext = GatewaySecurityContext(context.securityContext, principalDetails) .

This is working with RestEasy Classic. Unfortunately using RestEasy Reactive I am getting the following error:

io.quarkus.resteasy.reactive.server.runtime.security.SecurityContextOverrideHandler.updateIdentity(SecurityContextOverrideHandler.java:48)

The issue is that in the following code

Uni<SecurityIdentity> oldIdentity = currentIdentityAssociation.getDeferredIdentity();
        currentIdentityAssociation.setIdentity(oldIdentity.map(new Function<SecurityIdentity, SecurityIdentity>() {

oldIdentity is null in the SecurityContextOverrideHandler class.

Is there anything I need to be aware of or am I doing something wrong here ?

@akoufa akoufa added the kind/bug Something isn't working label Feb 5, 2021
@ghost
Copy link

ghost commented Feb 5, 2021

@geoand
Copy link
Contributor

geoand commented Feb 5, 2021

@stuartwdouglas didn't you fix something related to this?

@CurtisBaldwinson
Copy link

CurtisBaldwinson commented Feb 5, 2021

.getDeferredIdentity() is asynchronous so when you're calling oldIdentity.map it hasn't received a value yet. You'll want to react when the value is returned:

        currentIdentityAssociation.getDeferredIdentity()
                .call(oldIdentity -> // Access old identity object here

@stuartwdouglas
Copy link
Member

Do you have a reproducer, or can you include the stack trace of the actual error?

I fixed something in the Servlet support around this, however it is likely slightly different.

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Feb 9, 2021
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Feb 9, 2021
@ghost ghost added this to the 1.12 - master milestone Feb 9, 2021
@gsmet gsmet modified the milestones: 1.12.0.CR1, 1.11.3.Final Feb 10, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants