-
1. Re: Exception thrown from Authenticator.authenticate method
shane.bryzak Sep 19, 2007 9:40 AM (in response to terryb)Authentication is performed within the context of a JAAS login, so we are restricted by the contract of the LoginModule.login() method, which specifies that only a LoginException be thrown if authentication fails. Unfortunately, LoginException only allows a message to be specified and no actual cause, otherwise it would be possible to extend Identity and override its login() method to unwrap the actual exception and re-throw it.
What you could possibly do as an alternative is store the account status in the request context, then create navigation rules in your pages.xml to redirect to certain pages based on that status. -
2. Re: Exception thrown from Authenticator.authenticate method
terryb Sep 22, 2007 6:28 AM (in response to terryb)Shane
Thanks for the tip, it worked. I added method in Authenticator class as below:
public boolean isLocked() {
...
return boolean;
}
and then added following page navigation rule
navigation from-action="#{identity.login}"
rule if="#{not identity.loggedIn and authenticator.locked}"
redirect view-id="/error.xhtml"/
/rule
rule if="#{identity.loggedIn}"
redirect view-id="/home.xhtml"/
/rule
/navigation
Although it took me a while to figure out that 'locked' in 'authenticator.locked' is supposed to a method 'isLocked()' in its class.