-
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
Value injector for RESTEasy #31
Conversation
Oh great! I'm going to review this soon! |
You should already try to enable the tests that involve the annotations, it's easy, there is just some empty overriding test method to remove normally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank, there are some points that should be improved but it's great already :)
Could you:
- enable the tests (remove the empty overriding tests in
RestEasyUndertowServletTest
and enable the feature inRestEasyUndertowServletRule
) - find out why some tests do not pass (actually, if you run all the tests of
RestEasyUndertowServletTest
some tests do not pass, but if you execute them one by one, they do... there is something fishy with state that is not cleaned as expected or maybe it is resteasy... - Add some very basic documentation (in the same way as the jersey feature)
); | ||
} else { | ||
return new Pac4JValueInjector( | ||
(req, resp) -> new ProfileManager(new J2EContext(req, resp)).get(profile.readFromSession()).orElse(null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the jersey implementation, I preferred to throw an new WebApplicationException(401)
instead of returning null.
The rational is that if you want to retrieve a profile that can be potentially not there (i.e. you are not authenticated), then you use the Optional.
If not (i.e., you are expecting to be authenticated, then the profile shouldn't be null, then we should't allow for such situation, especially because it introduces a security risks.
Actually one of the test relies on this behaviour ;)
this.provider = provider; | ||
} | ||
|
||
public Object inject(HttpRequest request, HttpResponse response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an @Override
annotation here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✓
return inject(); | ||
} | ||
|
||
public Object inject() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an @Override
annotation here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✓
@@ -131,6 +131,10 @@ public PrincipalImpl(LinkedHashMap<String, CommonProfile> profiles) { | |||
this.roles = Collections.unmodifiableSet(rs); | |||
} | |||
|
|||
public CommonProfile getProfile() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not related to this PR, right? I would prefer you remove it then :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✓
@@ -0,0 +1,79 @@ | |||
package org.pac4j.jax.rs.resteasy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this class into org.pac4j.jax.rs.resteasy.features, it would make more sense with the organization of the rest of this library :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✓
There are also some formatting problems... some tabs crept up :) |
I am investigating issues with tests right now. |
The only test which fails for me is
At this moment, I have no clue. |
Thanks for the exploration. |
We can proceed without it. To be fixed later.
I have ignored the failing test so that the build is successful now. I have also updated the documentation. |
yes, ok, let's do that |
Yes, it makes sense. It'a noticeable update. Starting... |
@victornoel The version is still 2.0.3, I think it should be 2.1.0 as it's a backward compatible change (not a bug fix), isn't it? |
yes, 2.1.0 is a good number! (that's what I was saying in my comment above ; ) |
Yes, right. I just performed the release, it will show up in the Maven central repository in a few hours... |
What do you think?