-
Hi, I have a JAX-RS endpoint and a custom annotation used in that endpoint that needs to determine the current userid. How is that possible ? JAX-RS endpoint method looks like this : Within the Interceptor I need to get the username of the currently logged in user to check if the user has the permission to click the button. I tried various approached injecting a SecurityContext or SecurityIdentity, bit none of these work inside the Interceptor. Any idea how I can get the username inside the Interceptor ? Any help appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
/cc @sberyozkin |
Beta Was this translation helpful? Give feedback.
-
@joerg-db Hi, do you mean that Does your endpoint class have |
Beta Was this translation helpful? Give feedback.
-
Hi, by looking at the impl. of @RolesAllowed in quarkus (as it does a similar thing) I meanwhile found a way that works for me:
That works if the context is secured (I use @testsecurity to login a user) and the respective @CheckPermission annotation can be applied to JAX-RS endpoints as well as plain Java methods. So my problem is actually resolved and my question is answered (as long as there are no objections against my solution). Thx |
Beta Was this translation helpful? Give feedback.
-
I did some more test and can confirm that injecting SecurityIdentity (instead of SecurityIdentyAssociation) also works fine. Thx |
Beta Was this translation helpful? Give feedback.
Hi,
by looking at the impl. of @RolesAllowed in quarkus (as it does a similar thing) I meanwhile found a way that works for me:
That works if the context is secured (I use @testsecurity to login a user) and the respective @CheckPermission annotation can be applied to JAX-RS endpoints as well as plain Java methods.
So my problem is actually resolved and my question is answered (as long as there are no objections against my solution).
Thx