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

EL Placeholder support in @RolesAllowed annotation #25245

Closed
odellamaggiore opened this issue Apr 29, 2022 · 11 comments · Fixed by #29935
Closed

EL Placeholder support in @RolesAllowed annotation #25245

odellamaggiore opened this issue Apr 29, 2022 · 11 comments · Fixed by #29935

Comments

@odellamaggiore
Copy link

Describe the bug

If we use an EL placeholder in @RolesAllowed annotation value, to make a reference to a config property, the placeholder is not resolved.
Example:

MyClass.java

@RolesAllowed("myrole_${role.suffix}")
public class MyClass

application.yml

role:
  suffix: someValue

This is something that works with Jakarta EE on EAP/Wildfly so I expected it to work also with Quarkus.

Expected behavior

@RolesAllowed annotation value resolved to "myrole_someValue"

Actual behavior

@RolesAllowed annotation value remains "myrole_${role.suffix}"

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@sberyozkin
Copy link
Member

Hi @radcortez, @dmlloyd Is it something that our configuration system can help with ? I guess it should work similar to this:

  • The code which introspects in this case @RolesAllowed gets the annotation value and then, given the example in this issue,
  • Config.resolve("myrole_${role.suffix}") and gets back myrole_someValue

I believe such a resolver code already exists since we already support such indirect property references in application.properties

Thanks

@dmlloyd
Copy link
Member

dmlloyd commented Apr 29, 2022

Sure, it should be possible. The expression resolution is performed by smallrye-common-expression with a resolver which assesses the configuration system for its values.

@sberyozkin sberyozkin added kind/enhancement New feature or request and removed kind/bug Something isn't working labels Apr 29, 2022
@vsevel
Copy link
Contributor

vsevel commented Apr 29, 2022

I believe such a resolver code already exists since we already support such indirect property references in application.properties

hi @sberyozkin agreed. and that has been supported for many years in jboss.

@vsevel
Copy link
Contributor

vsevel commented Oct 6, 2022

hello, do you think this is likely to be implemented at some point?

@radcortez
Copy link
Member

Ideally if this could come from the community it would be faster :)

@vsevel
Copy link
Contributor

vsevel commented Oct 10, 2022

thanks for this honest answer @radcortez ;)
I have thought about it. I should have more time early next year.

@radcortez
Copy link
Member

Great. Thanks. Feel free to reach out if you need help.

@michalvavrik
Copy link
Member

Looks like interesting issue, I can have a look provided @vsevel is fine with that.

@vsevel
Copy link
Contributor

vsevel commented Dec 12, 2022

sure. np. happy to test if you need. @michalvavrik

@michalvavrik
Copy link
Member

Thank you.

michalvavrik added a commit to michalvavrik/quarkus that referenced this issue Dec 18, 2022
michalvavrik added a commit to michalvavrik/quarkus that referenced this issue Dec 18, 2022
michalvavrik added a commit to michalvavrik/quarkus that referenced this issue Dec 18, 2022
michalvavrik added a commit to michalvavrik/quarkus that referenced this issue Dec 18, 2022
michalvavrik added a commit to michalvavrik/quarkus that referenced this issue Dec 19, 2022
michalvavrik added a commit to michalvavrik/quarkus that referenced this issue Dec 19, 2022
michalvavrik added a commit to michalvavrik/quarkus that referenced this issue Dec 19, 2022
michalvavrik added a commit to michalvavrik/quarkus that referenced this issue Dec 20, 2022
@quarkus-bot quarkus-bot bot added this to the 2.16 - main milestone Dec 21, 2022
ebullient pushed a commit to maxandersen/quarkus that referenced this issue Jan 24, 2023
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.

6 participants