public abstract class AuthenticationInterceptor
extends jodd.madvoc.interceptor.ActionInterceptor
AuthorizationInterceptor.
Provides auto-login using cookies.
Authentication pertains to the question "Who are you?". Usually a user authenticates himself by successfully associating his "principal" (often a username) with his "credentials" (often a password).
| Modifier and Type | Field and Description |
|---|---|
protected int |
cookieMaxAge
Cookie max age, when cookies are used.
|
protected boolean |
recreateCookieOnLogin
When user just logs in with cookie, should we recreate the cookie
(and therefore prolong cookie valid time) or leave it as it is.
|
protected boolean |
useCookie
If
true, cookie will be created for keeping user sessions. |
| Constructor and Description |
|---|
AuthenticationInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeAuthSession(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse)
Closes auth session by removing auth session object from the http session
and clearing the auth cookie.
|
protected abstract java.lang.String[] |
createCookieData(java.lang.Object userSession)
Prepares cookie data from session object.
|
java.lang.Object |
intercept(jodd.madvoc.ActionRequest actionRequest) |
protected boolean |
isLoginAction(java.lang.String actionPath)
Detects login path.
|
protected boolean |
isLogoutAction(java.lang.String actionPath)
Detects logout path.
|
protected boolean |
isRegisterAction(java.lang.String actionPath)
Detects registration path.
|
protected abstract java.lang.Object |
loginUsernamePassword(java.lang.String username,
java.lang.String password)
Tries to login a user using username and password.
|
protected abstract java.lang.Object |
loginViaCookie(java.lang.String[] cookieData)
Tries to login user with cookie data.
|
protected java.lang.Object |
loginViaRequest(javax.servlet.http.HttpServletRequest servletRequest)
Tires to login user with form data.
|
protected java.lang.Object |
resultLoginFailed(int reason)
Prepares result for login failed page.
|
protected java.lang.Object |
resultLoginSuccess(java.lang.String path)
Prepares result to continue to, after success login.
|
protected java.lang.Object |
resultLogoutSuccess()
Prepares result for logout success page.
|
protected java.lang.Object |
resultRegistrationSuccess()
Prepares result for registration success page.
|
protected void |
startAuthSession(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
java.lang.Object userSession,
boolean isNew)
Starts auth session by saving session auth object and optionally creating an auth cookie.
|
protected boolean useCookie
true, cookie will be created for keeping user sessions.protected int cookieMaxAge
protected boolean recreateCookieOnLogin
public java.lang.Object intercept(jodd.madvoc.ActionRequest actionRequest)
throws java.lang.Exception
intercept in class jodd.madvoc.interceptor.ActionInterceptorjava.lang.Exceptionprotected void startAuthSession(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
java.lang.Object userSession,
boolean isNew)
servletRequest - http requestservletResponse - http responseuserSession - created session objectisNew - if true indicated the session is new (i.e. user is either registered or signed in), if false means that session is continued (i.e. user is signed in via cookie).protected void closeAuthSession(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse)
protected boolean isLoginAction(java.lang.String actionPath)
protected boolean isLogoutAction(java.lang.String actionPath)
protected boolean isRegisterAction(java.lang.String actionPath)
protected java.lang.Object resultLoginSuccess(java.lang.String path)
protected java.lang.Object resultLogoutSuccess()
protected java.lang.Object resultRegistrationSuccess()
protected java.lang.Object resultLoginFailed(int reason)
protected abstract java.lang.Object loginViaCookie(java.lang.String[] cookieData)
null.protected java.lang.Object loginViaRequest(javax.servlet.http.HttpServletRequest servletRequest)
null.
By default, calls loginUsernamePassword(String, String).protected abstract java.lang.Object loginUsernamePassword(java.lang.String username,
java.lang.String password)
true if login is successful, otherwise returns false.username - entered user name from login formpassword - entered raw passwordprotected abstract java.lang.String[] createCookieData(java.lang.Object userSession)
Copyright © 2003-2013 Jodd Team