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 2008/09/09 01:31:35 UTC
svn commit: r693316 [3/3] - in /portals/jetspeed-2/applications/mfa: ./
WebContent/ WebContent/META-INF/ WebContent/WEB-INF/
WebContent/WEB-INF/lib/ WebContent/WEB-INF/view/ WebContent/captchas/
WebContent/images/ src/ src/org/ src/org/apache/ src/org/...
Added: portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/portlets/UserBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/portlets/UserBean.java?rev=693316&view=auto
==============================================================================
--- portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/portlets/UserBean.java (added)
+++ portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/portlets/UserBean.java Mon Sep 8 16:31:33 2008
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.mfa.portlets;
+
+import java.io.Serializable;
+
+import org.apache.jetspeed.security.User;
+
+/**
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class UserBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ // phase one
+ private String username;
+ private String password;
+ private String captcha;
+ private User user;
+
+ // phase two
+ private String question;
+ private String answer;
+ private int questionFailureCount = 0;
+
+ private boolean publicTerminal = false;
+ private boolean invalidUser = false;
+ private boolean hasCookie = false;
+
+ // phase three
+ private String passPhrase = null;
+
+ // miscellaneous
+ private boolean misconfigured = false;
+
+ public UserBean()
+ {
+ reset();
+ }
+
+ public void reset()
+ {
+ username = "";
+ captcha = "";
+ user = null;
+ question = "";
+ answer = "";
+ publicTerminal = false;
+ invalidUser = false;
+ passPhrase = "";
+ hasCookie = false;
+ questionFailureCount = 0;
+ }
+
+ public int incrementQuestionFailureCount()
+ {
+ return ++questionFailureCount;
+ }
+
+ public String getCaptcha()
+ {
+ return captcha;
+ }
+
+ public void setCaptcha(String captcha)
+ {
+ this.captcha = captcha;
+ }
+
+ public User getUser()
+ {
+ return user;
+ }
+
+ public void setUser(User user)
+ {
+ this.user = user;
+ }
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+
+ public String getAnswer()
+ {
+ return answer;
+ }
+
+
+ public void setAnswer(String answer)
+ {
+ this.answer = answer;
+ }
+
+
+ public String getQuestion()
+ {
+ return question;
+ }
+
+
+ public void setQuestion(String question)
+ {
+ this.question = question;
+ }
+
+
+ public boolean isPublicTerminal()
+ {
+ return publicTerminal;
+ }
+
+
+ public void setPublicTerminal(boolean publicTerminal)
+ {
+ this.publicTerminal = publicTerminal;
+ }
+
+
+ public boolean isInvalidUser()
+ {
+ return invalidUser;
+ }
+
+
+ public void setInvalidUser(boolean invalidUser)
+ {
+ this.invalidUser = invalidUser;
+ }
+
+
+ // TODO: Re-read user attributes as few times as possible.
+ public String getPassPhrase()
+ {
+ return passPhrase;
+ }
+
+
+ public void setPassPhrase(String passPhrase)
+ {
+ this.passPhrase = passPhrase;
+ }
+
+
+ public boolean isHasCookie()
+ {
+ return hasCookie;
+ }
+
+
+ public void setHasCookie(boolean hasCookie)
+ {
+ this.hasCookie = hasCookie;
+ }
+
+
+ public boolean isMisconfigured()
+ {
+ return misconfigured;
+ }
+
+
+ public void setMisconfigured(boolean misconfigured)
+ {
+ this.misconfigured = misconfigured;
+ }
+
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+
+ public int getQuestionFailureCount()
+ {
+ return questionFailureCount;
+ }
+
+
+ public void setQuestionFailureCount(int questionFailureCount)
+ {
+ this.questionFailureCount = questionFailureCount;
+ }
+
+}
\ No newline at end of file
Added: portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/portlets/resources/MFAResources.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/portlets/resources/MFAResources.properties?rev=693316&view=auto
==============================================================================
--- portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/portlets/resources/MFAResources.properties (added)
+++ portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/portlets/resources/MFAResources.properties Mon Sep 8 16:31:33 2008
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# $Id: LoginResources.properties 348264 2005-11-22 22:06:45Z taylor $
+#
+
+# portlet info
+javax.portlet.title=Login Portlet
+javax.portlet.short-title=Login Portlet
+
+# login.jsp
+login.label.Login=Login
+login.label.Welcome=Welcome {0}
+login.label.Logout=Logout
+login.label.InvalidUsernameOrPassword=Invalid username or password ({0})
+login.label.Username=Username
+login.label.Password=Password
+login.label.ChangePassword=Change Password
+# LoginConstants.ERROR_UNKNOWN_USER
+login.label.ErrorCode.1=Invalid username
+# LoginConstants.ERROR_INVALID_PASSWORD
+login.label.ErrorCode.2=Invalid password
+# LoginConstants.ERROR_USER_DISABLED
+login.label.ErrorCode.3=This user account is disabled.<br/>Please contact administration.
+# LoginConstants.ERROR_FINAL_LOGIN_ATTEMPT
+# login.label.ErrorCode.4=Invalid password.<br/>Warning: only one login attempt remains for this account
+login.label.ErrorCode.4=Invalid password.
+# LoginConstants.ERROR_CREDENTIAL_DISABLED
+login.label.ErrorCode.5=This user account its password is disabled.<br/>Please contact administration.
+# LoginConstants.ERROR_CREDENTIAL_EXPIRED
+login.label.ErrorCode.6=This user account its password is expired.<br/>Please contact administration.
+
+login.label.SomeMissingCredentials=You need to
\ No newline at end of file
Added: portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/QuestionFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/QuestionFactory.java?rev=693316&view=auto
==============================================================================
--- portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/QuestionFactory.java (added)
+++ portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/QuestionFactory.java Mon Sep 8 16:31:33 2008
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.mfa.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.jetspeed.security.mfa.SecurityQuestionBean;
+
+public class QuestionFactory
+{
+ static private Random rand;
+
+ private List<String> questions;
+
+ public QuestionFactory( String source )
+ {
+ rand = new Random();
+
+ // Read random questions.
+ if ( source.charAt( source.length() - 1 ) == '?' )
+ source = source.substring(0, source.length() - 1);
+
+ try {
+ String[] questionTokens = null;
+ questionTokens = source.split("\\?");
+ questions = new ArrayList<String>();
+ for (int i=0; i < questionTokens.length; i++)
+ questions.add( questionTokens[i].trim() + "?" );
+
+ // System.out.println("Can now present invalid users with any of " + questions.size() + " random questions.");
+ }
+ catch (Throwable e)
+ {
+ System.err.println( "Unable to parse random questions: " + e.toString() );
+ e.printStackTrace();
+ }
+ }
+
+ public String getRandomQuestion()
+ {
+ return (String)questions.get( rand.nextInt( questions.size() ) );
+ }
+
+ public List<String> getAllQuestions()
+ {
+ return questions;
+ }
+
+ public List<String> getAllQuestionsInRandomOrder()
+ {
+ List<String> result = new ArrayList<String>( questions.size() );
+
+ for (int i=0; i<questions.size(); i++)
+ result.add( questions.get(i) );
+
+ for (int i=0; i<result.size(); i++)
+ {
+ int j = rand.nextInt( result.size() );
+ String temp = result.get(i);
+ result.set(i, result.get(j) );
+ result.set(j, temp);
+ }
+
+ return result;
+ }
+
+ public SecurityQuestionBean getSecurityQuestionBean()
+ {
+ SecurityQuestionBean result = new SecurityQuestionBean();
+ List<String> source = getAllQuestionsInRandomOrder();
+
+ result.setQuestion1( source.get(1) );
+ result.setQuestion2( source.get(2) );
+ result.setQuestion3( source.get(3) );
+
+ return result;
+ }
+}
Added: portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/SecurityHelper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/SecurityHelper.java?rev=693316&view=auto
==============================================================================
--- portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/SecurityHelper.java (added)
+++ portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/SecurityHelper.java Mon Sep 8 16:31:33 2008
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.mfa.util;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.portlet.PortletRequest;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.User;
+
+/**
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public final class SecurityHelper
+{
+ public static PasswordCredential getCredential(User user)
+ {
+ PasswordCredential credential = null;
+
+ Set credentials = user.getSubject().getPrivateCredentials();
+ Iterator iter = credentials.iterator();
+ while (iter.hasNext())
+ {
+ Object o = iter.next();
+ if (o instanceof PasswordCredential)
+ {
+ credential = (PasswordCredential)o;
+ break;
+ }
+ }
+ return credential;
+ }
+
+ public static final String MFA_COOKIE = "jetspeed_mfa";
+ public static final String MFA_VALID_COOKIE = "validated";
+
+ public static Cookie getMFACookie(PortletRequest pRequest, String username)
+ {
+ String MFAUserCookie = MFA_COOKIE + "_" + username;
+ HttpServletRequest request = SecurityHelper.getHttpServletRequest(pRequest);
+ Cookie auth = null;
+ Cookie[] cookies = request.getCookies();
+ for (int ix = 0; ix < cookies.length; ix++ )
+ {
+ if (cookies[ix].getName().equals(MFAUserCookie))
+ {
+ auth = cookies[ix];
+ break;
+ }
+ }
+ return auth;
+ }
+
+ public static void addMFACookie(PortletRequest pRequest, String username, String value)
+ {
+ final int FORTY_EIGHT_HOURS = 172800;
+ addMFACookie(pRequest, username, value, FORTY_EIGHT_HOURS);
+ }
+
+ public static void addMFACookie(PortletRequest pRequest, String username, String value, int lifetime)
+ {
+ String MFAUserCookie = MFA_COOKIE + "_" + username;
+ HttpServletResponse response = SecurityHelper.getHttpServletResponse(pRequest);
+ String path = SecurityHelper.getHttpServletRequest(pRequest).getContextPath();
+ Cookie auth = new Cookie(MFAUserCookie, value);
+ auth.setPath(path);
+ auth.setMaxAge(lifetime);
+ response.addCookie(auth);
+ }
+
+ public static RequestContext getRequestContext(PortletRequest request)
+ {
+ return (RequestContext) request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+ }
+
+ public static HttpServletRequest getHttpServletRequest(PortletRequest pRequest)
+ {
+ return getRequestContext(pRequest).getRequest();
+ }
+
+ public static HttpServletResponse getHttpServletResponse(PortletRequest pRequest)
+ {
+ return getRequestContext(pRequest).getResponse();
+ }
+
+ public static boolean isEmpty(String s)
+ {
+ if (s == null)
+ return true;
+ if (s.trim().length() == 0)
+ return true;
+ return false;
+ }
+}
\ No newline at end of file
Added: portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/ServerData.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/ServerData.java?rev=693316&view=auto
==============================================================================
--- portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/ServerData.java (added)
+++ portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/ServerData.java Mon Sep 8 16:31:33 2008
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.mfa.util;
+
+/**
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+
+public class ServerData
+{
+ /** Cached serverName, */
+ private String serverName = null;
+
+ /** Cached serverPort. */
+ private int serverPort = 0;
+
+ /** Cached serverScheme. */
+ private String serverScheme = null;
+
+ /** Cached script name. */
+ private String scriptName = null;
+
+ /** Cached context path. */
+ private String contextPath = null;
+
+ /**
+ * Constructor.
+ *
+ * @param serverName The server name.
+ * @param serverPort The server port.
+ * @param serverScheme The server scheme.
+ * @param scriptName The script name.
+ * @param contextPath The context Path
+ */
+ public ServerData(String serverName,
+ int serverPort,
+ String serverScheme,
+ String scriptName,
+ String contextPath)
+ {
+ setServerName(serverName);
+ setServerPort(serverPort);
+ setServerScheme(serverScheme);
+ setScriptName(scriptName);
+ setContextPath(contextPath);
+ }
+
+ /**
+ * Copy-Constructor
+ *
+ * @param serverData A ServerData Object
+ */
+ public ServerData(ServerData serverData)
+ {
+ setServerName(serverData.getServerName());
+ setServerPort(serverData.getServerPort());
+ setServerScheme(serverData.getServerScheme());
+ setScriptName(serverData.getScriptName());
+ setContextPath(serverData.getContextPath());
+ }
+
+ /**
+ * A C'tor that takes a HTTP Request object and
+ * builds the server data from its contents
+ *
+ * @param req The HTTP Request
+ */
+ public ServerData(HttpServletRequest req)
+ {
+ setServerName(req.getServerName());
+ setServerPort(req.getServerPort());
+ setServerScheme(req.getScheme());
+ setScriptName(req.getServletPath());
+ setContextPath(req.getContextPath());
+ }
+
+ /**
+ * generates a new Object with the same values as this one.
+ *
+ * @return A cloned object.
+ */
+ public Object clone()
+ {
+ return new ServerData(this);
+ }
+
+ /**
+ * Get the name of the server.
+ *
+ * @return A String.
+ */
+ public String getServerName()
+ {
+ return StringUtils.isEmpty(serverName) ? "" : serverName;
+ }
+
+ /**
+ * Sets the cached serverName.
+ *
+ * @param serverName the server name.
+ */
+ public void setServerName(String serverName)
+ {
+ this.serverName = serverName;
+ }
+
+ /**
+ * Get the server port.
+ *
+ * @return the server port.
+ */
+ public int getServerPort()
+ {
+ return this.serverPort;
+ }
+
+ /**
+ * Sets the cached serverPort.
+ *
+ * @param serverPort the server port.
+ */
+ public void setServerPort(int serverPort)
+ {
+ this.serverPort = serverPort;
+ }
+
+ /**
+ * Get the server scheme.
+ *
+ * @return the server scheme.
+ */
+ public String getServerScheme()
+ {
+ return StringUtils.isEmpty(serverScheme) ? "" : serverScheme;
+ }
+
+ /**
+ * Sets the cached serverScheme.
+ *
+ * @param serverScheme the server scheme.
+ */
+ public void setServerScheme(String serverScheme)
+ {
+ this.serverScheme = serverScheme;
+ }
+
+ /**
+ * Get the script name
+ *
+ * @return the script name.
+ */
+ public String getScriptName()
+ {
+ return StringUtils.isEmpty(scriptName) ? "" : scriptName;
+ }
+
+ /**
+ * Set the script name.
+ *
+ * @param scriptName the script name.
+ */
+ public void setScriptName(String scriptName)
+ {
+ this.scriptName = scriptName;
+ }
+
+ /**
+ * Get the context path.
+ *
+ * @return the context path.
+ */
+ public String getContextPath()
+ {
+ return StringUtils.isEmpty(contextPath) ? "" : contextPath;
+ }
+
+ /**
+ * Set the context path.
+ *
+ * @param contextPath A String.
+ */
+ public void setContextPath(String contextPath)
+ {
+ this.contextPath = contextPath;
+ }
+
+ public String getBasePath()
+ {
+ StringBuffer buf = new StringBuffer();
+ getHostUrl(buf);
+ return buf.toString();
+ }
+
+
+ /**
+ * Appends the Host URL to the supplied StringBuffer.
+ *
+ * @param url A StringBuffer object
+ */
+ public void getHostUrl(StringBuffer url)
+ {
+ url.append(getServerScheme());
+ url.append("://");
+ url.append(getServerName());
+ if ((getServerScheme().equals(URIConstants.HTTP)
+ && getServerPort() != URIConstants.HTTP_PORT)
+ ||
+ (getServerScheme().equals(URIConstants.HTTPS)
+ && getServerPort() != URIConstants.HTTPS_PORT)
+ )
+ {
+ url.append(":");
+ url.append(getServerPort());
+ }
+ }
+
+ /**
+ * Returns this object as an URL.
+ *
+ * @return The contents of this object as a String
+ */
+ public String toString()
+ {
+ StringBuffer url = new StringBuffer();
+
+ getHostUrl(url);
+
+ url.append(getContextPath());
+ url.append(getScriptName());
+ return url.toString();
+ }
+}
Added: portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/URIConstants.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/URIConstants.java?rev=693316&view=auto
==============================================================================
--- portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/URIConstants.java (added)
+++ portals/jetspeed-2/applications/mfa/src/org/apache/jetspeed/security/mfa/util/URIConstants.java Mon Sep 8 16:31:33 2008
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.mfa.util;
+
+public interface URIConstants
+{
+ /** HTTP protocol. */
+ String HTTP = "http";
+
+ /** HTTPS protocol. */
+ String HTTPS = "https";
+
+ /** HTTP Default Port */
+ int HTTP_PORT = 80;
+
+ /** HTTPS Default Port */
+ int HTTPS_PORT = 443;
+
+ /** FTP Default Control Port */
+ int FTP_PORT = 20;
+
+ /** Path Info Data Marker */
+ int PATH_INFO = 0;
+
+ /** Query Data Marker */
+ int QUERY_DATA = 1;
+
+ /**
+ * The part of the URI which separates the protocol indicator (i.e. the
+ * scheme) from the rest of the URI.
+ */
+ String URI_SCHEME_SEPARATOR = "://";
+
+ /** CGI parameter for action name */
+ String CGI_ACTION_PARAM = "action";
+
+ /** CGI parameter for screen name */
+ String CGI_SCREEN_PARAM = "screen";
+
+ /** CGI parameter for template name */
+ String CGI_TEMPLATE_PARAM = "template";
+
+ /** prefix for event names */
+ String EVENT_PREFIX = "eventSubmit_";
+}
Added: portals/jetspeed-2/applications/mfa/xdocs/index.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/mfa/xdocs/index.xml?rev=693316&view=auto
==============================================================================
--- portals/jetspeed-2/applications/mfa/xdocs/index.xml (added)
+++ portals/jetspeed-2/applications/mfa/xdocs/index.xml Mon Sep 8 16:31:33 2008
@@ -0,0 +1,204 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<document>
+ <properties>
+ <title>Jetspeed MFA Portlet App</title>
+ <subtitle>Welcome to Jetspeed Portlet Application Multifaceted Authentication</subtitle>
+ <authors>
+ <person name="David Sean Taylor" email="taylor@apache.org" />
+ </authors>
+ </properties>
+ <body>
+ <section name="Using the Jetspeed MFA Portlet">
+ <p>This portlet application provides multi-faceted login portlet functionality including captcha and personal questions. Since this is a login portlet, it has minimal hooks to authenticate against Jetspeed. You should be able to easily adapt this portlet application to other portals by changing the authentication code.</p>
+ <subsection name='Usage with Jetspeed'>
+ <p>There is one portlet found in the portlet.xml: <b>MFALogin</b>. This portlet is configured in the portlet.xml with the following init parameters:</p>
+<table>
+<tr>
+<th>param name</th>
+<th>default value</th>
+<th>description</th>
+</tr>
+<tr>
+<td>cookieLifetime</td>
+<td>345600</td>
+<td>The lifetime of the stored cookie in seconds (4 days)</td>
+</tr>
+<tr>
+<td>maxNumberOfAuthenticationFailures</td>
+<td>5</td>
+<td>Maximum number of authentication failures before disabling a user</td>
+</tr>
+<tr>
+<td>randomQuestions</td>
+<td>What was the first and last name of our favorite teacher? In what city did you get married? ...</td>
+<td>A list of 24 personal questions which will be displayed to the user in random order separated by question marks (?)</td>
+</tr>
+</table>
+<p><b>IMPORTANT</b>The Jetspeed web.xml must be modified. The <i>LoginProxyServlet</i> servlet must have its <i>credentialsFromRequest</i> init param set to false:</p>
+<source><![CDATA[
+<servlet>
+ <servlet-name>LoginProxyServlet</servlet-name>
+ <servlet-class>org.apache.jetspeed.login.LoginProxyServlet</servlet-class>
+ <init-param>
+ <param-name>credentialsFromRequest</param-name>
+ <param-value>false</param-value>
+ </init-param>
+</servlet>
+]]></source>
+ </subsection>
+ <subsection name='Captcha'>
+<p>
+The following Captcha properties are configured in the mfa.properties found in the WEB-INF directory of your web application.
+</p>
+<h2>Property File</h2>
+<table border='1'>
+<tr>
+<th>Property</th>
+<th>Default Value</th>
+<th>Description</th>
+<tr>
+<td>captcha.directory</td>
+<td>/captchas</td>
+<td>The directory where all captchas will be stored when generated. For web applications, this directory should be a in a public viewable area.
+The directory name is relative to either the running program, or in the case of a web application, relative to the root of the web application</td>
+</tr>
+<tr>
+<td>captcha.effects.noise</td>
+<td>false</td>
+<td>Turn on the default noise generation for a capcha. Noise generation is not yet configurable to a fine grain but instead enables a set of general noise algorithms including
+drawing an XORed oval behind the text, and generating gray noise throughout the image.
+This feature is turned off by default and should not be used with an image background.</td>
+</tr>
+<tr>
+<td>captcha.image.background</td>
+<td>images/jetspeedlogo98.jpg</td>
+<td>Uses an image file as the background for the capcha image. The default provide is a company logo that has been run through a matte effect.</td>
+</tr>
+<tr>
+<td>captcha.image.background.use</td>
+<td>true</td>
+<td>Enable or disable using the background image defined in the captcha.image.background property.</td>
+</tr>
+<tr>
+<td>catcha.image.format</td>
+<td>.jpg</td>
+<td>The image format of the output captcha file. Known supported formats are .jpg and .png</td>
+</tr>
+<tr>
+<td>captcha.font.antialiasing</td>
+<td>true</td>
+<td>Enable or disable antialiasing. By enabling, you will generate a clearer image at the cost of slower rendering times.</td>
+</tr>
+<tr>
+<td>captcha.font.size</td>
+<td>36</td>
+<td>The point size of the font.</td>
+</tr>
+<tr>
+<td>captcha.font.style</td>
+<td>0</td>
+<td>The style of the font. Valid values are: PLAIN == 0, BOLD == 1, ITALIC == 2, BOLD_ITALIC == 3</td>
+</tr>
+<tr>
+<td>captcha.font.names</td>
+<td>Times</td>
+<td>A comma-separated list of font names. Make sure your server supports all listed fonted. When more than one font listed, fonts will be randomized.</td>
+</tr>
+<tr>
+<td>captcha.scanrate.seconds</td>
+<td>300</td>
+<td>Configures the cleanup thread for removal of captchas images. The cleanup thread will run by default every 300 seconds.</td>
+</tr>
+<tr>
+<td>captcha.timetolive.seconds</td>
+<td>120</td>
+<td>Configures the lifetime of a captcha image. Default is 120 seconds before it is deleted.</td>
+</tr>
+<tr>
+<td>captcha.text.maxlength</td>
+<td>8</td>
+<td>The maximum number of characters generated for the captcha string. Randomly used with captcha.text.minlength to vary the size of the captcha string.</td>
+</tr>
+<tr>
+<td>captcha.text.margin.left</td>
+<td>2</td>
+<td>The left-side margin where to start drawing the captcha string in in a device-independent coordinates.</td>
+</tr>
+<tr>
+<td>captcha.text.margin.bottom</td>
+<td>10</td>
+<td>The bottom margin where to start drawing the captcha string in in a device-independent coordinates.</td>
+</tr>
+<tr>
+<td>captcha.text.minlength</td>
+<td>6</td>
+<td>The minimum number of characters generated for the captcha string. Randomly used with captcha.text.maxlength to vary the size of the captcha string.</td>
+</tr>
+<tr>
+<td>captcha.text.rise.range</td>
+<td>30</td>
+<td>The rise from the bottom margin where to start drawing the captcha string. Setting to zero turns off the rising feature.
+If a positive number is used, the rise will randomly vary between the bottom margin and maximum rise value.</td>
+</tr>
+<tr>
+<td>captcha.text.rotation</td>
+<td>10</td>
+<td>Sets the rotation (vertical alignment variance) of a glyph to control this. The value is in radians.
+Value should be a positive number or zero. For example, setting to 35, will rotate the glyph randomly between -35 and 35 radians.
+Setting this value to 0 will turn off rotation.
+</td>
+</tr>
+<tr>
+<td>captcha.text.shear</td>
+<td>0</td>
+<td>Shearing slides one edge of an image along the X or Y axis, creating a parallelogram.
+The default value is 0, turning off all shearing effects. Shearing effects can make it more difficult for non-human readers to read the image.
+Shear values are specified in radians, with values closer to 1.0 creating a more drastic shearing effect.</td>
+</tr>
+<tr>
+<td>captcha.text.spacing</td>
+<td>2</td>
+<td>The space between captcha characters in device-independent coordinates. 0 is a valid value, but can make it difficult to read glyphes when combined with rotations.</td>
+</tr>
+<tr>
+<td>captcha.timestamp</td>
+<td>true</td>
+<td>Boolean value to enable printing a timestamp at the bottom of the captcha image in a small monospaced font.</td>
+</tr>
+<tr>
+<td>captcha.timestamp.24hr</td>
+<td>true</td>
+<td>Boolean value set to true when using 24 hour clock on timestamp, otherwise 12 hour clock.</td>
+</tr>
+<tr>
+<td>captcha.timestamp.tz</td>
+<td>America/New_York</td>
+<td>The Time Zone ID (TZID). The timestamp will be displayed for this timezone. You can also use timezone abbreviations such as EDT (Eastern Daylight Time).</td>
+</tr>
+<td>captcha.timestamp.font.size</td>
+<td>8</td>
+<td>The font size of the timestamp.</td>
+</tr>
+
+</table>
+
+ </subsection>
+ </section>
+ </body>
+</document>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org