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

LoginHandler mistakenly throws VraptorAuthenticationException #2

Open
jweyrich opened this issue Apr 26, 2012 · 4 comments
Open

LoginHandler mistakenly throws VraptorAuthenticationException #2

jweyrich opened this issue Apr 26, 2012 · 4 comments

Comments

@jweyrich
Copy link
Contributor

Hi Rodrigo,

I wrote a custom Guice provider that registers some factories and the LoginHandler stereotype handler.
However, I noticed the handle(Class<?> resource) method is invoked more than once. Specifically, VRaptor invokes it for each resource (read @component) it finds.

The problem arises when the class that contains the @Login annotation is not the first to be passed to the LoginHandler. In this case, a VraptorAuthenticationException is thrown.

From what I understand, VRaptor invokes (just an example) instance_of_LoginHandler.handle(first_component), which then loops thru the component's methods looking for the @Login annotation.
After the loop ends, it invokes ifThereIsNotAnyLoginActionThrowAnException(), which will throw an exception if first_component doesn't contain a method annotated with @Login.

I just commented out the ifThereIsNotAnyLoginActionThrowAnException invocation for now, but I'm still thinking how we can verify whether the annotation was found or not, while avoiding this issue.

@jweyrich
Copy link
Contributor Author

@rlazoti: Are you able to reproduce this issue?

The temporary fix I mentioned can be seen in jweyrich@5a26a2b

@wagnerfrancisco
Copy link

I'm also having this problem. I used the fix jweyrich suggested and it's working now.

@rlazoti
Copy link
Owner

rlazoti commented May 9, 2013

@jweyrich @wagnerfrancisco But even with the ifThereIsNotAnyLoginActionThrowAnException invocation commented out, does the plugin work correctly?

@jweyrich
Copy link
Contributor Author

jweyrich commented May 9, 2013

It works fine, I think it just won't tell you if you forget to annotate a method with @Login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants