Giter VIP home page Giter VIP logo

Comments (7)

sdelamo avatar sdelamo commented on June 29, 2024

We have a section in the guide: https://micronaut-projects.github.io/micronaut-security/latest/guide/#securityService

from micronaut-security.

sdelamo avatar sdelamo commented on June 29, 2024

you can inject a bean of type SecurityService

from micronaut-security.

heshamz avatar heshamz commented on June 29, 2024

I tried to inject SecurityService, but getAuthentication returns empty.

from micronaut-security.

sdelamo avatar sdelamo commented on June 29, 2024

do you have sample which reproduces your issue?

from micronaut-security.

heshamz avatar heshamz commented on June 29, 2024

I will prepare the sample and will share, and I traced down and the reason that ServerRequestContext return empty requst.
I tried to use ServerRequestContext directly and it return empty "ServerRequestContext.currentRequest".

Update:

The PropagatedContext was cleared before reaching the event listner, this is why ServerRequestContext.currentRequest is empty.

from micronaut-security.

jeremyg484 avatar jeremyg484 commented on June 29, 2024

@heshamz I have done some testing to try and reproduce this on my own, and my conclusion without seeing a provided sample here is that this is likely similar to the behavior seen in the reproducible sample in #1468. In other words, the issue is likely due to switching between different reactive contexts and not supplying the necessary plumbing for the Context Propagation that is new in Micronaut 4. See my explanation there for some further detail.

As in that case, it is possible that adding the Micrometer Context Propagation dependency could fix your scenario, though I can't say for certain without knowing more details of your exact setup.

from micronaut-security.

sdelamo avatar sdelamo commented on June 29, 2024

We added a doc mention. @heshamz please reopen if adding Micrometer context propagation does not fix your issue.

from micronaut-security.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.