-
Notifications
You must be signed in to change notification settings - Fork 20
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
Pac4JProfileInjectorFactory disable CDI Injection Resteasy #34
Comments
@jarnaiz thanks for the report. To be sure I understand, the situation is that:
Your problem is that you want both (which makes sense :) ? Could you clarify to me what is this The workaround is applied while you don't register |
Hello @victornoel You are right in all the questions:
I want to inject both, yes :) The TokenLogin is a POJO created by me and put in the same maven module. <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.2" bean-discovery-mode="all">
</beans> And with CDI 1.2 with discovery-mode=all any class can be injected with The Java CDI documentation is hard and extensive.. I found this document from the wildfly implementation: http://weld.cdi-spec.org/documentation/ |
Ok, so it is most certainly a bug, but I'm a bit out of my depth concerning CDI and how the implementation for profile injection is breaking it... Maybe @yegorius, since you first wrote For the record, the only advantage of using the shipper injection mechanism ( |
Please read this Reasteasy doc very carefully. It says:
|
Thanks for your feedback! I also read this:
From what I understand, maybe something like this is happening:
@jarnaiz do you have maybe some logs that would show us more details about this to confirm or infirm our analysis? Do you use the |
You could also try to remove the |
ok, thanks @victornoel I will try what you have told me (remove @stateless) Regarding your question: Do you use the |
@jarnaiz @victornoel I have made some some changes in #42 that could possibly fix this issue as well. I have added tests for resteasy with CDI as part of that. @jarnaiz you could possibly take those changes and see if it helps your case. https://github.com/pac4j/jax-rs-pac4j/pull/42/files#diff-e6b8d4359ecd20a7589465155d7f2ebe |
@jarnaiz can you confirm that latest 3.0.0-SNAPSHOT (or 2.3.0-SNAPSHOT if you are still using pac4j v2) fixes this problem? |
I'm closing this, please open a new issue if this is still a problem :) |
Im using jax-rs-pac4j with resteasy and wildfly 10.1.0.Final Im using this config:
And this controller:
The class
TokenLogin
is a POJO with any annotations. If I add thePac4JProfileInjectorFactory
to FeatureContext context, the tokenLogin is not injected and is null and without thePac4JProfileInjectorFactory
the tokenLogin is injected as expected.My workaround is this:
And replace all the
@Pac4jProfile
with@Context
.Another option is to cast the
SecurityContext#getPrincipal
Im doing something wrong or is a bug?
Thanks!
The text was updated successfully, but these errors were encountered: