| 1 |
|
package org.trails.page; |
| 2 |
|
|
| 3 |
|
import org.apache.commons.logging.Log; |
| 4 |
|
import org.apache.commons.logging.LogFactory; |
| 5 |
|
import org.apache.tapestry.IRequestCycle; |
| 6 |
|
import org.apache.tapestry.RedirectException; |
| 7 |
|
import org.apache.tapestry.html.BasePage; |
| 8 |
|
|
| 9 |
0 |
public abstract class LoginPage extends BasePage { |
| 10 |
|
|
| 11 |
0 |
private static final Log LOG = LogFactory.getLog(LoginPage.class); |
| 12 |
|
|
| 13 |
|
public abstract String getUsername(); |
| 14 |
|
|
| 15 |
|
public abstract String getPassword(); |
| 16 |
|
|
| 17 |
|
public abstract boolean getRememberMe(); |
| 18 |
|
|
| 19 |
|
public void login(IRequestCycle cycle) throws RedirectException { |
| 20 |
|
|
| 21 |
0 |
LOG.debug("User " + getUsername() + " is attempting login."); |
| 22 |
|
|
| 23 |
0 |
String acegiUrl = cycle.getAbsoluteURL("/j_acegi_security_check?j_username=" + getUsername() + "&j_password=" + getPassword() + "&j_rememberme=" + getRememberMe()); |
| 24 |
|
|
| 25 |
0 |
throw new RedirectException(acegiUrl); |
| 26 |
|
} |
| 27 |
|
|
| 28 |
|
} |