Author: taylor
Date: Thu Apr  1 03:50:22 2010
New Revision: 929801

URL: http://svn.apache.org/viewvc?rev=929801&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-1122

Modified:
    
portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
    
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/PasswordCredentialValveImpl.java
    
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pipelines.xml

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java?rev=929801&r1=929800&r2=929801&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/test/AbstractSpringTestCase.java
 Thu Apr  1 03:50:22 2010
@@ -42,6 +42,17 @@ public abstract class AbstractSpringTest
 
     protected final static String[] SUPPORTED_PORTLET_MODES = { "normal", 
"maximized", "minimized", "solo", "detach", "close" };
     protected final static String[] SUPPORTED_WINDOW_STATES = { "view", 
"edit", "help", "about", "config", "edit_defaults", "preview", "print", 
"secure" };
+
+    // override to provide own
+    protected String[] getSupportedPortletModes()
+    {
+       return SUPPORTED_PORTLET_MODES;
+    }
+    
+    protected String[] getSupportedWindowStates()
+    {
+       return SUPPORTED_WINDOW_STATES;
+    }
     
     /**
      * setup Spring context as part of test setup
@@ -51,7 +62,7 @@ public abstract class AbstractSpringTest
         super.setUp();
         scm = new SpringComponentManager(getBeanDefinitionFilter(), 
getBootConfigurations(), getConfigurations(), 
getBaseDir()+"target/test-classes/webapp", getInitProperties(), false);
         scm.start();
-           new JetspeedActions(SUPPORTED_PORTLET_MODES, 
SUPPORTED_WINDOW_STATES);
+           new JetspeedActions(getSupportedPortletModes(), 
getSupportedWindowStates());
     }
 
     /**

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/PasswordCredentialValveImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/PasswordCredentialValveImpl.java?rev=929801&r1=929800&r2=929801&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/PasswordCredentialValveImpl.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/security/impl/PasswordCredentialValveImpl.java
 Thu Apr  1 03:50:22 2010
@@ -23,6 +23,9 @@ import javax.security.auth.Subject;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.jetspeed.Jetspeed;
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.administration.PortalConfigurationConstants;
 import org.apache.jetspeed.pipeline.PipelineException;
 import org.apache.jetspeed.pipeline.valve.AbstractValve;
 import org.apache.jetspeed.pipeline.valve.PageProfilerValve;
@@ -47,6 +50,7 @@ public class PasswordCredentialValveImpl
     //private PageManager pageManager;
     private int[] expirationWarningDays;
     
+    private String passwordResetPage = "/my-account.psml";
     /**
      * Create a PasswordCredentialValveImpl which only checks and handles 
PasswordCredential.isUpdateRequired().
      *
@@ -55,6 +59,18 @@ public class PasswordCredentialValveImpl
     {     
         expirationWarningDays = new int[]{};
     }
+
+    public PasswordCredentialValveImpl(String passwordResetPage)
+    {     
+       this();
+        this.passwordResetPage = passwordResetPage;        
+    }
+
+    public PasswordCredentialValveImpl(List expirationWarningDays, String 
passwordResetPage)
+    {     
+       this(expirationWarningDays);
+        this.passwordResetPage = passwordResetPage;        
+    }
     
     /**
      * <p>
@@ -140,10 +156,17 @@ public class PasswordCredentialValveImpl
                         }
                     }
                 }
-                if ( passwordDaysValid != null )
+                if (passwordDaysValid != null)
                 {
-                    // enforce the SECURITY_LOCATOR to be used to redirect to 
a change password portlet page
-                    
request.setAttribute(PageProfilerValve.PROFILE_LOCATOR_REQUEST_ATTR_KEY,ProfileLocator.SECURITY_LOCATOR);
+                       if 
(Jetspeed.getConfiguration().getString(PortalConfigurationConstants.JETUI_CUSTOMIZATION_METHOD).equals(PortalConfigurationConstants.JETUI_CUSTOMIZATION_SERVER))
+                       {                       
+                           // enforce the SECURITY_LOCATOR to be used to 
redirect to a change password portlet page
+                           
request.setAttribute(PageProfilerValve.PROFILE_LOCATOR_REQUEST_ATTR_KEY,ProfileLocator.SECURITY_LOCATOR);
+                       }
+                       else
+                       {
+                               
request.setAttribute(PortalReservedParameters.PATH_ATTRIBUTE, 
passwordResetPage); 
+                       }
                     // inform the change password portlet why it is invoked
                     
request.setAttribute(PasswordCredential.PASSWORD_CREDENTIAL_DAYS_VALID_REQUEST_ATTR_KEY,
 passwordDaysValid);
                 }

Modified: 
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pipelines.xml
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pipelines.xml?rev=929801&r1=929800&r2=929801&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pipelines.xml
 (original)
+++ 
portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/pipelines.xml
 Thu Apr  1 03:50:22 2010
@@ -96,6 +96,7 @@
   <bean id="passwordCredentialValve" 
class="org.apache.jetspeed.security.impl.PasswordCredentialValveImpl"
     init-method="initialize">
     <meta key="j2:cat" value="default" />
+    <constructor-arg><value>/my-account.psml</value></constructor-arg>
   </bean>
 
   <bean id="loginValidationValve" 
class="org.apache.jetspeed.security.impl.LoginValidationValveImpl"



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to