[jboss-user] [JBoss Seam] - Exception thrown from Authenticator.authenticate method

terryb do-not-reply at jboss.com
Wed Sep 19 04:48:34 EDT 2007


Someone please help. I throw an exception from Authenticator.authenticate and would like to capture it in pages.xml file to redirect to a custom page. However it doesn't work as expected. 

The exception thrown appears in logs but it doesn't redirect to the page specified in the pages.xml file. Seam treats my exception same as returning false from the authenticate method, meaning login failed and displays faces message.

Authenticator class:

public boolean authenticate() {

	...	

		if ("locked".equalsIgnoreCase(organisationUser.getStatus())) {
			
			FacesMessages.instance().addFromResourceBundle("mypackage.test", identity.getUsername());
			throw new UserAccountLockedException("Your account is currently locked.");
		}
		...
		return true;
}

pages.xml
[exception class="mypackage.UserAccountLockedException"]
 [redirect view-id="/error.xhtml"]
  [message] Account locked [/message]
[ /redirect]
[/exception]

[ and ] only to allow pasting xml here, they meant to bes < and >.

It doesn't redirect to /error.xml page. It just stays on login page and displayes my message from messages_en.properties file.

Do I need to do something else to make my exception entry in pages.xml to work???



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085912#4085912

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085912



More information about the jboss-user mailing list