You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2009/04/30 01:51:12 UTC
svn commit: r770007 - in /portals/jetspeed-2/applications: j2-admin/trunk/
j2-admin/trunk/src/main/java/org/apache/jetspeed/security/
j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/
j2-admin/trunk/src/main/java/org/apache/jetspeed/securi...
Author: taylor
Date: Wed Apr 29 23:51:10 2009
New Revision: 770007
URL: http://svn.apache.org/viewvc?rev=770007&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-979
* moving to j2-admin proper
* converting code to 2.2.0 Security APIs
Added:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/CaptchaBean.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/CaptchaBean.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/MFA.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/MFA.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/MultiFacetedAuthentication.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/MultiFacetedAuthentication.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/SecurityQuestionBean.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/SecurityQuestionBean.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/TextToSpeechBean.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/TextToSpeechBean.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaBeanImpl.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaBeanImpl.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaConfiguration.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaConfiguration.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java (contents, props changed)
- copied, changed from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java (contents, props changed)
- copied, changed from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MultiFacetedAuthenticationImpl.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MultiFacetedAuthenticationImpl.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/RemovableResource.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/RemovableResource.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/TTSConfiguration.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/TTSConfiguration.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/TextToSpeechBeanImpl.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/TextToSpeechBeanImpl.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java (contents, props changed)
- copied, changed from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/StatusMessage.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/StatusMessage.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/UserBean.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/UserBean.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/resources/
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/resources/MFAResources.properties (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/resources/MFAResources.properties
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/QuestionFactory.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/QuestionFactory.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java (contents, props changed)
- copied, changed from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/ServerData.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/ServerData.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/URIConstants.java (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/URIConstants.java
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/mfa.properties (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/mfa.properties
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/tts.properties (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/tts.properties
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/enroll-login.jsp (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/enroll-login.jsp
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/enroll.jsp (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/enroll.jsp
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/loggedon.jsp (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/loggedon.jsp
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/login1.jsp (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/login1.jsp
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/login2.jsp (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/login2.jsp
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/login3.jsp (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/login3.jsp
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/login4.jsp (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/login4.jsp
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/captchas/
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/captchas/placeholder (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/captchas/placeholder
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/jetspeedlogo98.jpg (props changed)
- copied unchanged from r769655, portals/jetspeed-2/applications/mfa/trunk/src/webapp/images/jetspeedlogo98.jpg
Removed:
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/faces-config.xml
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/CaptchaBean.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/MFA.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/MultiFacetedAuthentication.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/SecurityQuestionBean.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/TextToSpeechBean.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaBeanImpl.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaConfiguration.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MultiFacetedAuthenticationImpl.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/RemovableResource.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/TTSConfiguration.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/TextToSpeechBeanImpl.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/StatusMessage.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/UserBean.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/resources/MFAResources.properties
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/QuestionFactory.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/ServerData.java
portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/URIConstants.java
portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/mfa.properties
portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/tts.properties
portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/enroll-login.jsp
portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/enroll.jsp
portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/loggedon.jsp
portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/login1.jsp
portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/login2.jsp
portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/login3.jsp
portals/jetspeed-2/applications/mfa/trunk/src/webapp/WEB-INF/view/login4.jsp
portals/jetspeed-2/applications/mfa/trunk/src/webapp/captchas/placeholder
portals/jetspeed-2/applications/mfa/trunk/src/webapp/images/jetspeedlogo98.jpg
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/pom.xml
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml
Modified: portals/jetspeed-2/applications/j2-admin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/pom.xml?rev=770007&r1=770006&r2=770007&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/pom.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/pom.xml Wed Apr 29 23:51:10 2009
@@ -71,11 +71,14 @@
<jetspeed-2.version>2.2-SNAPSHOT</jetspeed-2.version>
<org.apache.portals.bridges.common.version>1.0.4</org.apache.portals.bridges.common.version>
<org.apache.portals.bridges.velocity.version>1.0.4</org.apache.portals.bridges.velocity.version>
+ <org.apache.portals.bridges.jsf.version>1.0.4</org.apache.portals.bridges.jsf.version>
<org.apache.portals.bridges.frameworks.version>1.0.4</org.apache.portals.bridges.frameworks.version>
<org.apache.portals.bridges.portletfilter.version>1.0.4</org.apache.portals.bridges.portletfilter.version>
<org.apache.portals.applications.apa-gems.version>1.0-SNAPSHOT</org.apache.portals.applications.apa-gems.version>
<org.apache.portals.applications.apa-webcontent.version>1.0-SNAPSHOT</org.apache.portals.applications.apa-webcontent.version>
<commons-digester.version>1.8</commons-digester.version>
+ <commons-configuration.version>1.6</commons-configuration.version>
+ <commons-lang.version>2.4</commons-lang.version>
<commons-fileupload.version>1.2</commons-fileupload.version>
<commons-io.version>1.4</commons-io.version>
<slf4j.version>1.5.6</slf4j.version>
@@ -179,6 +182,17 @@
</dependency>
<dependency>
<groupId>org.apache.portals.bridges</groupId>
+ <artifactId>portals-bridges-jsf</artifactId>
+ <version>${org.apache.portals.bridges.jsf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.bridges</groupId>
<artifactId>portals-bridges-portletfilter</artifactId>
<version>${org.apache.portals.bridges.portletfilter.version}</version>
<exclusions>
@@ -230,6 +244,16 @@
<version>${commons-digester.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>${commons-configuration.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>${commons-lang.version}</version>
+ </dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/CaptchaBean.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/MFA.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/MultiFacetedAuthentication.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/SecurityQuestionBean.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/TextToSpeechBean.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaBeanImpl.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaConfiguration.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java (from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java?p2=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java&p1=portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java&r1=769655&r2=770007&rev=770007&view=diff
==============================================================================
--- portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java Wed Apr 29 23:51:10 2009
@@ -42,6 +42,7 @@
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
+import java.util.Properties;
import java.util.Random;
import java.util.TimeZone;
@@ -489,7 +490,7 @@
PropertiesConfiguration config = new PropertiesConfiguration();
PropertiesConfiguration tconfig = new PropertiesConfiguration();
-
+ Properties x = new Properties();
try
{
InputStream is = new FileInputStream(configLocation);
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/CaptchaImageResource.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java (from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java?p2=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java&p1=portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java&r1=769655&r2=770007&rev=770007&view=diff
==============================================================================
--- portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java Wed Apr 29 23:51:10 2009
@@ -61,8 +61,9 @@
MultiFacetedAuthentication mfa = new MultiFacetedAuthenticationImpl(config, ttsConfig, rootPath);
MFA.setInstance(mfa);
}
- catch (Exception e)
+ catch (Throwable e)
{
+ e.printStackTrace();
PropertiesConfiguration config = new PropertiesConfiguration();
PropertiesConfiguration ttsConfig = new PropertiesConfiguration();
MultiFacetedAuthentication mfa = new MultiFacetedAuthenticationImpl(config, ttsConfig);
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MFAServletListener.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/MultiFacetedAuthenticationImpl.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/RemovableResource.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/ResourceRemovalCache.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/TTSConfiguration.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/TextToSpeechBeanImpl.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java (from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java?p2=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java&p1=portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java&r1=769655&r2=770007&rev=770007&view=diff
==============================================================================
--- portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java Wed Apr 29 23:51:10 2009
@@ -18,8 +18,8 @@
import java.io.IOException;
import java.io.NotSerializableException;
+import java.util.Map;
import java.util.Random;
-import java.util.prefs.Preferences;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
@@ -37,8 +37,14 @@
import org.apache.jetspeed.audit.AuditActivity;
import org.apache.jetspeed.login.LoginConstants;
import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.AuthenticatedUser;
+import org.apache.jetspeed.security.AuthenticationProvider;
import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityAttribute;
+import org.apache.jetspeed.security.SecurityAttributes;
+import org.apache.jetspeed.security.SecurityException;
import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserCredential;
import org.apache.jetspeed.security.UserManager;
import org.apache.jetspeed.security.mfa.impl.CaptchaImageResource;
import org.apache.jetspeed.security.mfa.util.QuestionFactory;
@@ -54,6 +60,7 @@
{
private UserManager userManager;
private AuditActivity audit;
+ private AuthenticationProvider authorization;
private Random rand = new Random();
private int cookieLifetime = 172800; // 48 hours
@@ -80,6 +87,11 @@
{
throw new PortletException("Failed to find the Audit Activity on portlet initialization");
}
+ authorization = (AuthenticationProvider)getPortletContext().getAttribute(CommonPortletServices.CPS_AUTHENTICATION_PROVIDER);
+ if (null == authorization)
+ {
+ throw new PortletException("Failed to find the Authorization Provider on portlet initialization");
+ }
// Read maximum lifetime for authentication cookies.
String cookie = getInitParameter("cookieLifetime");
@@ -126,7 +138,8 @@
{
if (view != null)
{
- Integer ecode = (Integer)((RequestContext)request.getAttribute(RequestContext.REQUEST_PORTALENV)).getSessionAttribute(LoginConstants.ERRORCODE);
+ RequestContext rc = SecurityHelper.getRequestContext(request);
+ Integer ecode = (Integer)rc.getSessionAttribute(LoginConstants.ERRORCODE);
if (ecode != null && (ecode.equals(LoginConstants.ERROR_USER_DISABLED) || ecode.equals(LoginConstants.ERROR_CREDENTIAL_DISABLED)))
{
view = this.setView(request, "three", FAILURE2);
@@ -153,37 +166,37 @@
protected String[][] SUCCESS1_MAP =
{
- { "one", "/WEB-INF/view/login3.jsp" }, // success and a valid cookie, move on to password
- { "two", "/WEB-INF/view/login3.jsp" }, // success answer to personal question
- { "three", "/WEB-INF/view/login3.jsp" }, // stay on the same page in case of errors
- { "enroll", "/WEB-INF/view/enroll-login.jsp" },
- { "enroll-login", "/WEB-INF/view/enroll.jsp"},
- { "loggedon", "/WEB-INF/view/loggedon.jsp" },
- { "restart", "/WEB-INF/view/login1.jsp" }
+ { "one", "/WEB-INF/view/mfa/login3.jsp" }, // success and a valid cookie, move on to password
+ { "two", "/WEB-INF/view/mfa/login3.jsp" }, // success answer to personal question
+ { "three", "/WEB-INF/view/mfa/login3.jsp" }, // stay on the same page in case of errors
+ { "enroll", "/WEB-INF/view/mfa/enroll-login.jsp" },
+ { "enroll-login", "/WEB-INF/view/mfa/enroll.jsp"},
+ { "loggedon", "/WEB-INF/view/mfa/loggedon.jsp" },
+ { "restart", "/WEB-INF/view/mfa/login1.jsp" }
};
protected String[][] SUCCESS2_MAP =
{
- { "one", "/WEB-INF/view/login2.jsp" }, // success but no valid cookie, move on to asking question
+ { "one", "/WEB-INF/view/mfa/login2.jsp" }, // success but no valid cookie, move on to asking question
};
protected String[][] SUCCESS3_MAP =
{
- { "one", "/WEB-INF/view/enroll-login.jsp" }, // success but no preferences configured yet, move on to enrollment mode
+ { "one", "/WEB-INF/view/mfa/enroll-login.jsp" }, // success but no preferences configured yet, move on to enrollment mode
};
protected String[][] FAILURE1_MAP =
{
- { "one", "/WEB-INF/view/login1.jsp" }, // return back, display message
- { "two", "/WEB-INF/view/login1.jsp" }, // stay on same page
- { "three", "/WEB-INF/view/login3.jsp" },
- { "enroll", "/WEB-INF/view/enroll.jsp" }, // validation error
- { "enroll-login", "/WEB-INF/view/enroll-login.jsp"},
+ { "one", "/WEB-INF/view/mfa/login1.jsp" }, // return back, display message
+ { "two", "/WEB-INF/view/mfa/login1.jsp" }, // stay on same page
+ { "three", "/WEB-INF/view/mfa/login3.jsp" },
+ { "enroll", "/WEB-INF/view/mfa/enroll.jsp" }, // validation error
+ { "enroll-login", "/WEB-INF/view/mfa/enroll-login.jsp"},
};
protected String[][] FAILURE2_MAP =
{
- { "one", "/WEB-INF/view/login2.jsp" }, // send them on like they succeeded, but its a trap
- { "two", "/WEB-INF/view/login1.jsp" }, // user disabled, reset
- { "enroll", "/WEB-INF/view/login1.jsp" }, // reset
- { "enroll-login", "/WEB-INF/view/login4.jsp"},
- { "three", "/WEB-INF/view/login4.jsp" }
+ { "one", "/WEB-INF/view/mfa/login2.jsp" }, // send them on like they succeeded, but its a trap
+ { "two", "/WEB-INF/view/mfa/login1.jsp" }, // user disabled, reset
+ { "enroll", "/WEB-INF/view/mfa/login1.jsp" }, // reset
+ { "enroll-login", "/WEB-INF/view/mfa/login4.jsp"},
+ { "three", "/WEB-INF/view/mfa/login4.jsp" }
};
protected String[][][] TRANSITIONS =
@@ -209,7 +222,7 @@
throws PortletException
{
String[][] views = TRANSITIONS[state];
- String result = "/WEB-INF/view/login1.jsp";
+ String result = "/WEB-INF/view/mfa/login1.jsp";
for (int ix = 0; ix < views.length; ix++)
{
if (views[ix][0].equals(phase))
@@ -268,8 +281,14 @@
}
userBean.setUsername(username);
userBean.setUser(user);
- PasswordCredential credential = SecurityHelper.getCredential(user);
- if ( credential != null )
+ UserCredential credential = null;
+ try
+ {
+ credential = SecurityHelper.getCredential(userManager, user);
+ }
+ catch (SecurityException e)
+ {}
+ if (credential != null)
{
if (credential.isEnabled() == false)
{
@@ -299,12 +318,12 @@
}
else
{
- Preferences userAttributes = getUserAttributes(userBean);
- String cookie = userAttributes.get("user.cookie", username);
+ Map<String, SecurityAttribute> userAttributes = userBean.getUser().getSecurityAttributes().getAttributeMap();
+ String cookie = getUserAttribute(userAttributes, "user.cookie", username);
if (mfaCookie.getValue().equals(cookie))
{
userBean.setHasCookie(true);
- userBean.setPassPhrase( userAttributes.get("user.passphrase", "") );
+ userBean.setPassPhrase(getUserAttribute(userAttributes, "user.passphrase", ""));
setView(actionRequest, phase, SUCCESS1);
}
else
@@ -354,8 +373,8 @@
String typedAnswer = actionRequest.getParameter("answer");
String publicTerminal = actionRequest.getParameter("publicTerminal");
userBean.setPublicTerminal(publicTerminal != null);
- Preferences userAttributes = getUserAttributes(userBean);
- int failures = Integer.parseInt(userAttributes.get("user.question.failures", "0"));
+ Map<String, SecurityAttribute> userAttributes = userBean.getUser().getSecurityAttributes().getAttributeMap();
+ int failures = Integer.parseInt(getUserAttribute(userAttributes, "user.question.failures", "0"));
if (SecurityHelper.isEmpty(typedAnswer) || !typedAnswer.equalsIgnoreCase(userBean.getAnswer()))
{
int count = failures + 1;
@@ -363,13 +382,18 @@
{
try
{
- userManager.setPasswordEnabled(userBean.getUsername(), false);
- User user = userManager.getUser(userBean.getUsername());
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
+ User user = userManager.getUser(userBean.getUsername());
+ PasswordCredential pwc = userManager.getPasswordCredential(user);
+ pwc.setEnabled(false);
+ userManager.storePasswordCredential(pwc);
+ SecurityHelper.updateCredentialInSession(rc, pwc);
userBean.setUser(user);
- userAttributes = getUserAttributes(userBean);
- userAttributes.put("user.question.failures", "0");
+ userAttributes = userBean.getUser().getSecurityAttributes().getAttributeMap();
+ user.getSecurityAttributes().getAttribute("user.question.failures", true).setStringValue("0");
+ userManager.updateUser(user);
audit.logUserActivity(userBean.getUsername(),
- ((RequestContext)actionRequest.getAttribute(RequestContext.REQUEST_PORTALENV)).getRequest().getRemoteAddr(),
+ rc.getRequest().getRemoteAddr(),
AuditActivity.USER_DISABLE, "Failed question and answer limit reached");
}
catch (Exception e)
@@ -380,8 +404,14 @@
setView(actionRequest, phase, FAILURE2);
}
else
- {
- userAttributes.put("user.question.failures", Integer.toString(count));
+ {
+ try
+ {
+ userBean.getUser().getSecurityAttributes().getAttribute("user.question.failures", true).setStringValue(Integer.toString(count));
+ userManager.updateUser(userBean.getUser());
+ }
+ catch (SecurityException e)
+ {}
StatusMessage msg = new StatusMessage("Invalid answer to question.", StatusMessage.ERROR);
PortletMessaging.publish(actionRequest, STATUS_MESSAGE, msg);
setView(actionRequest, phase, FAILURE1);
@@ -389,8 +419,14 @@
}
else
{
- userBean.setPassPhrase( userAttributes.get("user.passphrase", "") );
- userAttributes.put("user.question.failures", "0");
+ try
+ {
+ userBean.setPassPhrase(getUserAttribute(userAttributes, "user.passphrase", ""));
+ userBean.getUser().getSecurityAttributes().getAttribute("user.question.failures", true).setStringValue("0");
+ userManager.updateUser(userBean.getUser());
+ }
+ catch (Exception e)
+ {}
setView(actionRequest, phase, SUCCESS1);
}
}
@@ -402,8 +438,18 @@
User user = userBean.getUser();
if (user != null && password != null)
{
- boolean authenticated = userManager.authenticate(userBean.getUsername(), password);
- if (authenticated)
+ AuthenticatedUser authUser = null;
+ try
+ {
+ authUser = authorization.authenticate(userBean.getUsername(), password);
+ }
+ catch (SecurityException e)
+ {
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
+ audit.logUserActivity(userBean.getUsername(), rc.getRequest().getRemoteAddr(),
+ AuditActivity.AUTHENTICATION_FAILURE, "PortalFilter");
+ }
+ if (authUser != null)
{
// validate request parameers, if valid update user preferences
String question1 = actionRequest.getParameter("question1");
@@ -439,26 +485,40 @@
// update the prefs db (we are not logged in yet
user = userBean.getUser();
- user.getUserAttributes().put("user.question.1", question1);
- user.getUserAttributes().put("user.question.2", question2);
- user.getUserAttributes().put("user.question.3", question3);
- user.getUserAttributes().put("user.answer.1", answer1);
- user.getUserAttributes().put("user.answer.2", answer2);
- user.getUserAttributes().put("user.answer.3", answer3);
- user.getUserAttributes().put("user.passphrase", passPhrase);
- user.getUserAttributes().put("user.cookie", CaptchaImageResource.randomString(8, 16) );
-
- String username = userBean.getUsername();
- String redirect = actionRequest.getParameter("redirect");
- audit.logUserActivity(username, ((RequestContext)actionRequest.getAttribute(RequestContext.REQUEST_PORTALENV)).getRequest().getRemoteAddr(),
- LOGIN_ENROLL_ACTIVITY, "enrolling user with questions and passphrase");
- redirect(actionRequest, actionResponse, redirect, username, password);
- success = true;
+ try
+ {
+ user.getSecurityAttributes().getAttribute("user.question.1", true).setStringValue(question1);
+ user.getSecurityAttributes().getAttribute("user.question.2", true).setStringValue(question2);
+ user.getSecurityAttributes().getAttribute("user.question.3", true).setStringValue(question3);
+ user.getSecurityAttributes().getAttribute("user.answer.1", true).setStringValue(answer1);
+ user.getSecurityAttributes().getAttribute("user.answer.2", true).setStringValue(answer2);
+ user.getSecurityAttributes().getAttribute("user.answer.3", true).setStringValue(answer3);
+ user.getSecurityAttributes().getAttribute("user.passphrase", true).setStringValue(passPhrase);
+ user.getSecurityAttributes().getAttribute("user.cookie", true).setStringValue(CaptchaImageResource.randomString(8, 16));
+ userManager.updateUser(user);
+ success = true;
+ }
+ catch (SecurityException e)
+ {
+ success = false;
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
+ audit.logUserActivity(userBean.getUsername(), rc.getRequest().getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "Exception updating attributes" );
+ setView(actionRequest, phase, FAILURE2);
+ }
+ if (success)
+ {
+ String username = userBean.getUsername();
+ String redirect = actionRequest.getParameter("redirect");
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
+ audit.logUserActivity(username, rc.getRequest().getRemoteAddr(),
+ LOGIN_ENROLL_ACTIVITY, "enrolling user with questions and passphrase");
+ redirect(actionRequest, actionResponse, redirect, username, password);
+ }
}
}
if (success == false)
{
- RequestContext rc = (RequestContext)actionRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
audit.logUserActivity(userBean.getUsername(), rc.getRequest().getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "Unauthorized Attribute Modification Attempt.");
setView(actionRequest, phase, FAILURE2);
}
@@ -469,14 +529,23 @@
String password = actionRequest.getParameter(LoginConstants.PASSWORD);
if (SecurityHelper.isEmpty(password))
{
- ((RequestContext)actionRequest).setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
+ rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
setView(actionRequest, phase, FAILURE1);
return;
}
// are we in the enrollment phase?
if (SecurityHelper.isEmpty(userBean.getPassPhrase()))
{
- boolean authenticated = userManager.authenticate(username, password);
+ AuthenticatedUser authUser = null;
+ boolean authenticated = false;
+ try
+ {
+ authUser = authorization.authenticate(username, password);
+ authenticated = true;
+ }
+ catch (SecurityException e)
+ {}
if (authenticated)
{
userBean.setPassword(password);
@@ -497,12 +566,21 @@
String password = actionRequest.getParameter(LoginConstants.PASSWORD);
if (SecurityHelper.isEmpty(password) || SecurityHelper.isEmpty(redirect))
{
- ((RequestContext)actionRequest).setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
+ rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
setView(actionRequest, phase, FAILURE1);
return;
}
// process authentication
- boolean authenticated = userManager.authenticate(username, password);
+ AuthenticatedUser authUser = null;
+ boolean authenticated = false;
+ try
+ {
+ authUser = authorization.authenticate(username, password);
+ authenticated = true;
+ }
+ catch (SecurityException e)
+ {}
if (authenticated)
{
userBean.setPassword(password);
@@ -510,9 +588,8 @@
clearLoginMessages(actionRequest);
if (!userBean.isHasCookie() && !userBean.isPublicTerminal())
{
- Preferences userAttributes = getUserAttributes(userBean);
- String cookie = userAttributes.get("user.cookie", username);
-
+ Map<String, SecurityAttribute> userAttributes = userBean.getUser().getSecurityAttributes().getAttributeMap();
+ String cookie = getUserAttribute(userAttributes, "user.cookie", username);
SecurityHelper.addMFACookie(actionRequest, username, cookie, cookieLifetime);
userBean.setHasCookie(true);
}
@@ -546,33 +623,42 @@
e.printStackTrace();
return;
}
- PasswordCredential pwdCredential = SecurityHelper.getCredential(user);
- userBean.setUser(user);
- // Failed login processing
- RequestContext rc = (RequestContext)actionRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
- HttpSession session = rc.getRequest().getSession(true);
- Integer retryCount = (Integer) session.getAttribute(MFALogin.RETRYCOUNT);
- if (retryCount == null)
- retryCount = new Integer(1);
- else
- retryCount = new Integer(retryCount.intValue() + 1);
- session.setAttribute(MFALogin.RETRYCOUNT, retryCount);
- if ( pwdCredential == null || !pwdCredential.isEnabled() )
- {
- rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_CREDENTIAL_DISABLED);
- nextView = FAILURE2;
- }
- else if ( pwdCredential.isExpired() )
- {
- rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_CREDENTIAL_EXPIRED);
- }
- else if ( maxNumberOfAuthenticationFailures > 1 && pwdCredential.getAuthenticationFailures() == maxNumberOfAuthenticationFailures -1 )
+ UserCredential pwdCredential = null;
+ try
{
- rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_FINAL_LOGIN_ATTEMPT);
+ pwdCredential = SecurityHelper.getCredential(userManager, user);
}
- else
- {
- rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
+ catch (SecurityException e)
+ {}
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
+ if (pwdCredential != null)
+ {
+ userBean.setUser(user);
+ // Failed login processing
+ HttpSession session = rc.getRequest().getSession(true);
+ Integer retryCount = (Integer) session.getAttribute(MFALogin.RETRYCOUNT);
+ if (retryCount == null)
+ retryCount = new Integer(1);
+ else
+ retryCount = new Integer(retryCount.intValue() + 1);
+ session.setAttribute(MFALogin.RETRYCOUNT, retryCount);
+ if ( pwdCredential == null || !pwdCredential.isEnabled() )
+ {
+ rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_CREDENTIAL_DISABLED);
+ nextView = FAILURE2;
+ }
+ else if ( pwdCredential.isExpired() )
+ {
+ rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_CREDENTIAL_EXPIRED);
+ }
+ else if ( maxNumberOfAuthenticationFailures > 1 && pwdCredential.getAuthenticationFailures() == maxNumberOfAuthenticationFailures -1 )
+ {
+ rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_FINAL_LOGIN_ATTEMPT);
+ }
+ else
+ {
+ rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);
+ }
}
audit.logUserActivity(username, rc.getRequest().getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "MFA");
//StatusMessage msg = new StatusMessage("invalid password.", StatusMessage.ERROR);
@@ -582,7 +668,7 @@
private void clearLoginMessages(PortletRequest actionRequest)
{
- RequestContext rc = (RequestContext)actionRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
HttpSession session = rc.getRequest().getSession(true);
session.removeAttribute(MFALogin.RETRYCOUNT);
session.removeAttribute(MFALogin.ERRORCODE);
@@ -608,7 +694,7 @@
s.append(password);
*/
//System.out.println("Redirect: " + s.toString());
- RequestContext rc = (RequestContext)actionRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
+ RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
HttpServletRequest request = rc.getRequest();
HttpSession session = request.getSession(true);
session.setAttribute(LoginConstants.USERNAME, username);
@@ -640,19 +726,19 @@
}
}
}
- Preferences ua = user.getUserAttributes();
+ Map<String, SecurityAttribute> userAttributes = userBean.getUser().getSecurityAttributes().getAttributeMap();
String[] questions = new String[3];
String[] answers = new String[3];
int max = 3;
- questions[0] = ua.get("user.question.1", null);
- answers[0] = ua.get("user.answer.1", null);
+ questions[0] = getUserAttribute(userAttributes, "user.question.1", null);
+ answers[0] = getUserAttribute(userAttributes, "user.answer.1", null);
if (SecurityHelper.isEmpty(questions[0]) || SecurityHelper.isEmpty(answers[0]))
{
return false;
}
- questions[1] = ua.get("user.question.2", null);
- answers[1] = ua.get("user.answer.2", null);
+ questions[1] = getUserAttribute(userAttributes,"user.question.2", null);
+ answers[1] = getUserAttribute(userAttributes,"user.answer.2", null);
if (SecurityHelper.isEmpty(questions[1]) || SecurityHelper.isEmpty(answers[1]))
{
// work with what we got
@@ -660,8 +746,8 @@
userBean.setAnswer(answers[0]);
return true;
}
- questions[2] = ua.get("user.question.3", null);
- answers[2] = ua.get("user.answer.3", null);
+ questions[2] = getUserAttribute(userAttributes,"user.question.3", null);
+ answers[2] = getUserAttribute(userAttributes,"user.answer.3", null);
if (SecurityHelper.isEmpty(questions[2]) || SecurityHelper.isEmpty(answers[2]))
{
// work with what we got
@@ -674,8 +760,17 @@
return true;
}
- private Preferences getUserAttributes(UserBean user)
+ private String getUserAttribute(Map<String, SecurityAttribute> map, String name, String defaultValue)
{
- return user.getUser().getUserAttributes();
+ String value = defaultValue;
+ SecurityAttribute sa = map.get(name);
+ if (sa != null)
+ {
+ value = sa.getStringValue();
+ if (value == null)
+ value = defaultValue;
+ }
+ return value;
}
+
}
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/MFALogin.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/StatusMessage.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/UserBean.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/portlets/resources/MFAResources.properties
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/QuestionFactory.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java (from r769655, portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java?p2=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java&p1=portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java&r1=769655&r2=770007&rev=770007&view=diff
==============================================================================
--- portals/jetspeed-2/applications/mfa/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java Wed Apr 29 23:51:10 2009
@@ -20,6 +20,7 @@
import java.util.Set;
import javax.portlet.PortletRequest;
+import javax.security.auth.Subject;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -27,7 +28,10 @@
import org.apache.jetspeed.PortalReservedParameters;
import org.apache.jetspeed.request.RequestContext;
import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityException;
import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserCredential;
+import org.apache.jetspeed.security.UserManager;
/**
* @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
@@ -35,18 +39,20 @@
*/
public final class SecurityHelper
{
- public static PasswordCredential getCredential(User user)
+ public static UserCredential getCredential(UserManager um, User user)
+ throws SecurityException
{
- PasswordCredential credential = null;
+ UserCredential credential = null;
- Set credentials = user.getSubject().getPrivateCredentials();
+ Subject subject = um.getSubject(user);
+ Set credentials = subject.getPrivateCredentials();
Iterator iter = credentials.iterator();
while (iter.hasNext())
{
Object o = iter.next();
- if (o instanceof PasswordCredential)
+ if (o instanceof UserCredential)
{
- credential = (PasswordCredential)o;
+ credential = (UserCredential)o;
break;
}
}
@@ -113,4 +119,20 @@
return true;
return false;
}
+
+ public static void updateCredentialInSession(RequestContext requestContext, PasswordCredential credential)
+ {
+ Subject subject = (Subject)requestContext.getSessionAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT);
+ Iterator<Object> iter = subject.getPrivateCredentials().iterator();
+ while (iter.hasNext())
+ {
+ Object o = iter.next();
+ if (o instanceof UserCredential)
+ {
+ ((UserCredential)o).synchronize(credential);
+ break;
+ }
+ }
+
+ }
}
\ No newline at end of file
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/SecurityHelper.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/ServerData.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/util/URIConstants.java
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml?rev=770007&r1=770006&r2=770007&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/jetspeed-portlet.xml Wed Apr 29 23:51:10 2009
@@ -44,7 +44,6 @@
<js:metadata name="selector.conditional.role">admin</js:metadata>
</portlet>
-
<portlet>
<portlet-name>PortalLoginPortlet</portlet-name>
<js:security-constraint-ref>public-view</js:security-constraint-ref>
@@ -53,6 +52,13 @@
<js:metadata name="selector.conditional.role">admin</js:metadata>
</portlet>
+ <portlet>
+ <portlet-name>MFALogin</portlet-name>
+ <js:security-constraint-ref>public-view</js:security-constraint-ref>
+ <dc:title>Login</dc:title>
+ <dc:creator>J2 Team</dc:creator>
+ </portlet>
+
<portlet>
<portlet-name>LocaleSelector</portlet-name>
<js:security-constraint-ref>public-view</js:security-constraint-ref>
@@ -146,7 +152,8 @@
<js:service name='AuditActivity'/>
<js:service name='JetspeedSerializer'/>
<js:service name='JetspeedPrincipalManagerProvider'/>
- <js:service name='PAM'/>
+ <js:service name='PAM'/>
+ <js:service name='AuthenticationProvider'/>
</js:services>
</portlet-app>
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/mfa.properties
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml?rev=770007&r1=770006&r2=770007&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml Wed Apr 29 23:51:10 2009
@@ -1725,6 +1725,71 @@
<keywords>admin,registry,list,portlet,details,apps,portlets,PRM</keywords>
</portlet-info>
</portlet>
+
+ <portlet id="MFALogin">
+ <description>MFA Login</description>
+ <portlet-name>MFALogin</portlet-name>
+ <display-name>MFA Login</display-name>
+ <portlet-class>org.apache.jetspeed.security.mfa.portlets.MFALogin</portlet-class>
+ <init-param>
+ <name>ViewPage</name>
+ <value>/WEB-INF/view/mfa/login1.jsp</value>
+ </init-param>
+
+ <init-param>
+ <name>cookieLifetime</name>
+ <value>345600</value>
+ </init-param>
+
+ <init-param>
+ <name>maxNumberOfAuthenticationFailures</name>
+ <value>5</value>
+ </init-param>
+
+ <init-param>
+ <name>randomQuestions</name>
+ <value>What was the first and last name of your favorite teacher?
+ What was your favorite sport, team, or athlete when you were 16?
+ What was your favorite place to visit when you were 16?
+ Who was your favorite actor, musician, or artist when you were in high-school?
+ What is the first name of your first boyfriend?
+ What is the first name of your first girlfriend?
+ What is the name of your first elementary school?
+ What was the high school mascot at the last high school you attended?
+ In what city was your first elementary school?
+ In what city was your mother born?
+ In what city was your father born?
+ What is the first name of your maternal grandmother (your mother's mother)?
+ What is the first name of your paternal grandmother (your father's mother)?
+ What is the first name of your maternal grandfather (your mother's father)?
+ What is the first name of your paternal grandfather (your father's father)?
+ Who was your first employer?
+ In what city did you meet your spouse?
+ What was the first name of your first roommate during college?
+ In what city did you get married?
+ How old were you at your wedding?
+ What was the first name of the best man at your wedding?
+ What was the first name of the maid of honor at your wedding?</value>
+ </init-param>
+
+ <init-param>
+ <name>failOnMisconfiguredUser</name>
+ <value>false</value>
+ </init-param>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+ <portlet-info>
+ <title>Login</title>
+ <short-title>Login</short-title>
+ <keywords>MFA, login</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ </portlet-preferences>
+ </portlet>
<custom-portlet-mode>
<description>a Custom Edit_defaults Mode</description>
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/tts.properties
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/enroll-login.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/enroll.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/loggedon.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/login1.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/login2.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/login3.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/view/mfa/login4.jsp
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml?rev=770007&r1=770006&r2=770007&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml Wed Apr 29 23:51:10 2009
@@ -199,6 +199,10 @@
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
+ <listener>
+ <listener-class>org.apache.jetspeed.security.mfa.impl.MFAServletListener</listener-class>
+ </listener>
+
<!-- Define Velocity Servlet -->
<servlet>
<servlet-name>velocity</servlet-name>
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/captchas/placeholder
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/jetspeedlogo98.jpg
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/images/jetspeedlogo98.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org