-<%-- If you don't want to encrypt passwords programmatically, or you don't
- care about using SSL for the login, you can change this form's action
- to "j_security_check" --%>
-"
- onsubmit="saveUsername(this);return validateForm(this)">
-
-<%-- If you don't want to encrypt passwords programmatically, or you don't
- care about using SSL for the login, you can change this form's action
- to "j_security_check" --%>
-"
- onsubmit="saveUsername(this);return validateForm(this)">
-
- *
- * @author Matt Raible
- */
-public final class Constants {
- //~ Static fields/initializers =============================================
-
- /** The name of the ResourceBundle used in this application */
- public static final String BUNDLE_KEY = "ApplicationResources";
-
- /** The application scoped attribute for persistence engine used */
- public static final String DAO_TYPE = "daoType";
- public static final String DAO_TYPE_HIBERNATE = "hibernate";
-
- /** Application scoped attribute for authentication url */
- public static final String AUTH_URL = "authURL";
-
- /** Application scoped attributes for SSL Switching */
- public static final String HTTP_PORT = "httpPort";
- public static final String HTTPS_PORT = "httpsPort";
-
- /** The application scoped attribute for indicating a secure login */
- public static final String SECURE_LOGIN = "secureLogin";
-
- /** The encryption algorithm key to be used for passwords */
- public static final String ENC_ALGORITHM = "algorithm";
-
- /** A flag to indicate if passwords should be encrypted */
- public static final String ENCRYPT_PASSWORD = "encryptPassword";
-
- /** File separator from System properties */
- public static final String FILE_SEP = System.getProperty("file.separator");
-
- /** User home from System properties */
- public static final String USER_HOME =
- System.getProperty("user.home") + FILE_SEP;
-
- /**
- * The session scope attribute under which the breadcrumb ArrayStack is
- * stored
- */
- public static final String BREADCRUMB = "breadcrumbs";
-
- /**
- * The session scope attribute under which the User object for the
- * currently logged in user is stored.
- */
- public static final String USER_KEY = "currentUserForm";
-
- /**
- * The request scope attribute under which an editable user form is stored
- */
- public static final String USER_EDIT_KEY = "userForm";
-
- /**
- * The request scope attribute that holds the user list
- */
- public static final String USER_LIST = "userList";
-
- /**
- * The request scope attribute for indicating a newly-registered user
- */
- public static final String REGISTERED = "registered";
-
- /**
- * The name of the Administrator role, as specified in web.xml
- */
- public static final String ADMIN_ROLE = "admin";
-
- /**
- * The name of the User role, as specified in web.xml
- */
- public static final String USER_ROLE = "user";
-
- /**
- * The name of the user's role list, a request-scoped attribute
- * when adding/editing a user.
- */
- public static final String USER_ROLES = "userRoles";
-
- /**
- * The name of the available roles list, a request-scoped attribute
- * when adding/editing a user.
- */
- public static final String AVAILABLE_ROLES = "availableRoles";
-
- /**
- * Name of cookie for "Remember Me" functionality.
- */
- public static final String LOGIN_COOKIE = "sessionId";
-
- /**
- * The name of the configuration hashmap stored in application scope.
- */
- public static final String CONFIG = "appConfig";
-}
+package org.appfuse;
+
+
+/**
+ * Constant values used throughout the application.
+ *
+ *
+ *
+ * @author Matt Raible
+ * Modified by Dan Kibler
+ *
+ * @struts.action name="userForm" path="/users" scope="request"
+ * validate="false" parameter="method" input="mainMenu" roles="admin"
+ * @struts.action name="userForm" path="/editUser" scope="request"
+ * validate="false" parameter="method" input="list" roles="admin"
+ * @struts.action name="userForm" path="/editProfile" scope="request"
+ * validate="false" parameter="method" input="mainMenu"
+ * @struts.action name="userForm" path="/saveUser" scope="request"
+ * validate="false" parameter="method" input="edit"
+ *
+ * @struts.action-forward name="list" path="/WEB-INF/pages/userList.jsp"
+ * @struts.action-forward name="edit" path="/WEB-INF/pages/userProfile.jsp"
+ */
+public final class UserAction extends BaseAction {
+
+ public ActionForward add(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+ if (log.isDebugEnabled()) {
+ log.debug("Entering 'add' method");
+ }
+
+ User user = new User();
+ user.addRole(new Role(Constants.USER_ROLE));
+ UserForm userForm = (UserForm) convert(user);
+ updateFormBean(mapping, request, userForm);
+
+ checkForRememberMeLogin(request);
+
+ return mapping.findForward("edit");
+ }
+
+ public ActionForward cancel(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+ if (log.isDebugEnabled()) {
+ log.debug("Entering 'cancel' method");
+ }
+
+ if (!StringUtils.equals(request.getParameter("from"), "list")) {
+ return mapping.findForward("mainMenu");
+ } else {
+ return mapping.findForward("viewUsers");
+ }
+ }
+
+ public ActionForward delete(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+ if (log.isDebugEnabled()) {
+ log.debug("Entering 'delete' method");
+ }
+
+ // Extract attributes and parameters we will need
+ ActionMessages messages = new ActionMessages();
+ UserForm userForm = (UserForm) form;
+
+ // Exceptions are caught by ActionExceptionHandler
+ UserManager mgr = (UserManager) getBean("userManager");
+ mgr.removeUser(userForm.getUsername());
+
+ messages.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("user.deleted", userForm.getFirstName()
+ + ' ' + userForm.getLastName()));
+
+ saveMessages(request.getSession(), messages);
+
+ // return a forward to searching users
+ return mapping.findForward("viewUsers");
+ }
+
+ public ActionForward edit(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+ if (log.isDebugEnabled()) {
+ log.debug("Entering 'edit' method");
+ }
+
+ UserForm userForm = (UserForm) form;
+ HttpSession session = request.getSession();
+
+ // if URL is "editProfile" - make sure it's the current user
+ if (request.getRequestURI().indexOf("editProfile") > -1) {
+ // reject if username passed in or "list" parameter passed in
+ // someone that is trying this probably knows the AppFuse code
+ // but it's a legitimate bug, so I'll fix it. ;-)
+ if ((request.getParameter("username") != null) ||
+ (request.getParameter("from") != null)) {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ log.warn("User '" + request.getRemoteUser() +
+ "' is trying to edit user '" +
+ request.getParameter("username") + "'");
+
+ return null;
+ }
+ }
+
+ // Exceptions are caught by ActionExceptionHandler
+ UserManager mgr = (UserManager) getBean("userManager");
+ User user = null;
+
+ // if a user's username is passed in
+ if (request.getParameter("username") != null) {
+ // lookup the user using that id
+ user = mgr.getUser(userForm.getUsername());
+ } else {
+ // look it up based on the current user's id
+ user = mgr.getUser(getUser(session).getUsername());
+ }
+
+ BeanUtils.copyProperties(userForm, convert(user));
+ userForm.setConfirmPassword(userForm.getPassword());
+ updateFormBean(mapping, request, userForm);
+
+ checkForRememberMeLogin(request);
+
+ // return a forward to edit forward
+ return mapping.findForward("edit");
+ }
+
+ public ActionForward save(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+ if (log.isDebugEnabled()) {
+ log.debug("Entering 'save' method");
+ }
+
+ // run validation rules on this form
+ // See https://appfuse.dev.java.net/issues/show_bug.cgi?id=128
+ ActionMessages errors = form.validate(mapping, request);
+
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ return mapping.findForward("edit");
+ }
+
+ // Extract attributes and parameters we will need
+ ActionMessages messages = new ActionMessages();
+ HttpSession session = request.getSession();
+ UserForm userForm = (UserForm) form;
+ String password = userForm.getPassword();
+ User user = new User();
+
+ // Exceptions are caught by ActionExceptionHandler
+ // all we need to persist is the parent object
+ BeanUtils.copyProperties(user, userForm);
+
+ Boolean encrypt = (Boolean) getConfiguration().get(Constants.ENCRYPT_PASSWORD);
+
+ if (StringUtils.equals(request.getParameter("encryptPass"), "true")
+ && (encrypt != null && encrypt.booleanValue())) {
+ String algorithm = (String) getConfiguration().get(Constants.ENC_ALGORITHM);
+
+ if (algorithm == null) { // should only happen for test case
+ log.debug("assuming testcase, setting algorithm to 'SHA'");
+ algorithm = "SHA";
+ }
+
+ user.setPassword(StringUtil.encodePassword(user.getPassword(), algorithm));
+ }
+
+ UserManager mgr = (UserManager) getBean("userManager");
+ RoleManager roleMgr = (RoleManager) getBean("roleManager");
+ String[] userRoles = request.getParameterValues("userRoles");
+
+ for (int i = 0; userRoles != null && i < userRoles.length; i++) {
+ String roleName = userRoles[i];
+ user.addRole(roleMgr.getRole(roleName));
+ }
+
+ try {
+ mgr.saveUser(user);
+ } catch (UserExistsException e) {
+ log.warn(e.getMessage());
+ errors.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("errors.existing.user",
+ userForm.getUsername(),
+ userForm.getEmail()));
+ saveErrors(request, errors);
+
+ return mapping.findForward("edit");
+ }
+
+ BeanUtils.copyProperties(userForm, convert(user));
+ userForm.setConfirmPassword(userForm.getPassword());
+ updateFormBean(mapping, request, userForm);
+
+ if (!StringUtils.equals(request.getParameter("from"), "list")) {
+ session.setAttribute(Constants.USER_KEY, user);
+
+ // add success messages
+ messages.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("user.saved"));
+ saveMessages(request.getSession(), messages);
+
+ // return a forward to main Menu
+ return mapping.findForward("mainMenu");
+ } else {
+ // add success messages
+ if ("".equals(request.getParameter("version"))) {
+ messages.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("user.added", user.getFullName()));
+ saveMessages(request.getSession(), messages);
+ sendNewUserEmail(request, userForm);
+
+ return mapping.findForward("addUser");
+ } else {
+ messages.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("user.updated.byAdmin",
+ user.getFullName()));
+ saveMessages(request, messages);
+
+ return mapping.findForward("edit");
+ }
+ }
+ }
+
+ public ActionForward search(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+ if (log.isDebugEnabled()) {
+ log.debug("Entering 'search' method");
+ }
+
+ UserForm userForm = (UserForm) form;
+
+ // Exceptions are caught by ActionExceptionHandler
+ UserManager mgr = (UserManager) getBean("userManager");
+ User user = (User) convert(userForm);
+ List users = mgr.getUsers(user);
+ request.setAttribute(Constants.USER_LIST, users);
+
+ // return a forward to the user list definition
+ return mapping.findForward("list");
+ }
+
+ public ActionForward unspecified(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
+
+ return search(mapping, form, request, response);
+ }
+
+ private void sendNewUserEmail(HttpServletRequest request, UserForm userForm)
+ throws Exception {
+ MessageResources resources = getResources(request);
+
+ // Send user an e-mail
+ if (log.isDebugEnabled()) {
+ log.debug("Sending user '" + userForm.getUsername() +
+ "' an account information e-mail");
+ }
+
+ SimpleMailMessage message = (SimpleMailMessage) getBean("mailMessage");
+ message.setTo(userForm.getFullName() + "<" + userForm.getEmail() + ">");
+
+ StringBuffer msg = new StringBuffer();
+ msg.append(resources.getMessage("newuser.email.message",
+ userForm.getFullName()));
+ msg.append("\n\n" + resources.getMessage("userForm.username"));
+ msg.append(": " + userForm.getUsername() + "\n");
+ msg.append(resources.getMessage("userForm.password") + ": ");
+ msg.append(userForm.getPassword());
+ msg.append("\n\nLogin at: " + RequestUtil.getAppURL(request));
+ message.setText(msg.toString());
+
+ message.setSubject(resources.getMessage("signup.email.subject"));
+
+ MailEngine engine = (MailEngine) getBean("mailEngine");
+ engine.send(message);
+ }
+
+ private void checkForRememberMeLogin(HttpServletRequest request) {
+ // if user logged in with remember me, display a warning that they can't change passwords
+ log.debug("checking for remember me login...");
+
+ AuthenticationTrustResolver resolver = new AuthenticationTrustResolverImpl();
+ SecureContext ctx = (SecureContext) ContextHolder.getContext();
+
+ if (ctx != null) {
+ Authentication auth = ctx.getAuthentication();
+
+ if (resolver.isRememberMe(auth)) {
+ request.getSession().setAttribute("cookieLogin", "true");
+
+ // add warning message
+ ActionMessages messages = new ActionMessages();
+ messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("userProfile.cookieLogin"));
+ saveMessages(request, messages);
+ }
+ }
+ }
+}
Index: src/web/org/appfuse/webapp/filter/ActionFilter.java
===================================================================
RCS file: /cvs/appfuse/src/web/org/appfuse/webapp/filter/ActionFilter.java,v
retrieving revision 1.13
diff -u -r1.13 ActionFilter.java
--- src/web/org/appfuse/webapp/filter/ActionFilter.java 16 Apr 2005 22:17:21 -0000 1.13
+++ src/web/org/appfuse/webapp/filter/ActionFilter.java 28 Aug 2005 22:45:22 -0000
@@ -18,8 +18,6 @@
import org.appfuse.Constants;
import org.appfuse.model.User;
import org.appfuse.service.UserManager;
-import org.appfuse.webapp.util.RequestUtil;
-import org.appfuse.webapp.util.SslUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.context.support.WebApplicationContextUtils;
@@ -36,23 +34,13 @@
* @version $Revision: 1.13 $ $Date: 2005/04/16 22:17:21 $
*
* @web.filter display-name="Action Filter" name="actionFilter"
- *
- *
Change this value to true if you want to secure your entire application.
- * This can also be done in web-security.xml by setting
- * to CONFIDENTIAL.
- *
- * @web.filter-init-param name="isSecure" value="${secure.application}"
*/
public class ActionFilter implements Filter {
- private static Boolean secure = Boolean.FALSE;
- private final transient Log log = LogFactory.getLog(ActionFilter.class);
+ private final Log log = LogFactory.getLog(ActionFilter.class);
private FilterConfig config = null;
public void init(FilterConfig config) throws ServletException {
this.config = config;
-
- /* This determines if the application uconn SSL or not */
- secure = Boolean.valueOf(config.getInitParameter("isSecure"));
}
/**
@@ -68,31 +56,12 @@
// cast to the types I want to use
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
- HttpSession session = request.getSession(true);
+ HttpSession session = request.getSession();
// notify the LocaleContextHolder what locale is being used so
// service and data layer classes can get the locale
LocaleContextHolder.setLocale(request.getLocale());
- // do pre filter work here
- // If using https, switch to http
- String redirectString =
- SslUtil.getRedirectString(request, config.getServletContext(),
- secure.booleanValue());
-
- if (redirectString != null) {
- if (log.isDebugEnabled()) {
- log.debug("protocol switch needed, redirecting to '" +
- redirectString + "'");
- }
-
- // Redirect the page to the desired URL
- response.sendRedirect(response.encodeRedirectURL(redirectString));
-
- // ensure we don't chain to requested resource
- return;
- }
-
User user = (User) session.getAttribute(Constants.USER_KEY);
ServletContext context = config.getServletContext();
String username = request.getRemoteUser();
@@ -105,15 +74,6 @@
UserManager mgr = (UserManager) ctx.getBean("userManager");
user = mgr.getUser(username);
session.setAttribute(Constants.USER_KEY, user);
-
- // if user wants to be remembered, create a remember me cookie
- if (session.getAttribute(Constants.LOGIN_COOKIE) != null) {
- session.removeAttribute(Constants.LOGIN_COOKIE);
-
- String loginCookie = mgr.createLoginCookie(username);
- RequestUtil.setCookie(response, Constants.LOGIN_COOKIE,
- loginCookie, request.getContextPath());
- }
}
chain.doFilter(request, response);
Index: src/web/org/appfuse/webapp/listener/StartupListener.java
===================================================================
RCS file: /cvs/appfuse/src/web/org/appfuse/webapp/listener/StartupListener.java,v
retrieving revision 1.10
diff -u -r1.10 StartupListener.java
--- src/web/org/appfuse/webapp/listener/StartupListener.java 4 Oct 2004 08:10:58 -0000 1.10
+++ src/web/org/appfuse/webapp/listener/StartupListener.java 28 Aug 2005 23:09:41 -0000
@@ -1,16 +1,23 @@
package org.appfuse.webapp.listener;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
+import net.sf.acegisecurity.providers.AuthenticationProvider;
+import net.sf.acegisecurity.providers.ProviderManager;
+import net.sf.acegisecurity.providers.encoding.Md5PasswordEncoder;
+import net.sf.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.appfuse.Constants;
import org.appfuse.service.LookupManager;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;
@@ -42,7 +49,7 @@
// if daoType is not specified, use DAO as default
if (daoType == null) {
- log.warn("No 'daoType' context carameter, using hibernate");
+ log.warn("No 'daoType' context parameter, using Hibernate");
daoType = Constants.DAO_TYPE_HIBERNATE;
}
@@ -56,12 +63,44 @@
// Create a config object to hold all the app config values
config.put(Constants.DAO_TYPE, daoType);
+
+ ApplicationContext ctx =
+ WebApplicationContextUtils.getRequiredWebApplicationContext(context);
+
+ boolean encryptPassword = false;
+ try {
+ ProviderManager provider = (ProviderManager) ctx.getBean("authenticationManager");
+ for (Iterator it = provider.getProviders().iterator(); it.hasNext();) {
+ AuthenticationProvider p = (AuthenticationProvider) it.next();
+ if (p instanceof RememberMeAuthenticationProvider) {
+ config.put("rememberMeEnabled", Boolean.TRUE);
+ }
+ }
+
+ if (ctx.containsBean("passwordEncoder")) {
+ encryptPassword = true;
+ config.put(Constants.ENCRYPT_PASSWORD, Boolean.TRUE);
+ String algorithm = "SHA";
+ if (ctx.getBean("passwordEncoder") instanceof Md5PasswordEncoder) {
+ algorithm = "MD5";
+ }
+ config.put(Constants.ENC_ALGORITHM, algorithm);
+ }
+ } catch (NoSuchBeanDefinitionException n) {
+ // ignore, should only happen when testing
+ }
+
context.setAttribute(Constants.CONFIG, config);
// output the retrieved values for the Init and Context Parameters
if (log.isDebugEnabled()) {
- log.debug("daoType: " + daoType);
- log.debug("populating drop-downs...");
+ log.debug("Persistence Framework: " + daoType);
+ log.debug("Remember Me Enabled? " + config.get("rememberMeEnabled"));
+ log.debug("Encrypt Passwords? " + encryptPassword);
+ if (encryptPassword) {
+ log.debug("Encryption Algorithm: " + config.get(Constants.ENC_ALGORITHM));
+ }
+ log.debug("Populating drop-downs...");
}
setupContext(context);
@@ -77,7 +116,7 @@
context.setAttribute(Constants.AVAILABLE_ROLES, mgr.getAllRoles());
if (log.isDebugEnabled()) {
- log.debug("drop-down initialization complete [OK]");
+ log.debug("Drop-down initialization complete [OK]");
}
}
}
Index: src/web/org/appfuse/webapp/util/RequestUtil.java
===================================================================
RCS file: /cvs/appfuse/src/web/org/appfuse/webapp/util/RequestUtil.java,v
retrieving revision 1.7
diff -u -r1.7 RequestUtil.java
--- src/web/org/appfuse/webapp/util/RequestUtil.java 30 Sep 2004 04:41:19 -0000 1.7
+++ src/web/org/appfuse/webapp/util/RequestUtil.java 28 Aug 2005 21:27:43 -0000
@@ -1,13 +1,5 @@
package org.appfuse.webapp.util;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -17,133 +9,10 @@
/**
- * RequestUtil utility class Good ol' copy-n-paste from
- * http://www.javaworld.com/javaworld/jw-02-2002/ssl/utilityclass.txt
- * which is referenced in the following article:
- * http://www.javaworld.com/javaworld/jw-02-2002/jw-0215-ssl.html
+ * Convenience class for setting and retrieving cookies.
*/
public class RequestUtil {
- private static final String STOWED_REQUEST_ATTRIBS = "ssl.redirect.attrib.stowed";
private transient static Log log = LogFactory.getLog(RequestUtil.class);
-
- /**
- * Creates query String from request body parameters
- */
- public static String getRequestParameters(HttpServletRequest aRequest) {
- // set the ALGORIGTHM as defined for the application
- //ALGORITHM = (String) aRequest.getAttribute(Constants.ENC_ALGORITHM);
- Map m = aRequest.getParameterMap();
-
- return createQueryStringFromMap(m, "&").toString();
- }
-
- /**
- * Builds a query string from a given map of parameters
- *
- * @param m A map of parameters
- * @param ampersand String to use for ampersands (e.g. "&" or "&" )
- *
- * @return query string (with no leading "?")
- */
- public static StringBuffer createQueryStringFromMap(Map m, String ampersand) {
- StringBuffer aReturn = new StringBuffer("");
- Set aEntryS = m.entrySet();
- Iterator aEntryI = aEntryS.iterator();
-
- while (aEntryI.hasNext()) {
- Map.Entry aEntry = (Map.Entry) aEntryI.next();
- Object o = aEntry.getValue();
-
- if (o == null) {
- append(aEntry.getKey(), "", aReturn, ampersand);
- } else if (o instanceof String) {
- append(aEntry.getKey(), o, aReturn, ampersand);
- } else if (o instanceof String[]) {
- String[] aValues = (String[]) o;
-
- for (int i = 0; i < aValues.length; i++) {
- append(aEntry.getKey(), aValues[i], aReturn, ampersand);
- }
- } else {
- append(aEntry.getKey(), o, aReturn, ampersand);
- }
- }
-
- return aReturn;
- }
-
- /**
- * Appends new key and value pair to query string
- *
- * @param key parameter name
- * @param value value of parameter
- * @param queryString existing query string
- * @param ampersand string to use for ampersand (e.g. "&" or "&")
- *
- * @return query string (with no leading "?")
- */
- private static StringBuffer append(Object key, Object value,
- StringBuffer queryString,
- String ampersand) {
- if (queryString.length() > 0) {
- queryString.append(ampersand);
- }
-
- try {
- queryString.append(URLEncoder.encode(key.toString(), "UTF-8"));
- queryString.append("=");
- queryString.append(URLEncoder.encode(value.toString(), "UTF-8"));
- } catch (UnsupportedEncodingException e) {
- // won't happen since we're hard-coding UTF-8
- }
- return queryString;
- }
-
- /**
- * Stores request attributes in session
- *
- * @param aRequest the current request
- */
- public static void stowRequestAttributes(HttpServletRequest aRequest) {
- if (aRequest.getSession().getAttribute(STOWED_REQUEST_ATTRIBS) != null) {
- return;
- }
-
- Enumeration e = aRequest.getAttributeNames();
- Map map = new HashMap();
-
- while (e.hasMoreElements()) {
- String name = (String) e.nextElement();
- map.put(name, aRequest.getAttribute(name));
- }
-
- aRequest.getSession().setAttribute(STOWED_REQUEST_ATTRIBS, map);
- }
-
- /**
- * Returns request attributes from session to request
- *
- * @param aRequest DOCUMENT ME!
- */
- public static void reclaimRequestAttributes(HttpServletRequest aRequest) {
- Map map =
- (Map) aRequest.getSession().getAttribute(STOWED_REQUEST_ATTRIBS);
-
- if (map == null) {
- return;
- }
-
- Iterator itr = map.keySet().iterator();
-
- while (itr.hasNext()) {
- String name = (String) itr.next();
- aRequest.setAttribute(name, map.get(name));
- }
-
- aRequest.getSession().removeAttribute(STOWED_REQUEST_ATTRIBS);
- }
/**
* Convenience method to set a cookie
Index: test/dao/org/appfuse/dao/UserDAOTest.java
===================================================================
RCS file: /cvs/appfuse/test/dao/org/appfuse/dao/UserDAOTest.java,v
retrieving revision 1.10
diff -u -r1.10 UserDAOTest.java
--- test/dao/org/appfuse/dao/UserDAOTest.java 23 Aug 2005 10:12:46 -0000 1.10
+++ test/dao/org/appfuse/dao/UserDAOTest.java 28 Aug 2005 22:48:16 -0000
@@ -1,134 +1,116 @@
-package org.appfuse.dao;
-
-import org.appfuse.Constants;
-import org.appfuse.model.Address;
-import org.appfuse.model.Role;
-import org.appfuse.model.User;
-import org.appfuse.model.UserCookie;
-import org.springframework.dao.DataAccessException;
-import org.springframework.dao.DataIntegrityViolationException;
-
-public class UserDAOTest extends BaseDAOTestCase {
- private UserDAO dao = null;
- private User user = null;
- private RoleDAO rdao = null;
- private Role role = null;
-
- public void setUserDAO(UserDAO dao) {
- this.dao = dao;
- }
-
- public void setRoleDAO(RoleDAO rdao) {
- this.rdao = rdao;
- }
-
- public void testGetUserInvalid() throws Exception {
- try {
- user = dao.getUser("badusername");
- fail("'badusername' found in database, failing test...");
- } catch (DataAccessException d) {
- assertTrue(d != null);
- }
- }
-
- public void testGetUser() throws Exception {
- user = dao.getUser("tomcat");
-
- assertNotNull(user);
- assertEquals(1, user.getRoles().size());
- }
-
- public void testUpdateUser() throws Exception {
- user = dao.getUser("tomcat");
-
- Address address = user.getAddress();
- address.setAddress("new address");
-
- dao.saveUser(user);
-
- assertEquals(user.getAddress(), address);
- assertEquals("new address", user.getAddress().getAddress());
-
- // verify that violation occurs when adding new user
- // with same username
- user.setVersion(null);
-
- try {
- dao.saveUser(user);
- fail("saveUser didn't throw DataIntegrityViolationException");
- } catch (DataIntegrityViolationException e) {
- assertNotNull(e);
- log.debug("expected exception: " + e.getMessage());
- }
-
- }
-
- public void testAddUserRole() throws Exception {
- user = dao.getUser("tomcat");
-
- assertEquals(1, user.getRoles().size());
-
- role = rdao.getRole(Constants.ADMIN_ROLE);
- user.addRole(role);
- dao.saveUser(user);
-
- assertEquals(2, user.getRoles().size());
-
- //add the same role twice - should result in no additional role
- user.addRole(role);
- dao.saveUser(user);
-
- assertEquals("more than 2 roles", 2, user.getRoles().size());
-
- user.getRoles().remove(role);
- dao.saveUser(user);
-
- assertEquals(1, user.getRoles().size());
- }
-
- public void testAddAndRemoveUser() throws Exception {
- user = new User("testuser");
- user.setPassword("testpass");
- user.setFirstName("Test");
- user.setLastName("Last");
- Address address = new Address();
- address.setCity("Denver");
- address.setProvince("CO");
- address.setCountry("USA");
- address.setPostalCode("80210");
- user.setAddress(address);
- user.setEmail("testuser@appfuse.org");
- user.setWebsite("http://raibledesigns.com");
- user.addRole(rdao.getRole(Constants.USER_ROLE));
-
- dao.saveUser(user);
-
- assertNotNull(user.getUsername());
- assertEquals("testpass", user.getPassword());
-
- dao.removeUser("testuser");
-
- try {
- user = dao.getUser("testuser");
- fail("getUser didn't throw DataAccessException");
- } catch (DataAccessException d) {
- assertNotNull(d);
- }
- }
-
- public void testSaveAndDeleteUserCookie() throws Exception {
- String cookieId = "BA67E786-C031-EA40-2769-863BB30B31EC";
- UserCookie cookie = new UserCookie();
- cookie.setUsername("tomcat");
- cookie.setCookieId(cookieId);
- dao.saveUserCookie(cookie);
- cookie = dao.getUserCookie(cookie);
- assertEquals(cookieId, cookie.getCookieId());
-
- dao.removeUserCookies(cookie.getUsername());
-
- cookie = dao.getUserCookie(cookie);
-
- assertNull(cookie);
- }
+package org.appfuse.dao;
+
+import org.appfuse.Constants;
+import org.appfuse.model.Address;
+import org.appfuse.model.Role;
+import org.appfuse.model.User;
+import org.springframework.dao.DataAccessException;
+import org.springframework.dao.DataIntegrityViolationException;
+
+public class UserDAOTest extends BaseDAOTestCase {
+ private UserDAO dao = null;
+ private User user = null;
+ private RoleDAO rdao = null;
+ private Role role = null;
+
+ public void setUserDAO(UserDAO dao) {
+ this.dao = dao;
+ }
+
+ public void setRoleDAO(RoleDAO rdao) {
+ this.rdao = rdao;
+ }
+
+ public void testGetUserInvalid() throws Exception {
+ try {
+ user = dao.getUser("badusername");
+ fail("'badusername' found in database, failing test...");
+ } catch (DataAccessException d) {
+ assertTrue(d != null);
+ }
+ }
+
+ public void testGetUser() throws Exception {
+ user = dao.getUser("tomcat");
+
+ assertNotNull(user);
+ assertEquals(1, user.getRoles().size());
+ }
+
+ public void testUpdateUser() throws Exception {
+ user = dao.getUser("tomcat");
+
+ Address address = user.getAddress();
+ address.setAddress("new address");
+
+ dao.saveUser(user);
+
+ assertEquals(user.getAddress(), address);
+ assertEquals("new address", user.getAddress().getAddress());
+
+ // verify that violation occurs when adding new user
+ // with same username
+ user.setVersion(null);
+
+ try {
+ dao.saveUser(user);
+ fail("saveUser didn't throw DataIntegrityViolationException");
+ } catch (DataIntegrityViolationException e) {
+ assertNotNull(e);
+ log.debug("expected exception: " + e.getMessage());
+ }
+ }
+
+ public void testAddUserRole() throws Exception {
+ user = dao.getUser("tomcat");
+
+ assertEquals(1, user.getRoles().size());
+
+ role = rdao.getRole(Constants.ADMIN_ROLE);
+ user.addRole(role);
+ dao.saveUser(user);
+
+ assertEquals(2, user.getRoles().size());
+
+ //add the same role twice - should result in no additional role
+ user.addRole(role);
+ dao.saveUser(user);
+
+ assertEquals("more than 2 roles", 2, user.getRoles().size());
+
+ user.getRoles().remove(role);
+ dao.saveUser(user);
+
+ assertEquals(1, user.getRoles().size());
+ }
+
+ public void testAddAndRemoveUser() throws Exception {
+ user = new User("testuser");
+ user.setPassword("testpass");
+ user.setFirstName("Test");
+ user.setLastName("Last");
+ Address address = new Address();
+ address.setCity("Denver");
+ address.setProvince("CO");
+ address.setCountry("USA");
+ address.setPostalCode("80210");
+ user.setAddress(address);
+ user.setEmail("testuser@appfuse.org");
+ user.setWebsite("http://raibledesigns.com");
+ user.addRole(rdao.getRole(Constants.USER_ROLE));
+
+ dao.saveUser(user);
+
+ assertNotNull(user.getUsername());
+ assertEquals("testpass", user.getPassword());
+
+ dao.removeUser("testuser");
+
+ try {
+ user = dao.getUser("testuser");
+ fail("getUser didn't throw DataAccessException");
+ } catch (DataAccessException d) {
+ assertNotNull(d);
+ }
+ }
}
Index: test/service/org/appfuse/service/UserManagerTest.java
===================================================================
RCS file: /cvs/appfuse/test/service/org/appfuse/service/UserManagerTest.java,v
retrieving revision 1.15
diff -u -r1.15 UserManagerTest.java
--- test/service/org/appfuse/service/UserManagerTest.java 28 Aug 2005 21:15:57 -0000 1.15
+++ test/service/org/appfuse/service/UserManagerTest.java 28 Aug 2005 21:40:22 -0000
@@ -1,154 +1,129 @@
-package org.appfuse.service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.appfuse.Constants;
-import org.appfuse.dao.RoleDAO;
-import org.appfuse.dao.UserDAO;
-import org.appfuse.model.Role;
-import org.appfuse.model.User;
-import org.appfuse.model.UserCookie;
-import org.appfuse.service.impl.RoleManagerImpl;
-import org.appfuse.service.impl.UserManagerImpl;
-import org.jmock.Mock;
-import org.springframework.dao.DataIntegrityViolationException;
-
-
-public class UserManagerTest extends BaseManagerTestCase {
- //~ Instance fields ========================================================
-
- private UserManager userManager = new UserManagerImpl();
- private RoleManager roleManager = new RoleManagerImpl();
- private Mock userDAO = null;
- private Mock roleDAO = null;
- private User user = null;
- private Role role = null;
-
- //~ Methods ================================================================
-
- protected void setUp() throws Exception {
- super.setUp();
- userDAO = new Mock(UserDAO.class);
- userManager.setUserDAO((UserDAO) userDAO.proxy());
- roleDAO = new Mock(RoleDAO.class);
- roleManager.setRoleDAO((RoleDAO) roleDAO.proxy());
- }
-
- public void testGetUser() throws Exception {
- User testData = new User("tomcat");
- testData.getRoles().add(new Role("user"));
- // set expected behavior on dao
- userDAO.expects(once()).method("getUser")
- .with(eq("tomcat")).will(returnValue(testData));
-
- user = userManager.getUser("tomcat");
- assertTrue(user != null);
- assertTrue(user.getRoles().size() == 1);
- userDAO.verify();
- }
-
- public void testSaveUser() throws Exception {
- User testData = new User("tomcat");
- testData.getRoles().add(new Role("user"));
- // set expected behavior on dao
- userDAO.expects(once()).method("getUser")
- .with(eq("tomcat")).will(returnValue(testData));
-
- user = userManager.getUser("tomcat");
- user.setPhoneNumber("303-555-1212");
- userDAO.verify();
-
- // reset expectations
- userDAO.reset();
- userDAO.expects(once()).method("saveUser").with(same(user));
-
- userManager.saveUser(user);
- assertTrue(user.getPhoneNumber().equals("303-555-1212"));
- assertTrue(user.getRoles().size() == 1);
- userDAO.verify();
- }
-
- public void testAddAndRemoveUser() throws Exception {
- user = new User();
-
- // call populate method in super class to populate test data
- // from a properties file matching this class name
- user = (User) populate(user);
-
- // set expected behavior on role dao
- roleDAO.expects(once()).method("getRole")
- .with(eq("user")).will(returnValue(new Role("user")));
-
- role = roleManager.getRole(Constants.USER_ROLE);
- roleDAO.verify();
- user.addRole(role);
-
- // set expected behavior on user dao
- userDAO.expects(once()).method("saveUser").with(same(user));
-
- userManager.saveUser(user);
- assertTrue(user.getUsername().equals("john"));
- assertTrue(user.getRoles().size() == 1);
- userDAO.verify();
-
- // reset expectations
- userDAO.reset();
-
- userDAO.expects(once()).method("removeUser").with(eq(user.getUsername()));
- userManager.removeUser(user.getUsername());
- userDAO.verify();
-
- // reset expectations
- userDAO.reset();
- userDAO.expects(once()).method("getUser").will(returnValue(null));
- user = userManager.getUser("john");
- assertNull(user);
- userDAO.verify();
- }
-
- public void testLoginWithCookie() {
- // set expectations
- userDAO.expects(once()).method("saveUserCookie");
-
- String cookieString = userManager.createLoginCookie("tomcat");
-
- assertNotNull(cookieString);
- userDAO.verify();
-
- // reset expectations
- userDAO.expects(once()).method("getUserCookie").will(returnValue(new UserCookie()));
- // lookup succeeds, save will be called to generate a new one
- userDAO.expects(once()).method("saveUserCookie");
- String newCookie = userManager.checkLoginCookie(cookieString);
- assertNotNull(newCookie);
- userDAO.verify();
-
- // reset expectations
- userDAO.expects(once()).method("getUserCookie").will(returnValue(null));
- newCookie = userManager.checkLoginCookie(cookieString);
- assertNull(newCookie);
- userDAO.verify();
- }
-
- public void testUserExistsException() {
- // set expectations
- user = new User("admin");
- user.setEmail("matt@raibledesigns.com");
- List users = new ArrayList();
-
- users.add(user);
- Exception ex = new DataIntegrityViolationException("");
- userDAO.expects(once()).method("saveUser").with(same(user))
- .will(throwException(ex));
-
- // run test
- try {
- userManager.saveUser(user);
- fail("Expected UserExistsException not thrown");
- } catch (UserExistsException e) {
- log.debug("expected exception: " + e.getMessage());
- assertNotNull(e);
- }
- }
-}
+package org.appfuse.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.appfuse.Constants;
+import org.appfuse.dao.RoleDAO;
+import org.appfuse.dao.UserDAO;
+import org.appfuse.model.Role;
+import org.appfuse.model.User;
+import org.appfuse.service.impl.RoleManagerImpl;
+import org.appfuse.service.impl.UserManagerImpl;
+import org.jmock.Mock;
+import org.springframework.dao.DataIntegrityViolationException;
+
+
+public class UserManagerTest extends BaseManagerTestCase {
+ //~ Instance fields ========================================================
+
+ private UserManager userManager = new UserManagerImpl();
+ private RoleManager roleManager = new RoleManagerImpl();
+ private Mock userDAO = null;
+ private Mock roleDAO = null;
+ private User user = null;
+ private Role role = null;
+
+ //~ Methods ================================================================
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ userDAO = new Mock(UserDAO.class);
+ userManager.setUserDAO((UserDAO) userDAO.proxy());
+ roleDAO = new Mock(RoleDAO.class);
+ roleManager.setRoleDAO((RoleDAO) roleDAO.proxy());
+ }
+
+ public void testGetUser() throws Exception {
+ User testData = new User("tomcat");
+ testData.getRoles().add(new Role("user"));
+ // set expected behavior on dao
+ userDAO.expects(once()).method("getUser")
+ .with(eq("tomcat")).will(returnValue(testData));
+
+ user = userManager.getUser("tomcat");
+ assertTrue(user != null);
+ assertTrue(user.getRoles().size() == 1);
+ userDAO.verify();
+ }
+
+ public void testSaveUser() throws Exception {
+ User testData = new User("tomcat");
+ testData.getRoles().add(new Role("user"));
+ // set expected behavior on dao
+ userDAO.expects(once()).method("getUser")
+ .with(eq("tomcat")).will(returnValue(testData));
+
+ user = userManager.getUser("tomcat");
+ user.setPhoneNumber("303-555-1212");
+ userDAO.verify();
+
+ // reset expectations
+ userDAO.reset();
+ userDAO.expects(once()).method("saveUser").with(same(user));
+
+ userManager.saveUser(user);
+ assertTrue(user.getPhoneNumber().equals("303-555-1212"));
+ assertTrue(user.getRoles().size() == 1);
+ userDAO.verify();
+ }
+
+ public void testAddAndRemoveUser() throws Exception {
+ user = new User();
+
+ // call populate method in super class to populate test data
+ // from a properties file matching this class name
+ user = (User) populate(user);
+
+ // set expected behavior on role dao
+ roleDAO.expects(once()).method("getRole")
+ .with(eq("user")).will(returnValue(new Role("user")));
+
+ role = roleManager.getRole(Constants.USER_ROLE);
+ roleDAO.verify();
+ user.addRole(role);
+
+ // set expected behavior on user dao
+ userDAO.expects(once()).method("saveUser").with(same(user));
+
+ userManager.saveUser(user);
+ assertTrue(user.getUsername().equals("john"));
+ assertTrue(user.getRoles().size() == 1);
+ userDAO.verify();
+
+ // reset expectations
+ userDAO.reset();
+
+ userDAO.expects(once()).method("removeUser").with(eq(user.getUsername()));
+ userManager.removeUser(user.getUsername());
+ userDAO.verify();
+
+ // reset expectations
+ userDAO.reset();
+ userDAO.expects(once()).method("getUser").will(returnValue(null));
+ user = userManager.getUser("john");
+ assertNull(user);
+ userDAO.verify();
+ }
+
+ public void testUserExistsException() {
+ // set expectations
+ user = new User("admin");
+ user.setEmail("matt@raibledesigns.com");
+ List users = new ArrayList();
+
+ users.add(user);
+ Exception ex = new DataIntegrityViolationException("");
+ userDAO.expects(once()).method("saveUser").with(same(user))
+ .will(throwException(ex));
+
+ // run test
+ try {
+ userManager.saveUser(user);
+ fail("Expected UserExistsException not thrown");
+ } catch (UserExistsException e) {
+ log.debug("expected exception: " + e.getMessage());
+ assertNotNull(e);
+ }
+ }
+}
Index: test/web/web-tests.xml
===================================================================
RCS file: /cvs/appfuse/test/web/web-tests.xml,v
retrieving revision 1.30
diff -u -r1.30 web-tests.xml
--- test/web/web-tests.xml 28 Aug 2005 21:15:58 -0000 1.30
+++ test/web/web-tests.xml 29 Aug 2005 00:34:58 -0000
@@ -1,236 +1,234 @@
-
-
-
-
-
-]>
-
-
-
-
-
-
-
-
-
-
- Successfully ran all User JSP tests!
-
-
-
-
-
- &config;
-
- &login;
-
-
-
-
-
-
-
- &config;
-
- &login;
-
-
-
-
-
-
-
-
-
- &config;
-
-
-
-
-
-
-
-
-
-
-
-
- &config;
-
- &login;
-
-
-
-
-
-
-
-
-
- &config;
-
- &login;
-
-
-
-
-
-
-
-
-
- &config;
-
- &login;
-
-
-
-
-
-
-
-
-
-
-
-
-
- &config;
-
- &login;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- &config;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- &config;
-
- &login;
-
-
-
-
-
-
-
-
-
- &config;
-
- &login;
-
-
-
-
-
-
-
-
-
- &config;
-
- &login;
-
-
-
-
-
-
-
+
+
+
+
+
+]>
+
+
+
+
+
+
+
+
+
+
+ Successfully ran all User JSP tests!
+
+
+
+
+
+ &config;
+
+ &login;
+
+
+
+
+
+
+
+ &config;
+
+ &login;
+
+
+
+
+
+
+
+
+
+ &config;
+
+
+
+
+
+
+
+
+
+
+
+
+ &config;
+
+ &login;
+
+
+
+
+
+
+
+
+
+ &config;
+
+ &login;
+
+
+
+
+
+
+
+
+
+ &config;
+
+ &login;
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &config;
+
+ &login;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &config;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &config;
+
+ &login;
+
+
+
+
+
+
+
+
+
+ &config;
+
+ &login;
+
+
+
+
+
+
+
+
+
+ &config;
+
+ &login;
+
+
+
+
+
+
+
Index: web/index.jsp
===================================================================
RCS file: /cvs/appfuse/web/index.jsp,v
retrieving revision 1.5
diff -u -r1.5 index.jsp
--- web/index.jsp 18 Oct 2004 17:05:33 -0000 1.5
+++ web/index.jsp 28 Aug 2005 21:43:25 -0000
@@ -1,14 +1,4 @@
<%@ include file="/common/taglibs.jsp"%>
-<%--
-You can use this logic if you're running your app on 80 & 443,
-but IE seems to have issues when running on non-standard ports
-and spits up a Server Not Found error
---%>
-
-
-
-
-
Index: web/logout.jsp
===================================================================
RCS file: /cvs/appfuse/web/logout.jsp,v
retrieving revision 1.5
diff -u -r1.5 logout.jsp
--- web/logout.jsp 23 Mar 2005 19:00:39 -0000 1.5
+++ web/logout.jsp 28 Aug 2005 21:53:30 -0000
@@ -1,5 +1,13 @@
-<%@ include file="/common/taglibs.jsp"%>
-
-<% session.invalidate(); %>
-
-
+<%@ include file="/common/taglibs.jsp"%>
+<%@ page import="javax.servlet.http.Cookie" %>
+<%@ page import="net.sf.acegisecurity.ui.rememberme.TokenBasedRememberMeServices" %>
+
+<%
+session.invalidate();
+Cookie terminate = new Cookie(TokenBasedRememberMeServices.ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY, null);
+
+terminate.setMaxAge(0);
+response.addCookie(terminate);
+%>
+
+
Index: web/WEB-INF/applicationContext-security.xml
===================================================================
RCS file: /cvs/appfuse/web/WEB-INF/applicationContext-security.xml,v
retrieving revision 1.8
diff -u -r1.8 applicationContext-security.xml
--- web/WEB-INF/applicationContext-security.xml 28 Aug 2005 21:15:58 -0000 1.8
+++ web/WEB-INF/applicationContext-security.xml 28 Aug 2005 21:31:43 -0000
@@ -1,158 +1,198 @@
-
-
-
-
-
-
-
-
-
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- PATTERN_TYPE_APACHE_ANT
- /j_security_check*=httpSessionContextIntegrationFilter,authenticationProcessingFilter
- /**/*.html*=httpSessionContextIntegrationFilter,remoteUserFilter,anonymousProcessingFilter,securityEnforcementFilter
- /**/*.jsp*=httpSessionContextIntegrationFilter,remoteUserFilter,securityEnforcementFilter
-
-
-
-
-
-
-
-
-
-
-
-
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- PATTERN_TYPE_APACHE_ANT
- /signup.html=ROLE_ANONYMOUS,admin,user
- /passwordhint.html*=ROLE_ANONYMOUS,admin,user
- /**/*.html*=admin,user
- /clickstreams.jsp=admin
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SELECT username,password,enabled FROM app_user WHERE username = ?
-
-
- SELECT username,role_name FROM user_role WHERE username = ?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PROPAGATION_REQUIRED,-UserExistsException
- PROPAGATION_REQUIRED
- PROPAGATION_REQUIRED
- PROPAGATION_REQUIRED,readOnly
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.appfuse.service.UserManager.getUsers=admin
- org.appfuse.service.UserManager.removeUser=admin
-
-
-
-
+
+
+
+
+
+
+
+
+
+ CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
+ PATTERN_TYPE_APACHE_ANT
+ /**=httpSessionContextIntegrationFilter,authenticationProcessingFilter,remoteUserFilter,authenticationProcessingFilter,rememberMeProcessingFilter,anonymousProcessingFilter,securityEnforcementFilter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
+ PATTERN_TYPE_APACHE_ANT
+ /signup.html=ROLE_ANONYMOUS,admin,user
+ /passwordhint.html*=ROLE_ANONYMOUS,admin,user
+ /**/*.html*=admin,user
+ /clickstreams.jsp=admin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SELECT username,password,enabled FROM app_user WHERE username = ?
+
+
+ SELECT username,role_name FROM user_role WHERE username = ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.appfuse.service.UserManager.getUsers=admin
+ org.appfuse.service.UserManager.removeUser=admin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
+ PATTERN_TYPE_APACHE_ANT
+ /admin/**=REQUIRES_SECURE_CHANNEL
+ /login*=REQUIRES_SECURE_CHANNEL
+ /j_security_check*=REQUIRES_SECURE_CHANNEL
+ /editprofile.html*=REQUIRES_SECURE_CHANNEL
+ /saveuser.html*=REQUIRES_SECURE_CHANNEL
+ /**=REQUIRES_INSECURE_CHANNEL
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: web/pages/loginForm.jsp
===================================================================
RCS file: /cvs/appfuse/web/pages/loginForm.jsp,v
retrieving revision 1.14
diff -u -r1.14 loginForm.jsp
--- web/pages/loginForm.jsp 28 Apr 2005 09:47:16 -0000 1.14
+++ web/pages/loginForm.jsp 29 Aug 2005 00:07:36 -0000
@@ -1,74 +1,69 @@
-<%@ include file="/common/taglibs.jsp"%>
-
-
-<%-- If you don't want to encrypt passwords programmatically, or you don't
- care about using SSL for the login, you can change this form's action
- to "j_security_check" --%>
-"
- onsubmit="saveUsername(this);return validateForm(this)">
-