Class LoginAction
java.lang.Object
com.opensymphony.xwork2.ActionSupport
org.conical.common.bbl.web.struts.actions.BaseAction
org.conical.common.bbl.web.struts.actions.LoginAction
- All Implemented Interfaces:
com.opensymphony.xwork2.Action
,com.opensymphony.xwork2.interceptor.ValidationAware
,com.opensymphony.xwork2.LocaleProvider
,com.opensymphony.xwork2.TextProvider
,com.opensymphony.xwork2.Validateable
,Serializable
,org.apache.struts2.interceptor.ServletRequestAware
,org.apache.struts2.interceptor.ServletResponseAware
Attempts to log user into the application using the authentication settings in
authentication.properties. A form submitting to this action should contain
the following parameters:
username: username
password: password for user
requestUrl: URL to return to after successful authentication
- Author:
- rdoherty
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.conical.common.bbl.web.struts.actions.BaseAction
BaseAction.Developer
-
Field Summary
Fields inherited from class org.conical.common.bbl.web.struts.actions.BaseAction
PERMISSION_DENIED
Fields inherited from class com.opensymphony.xwork2.ActionSupport
container
Fields inherited from interface com.opensymphony.xwork2.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
It is assumed that if user needs to log in, user is not logged in; returns false.doWork()
Attempts to log user into the application using the authentication settings in authentication.properties.protected List<javax.servlet.http.Cookie>
Returns any additional cookies child action wishes to set.If authentication fails, this message will tell the user what happenedReturns password originally passed inOverrides BaseAction.getRequestUrl() to return the page originally requested.Returns user name originally passed instatic void
setCurrentUser
(User user) void
setPassword
(String password) Sets password sent from formvoid
setRequestUrl
(String requestUrl) Allows pages to set the "original" request URL when they go to a login page.void
setUsername
(String username) Sets user name sent from formMethods inherited from class org.conical.common.bbl.web.struts.actions.BaseAction
addCookie, doAutoLogin, execute, getApplicationName, getApplicationProperties, getCookies, getCurrentUser, getDeveloper, getEthnicities, getHandednesses, getNameSuffixes, getRaces, getReligions, getRequiredAccessRoles, getSession, getSexes, getSexualOrientations, getStates, setServletRequest, setServletResponse
Methods inherited from class com.opensymphony.xwork2.ActionSupport
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, getActionErrors, getActionMessages, getContainer, getFieldErrors, getFormatted, getLocale, getLocaleProvider, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTextProvider, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, isValidLocale, isValidLocaleString, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors, validate
-
Constructor Details
-
LoginAction
public LoginAction()
-
-
Method Details
-
actionRequiresLogin
protected boolean actionRequiresLogin()It is assumed that if user needs to log in, user is not logged in; returns false.- Specified by:
actionRequiresLogin
in classBaseAction
- Returns:
- false
-
doWork
Attempts to log user into the application using the authentication settings in authentication.properties.- Specified by:
doWork
in classBaseAction
- Returns:
- success if able to log user in, else input
- Throws:
Exception
- if something goes wrong
-
setCurrentUser
-
getAdditionalCookies
Returns any additional cookies child action wishes to set. Default behavior is to return an empty list.- Returns:
- list of cookies to set upon successful login
-
getMessage
If authentication fails, this message will tell the user what happened- Returns:
- user message
-
setUsername
Sets user name sent from form- Parameters:
username
-
-
getUsername
Returns user name originally passed in- Returns:
- original user name
-
setPassword
Sets password sent from form- Parameters:
password
-
-
getPassword
Returns password originally passed in- Returns:
- original password
-
setRequestUrl
Allows pages to set the "original" request URL when they go to a login page. By submitting this value with the login form values, they can redirect to the original page once user is logged in. Note that if user originally goes to the login page, a nasty loop occurs; also, POST requests are not supported, so parameters will be lost and a GET to the original page will be performed, which may produce errors depending on your implementation.- Parameters:
requestUrl
- original request URL
-
getRequestUrl
Overrides BaseAction.getRequestUrl() to return the page originally requested. SeesetRequestUrl()
for limitations.- Overrides:
getRequestUrl
in classBaseAction
- Returns:
- original request URL, or, if not set, the URL of this request
-