I have come from the .NET land and I have been pla...
# micronaut
c
I have come from the .NET land and I have been playing with Micronaut. Ive set up a AWS Cognito client and I have Micronaut validating the ID and Access tokens against the JWKS before the requests are processed. I do encode data such as user info in the ID token or group info in the access token, which I go through validation and parsing of the token. I have an object i have created from the payload. In .NET, i could use a Pre Request attribute on a controller method to allow or disallow access to that resource, such as encoded permissions. Likewise, i can use an “OnBeforeRequest” filter to get this data and handle the parsing into my object for injection into my controllers or business logic layer. I seem to be floundering a bit getting this working in Micronaut. Can anyone point me ij the right direction? I admittedly also understand less about the DI than i would like as well.
I got a response on discord that helped me: If you are implementing something standard like Roles from a token. You might be able to simply annotate your controllers or controller endpoints with
@Secured
https://micronaut-projects.github.io/micronaut-security/latest/guide/#secured If you are wanting an app-wdie authorization strategy, that isn't an out of the bnox standard, then take a look at custom authorization providers... https://micronaut-projects.github.io/micronaut-security/latest/guide/#custom