Author: woonsan
Date: Sat Nov 1 14:26:28 2014
New Revision: 1635955
URL: http://svn.apache.org/r1635955
Log:
JS2-1302, JS2-1303, JS2-1304, JS2-1305
Replace WebContent1 portlets by WebContent2 portlets in demo; Rewrite j2-admin::SSOIFramePortlet based on webcontent2; Rewrite j2-admin::SSOReverseProxyIFramePortlet based on webcontent2;
Rewrite j2-admin::SSOWebContentPortlet based on webcontent2
Added:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/JetspeedSSOUtils.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/
portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/
portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages.properties
portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages_en.properties
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth.jsp
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth_success.jsp
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOInitHttpRequestCommand.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOProxyPortlet.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOReverseProxyIFramePortlet.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/security/sso/sso-demo.html
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/basicauth_success.jsp
portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/formauth_success.jsp
Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/JetspeedSSOUtils.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/JetspeedSSOUtils.java?rev=1635955&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/JetspeedSSOUtils.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/JetspeedSSOUtils.java Sat Nov 1 14:26:28 2014
@@ -0,0 +1,221 @@
+/*
+ * 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.portlets.sso;
+
+import java.net.URI;
+import java.security.AccessController;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.security.auth.Subject;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.jetspeed.security.JSSubject;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.sso.SSOManager;
+import org.apache.jetspeed.sso.SSOSite;
+import org.apache.jetspeed.sso.SSOUser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JetspeedSSOUtils
+{
+
+ private static Logger log = LoggerFactory.getLogger(JetspeedSSOUtils.class);
+
+ private JetspeedSSOUtils()
+ {
+ }
+
+ public static List<JetspeedSSOSiteCredentials> getSubjectSSOSiteCredentials(SSOManager ssoManager)
+ {
+ List<JetspeedSSOSiteCredentials> ssoCredsList = new ArrayList<JetspeedSSOSiteCredentials>();
+
+ try
+ {
+ Subject subject = JSSubject.getSubject(AccessController.getContext());
+ Collection<SSOSite> ssoSites = ssoManager.getSitesForSubject(subject);
+
+ if (ssoSites != null)
+ {
+ URI siteURI = null;
+ String scheme = "http";
+ String host = null;
+ int port = 80;
+
+ for (SSOSite ssoSite : ssoSites)
+ {
+ siteURI = URI.create(ssoSite.getURL());
+
+ if (StringUtils.isNotEmpty(siteURI.getScheme()))
+ {
+ scheme = siteURI.getScheme();
+ }
+
+ host = siteURI.getHost();
+
+ if (StringUtils.isEmpty(host))
+ {
+ log.warn("Skipping invalid SSO site URI (no host): '{}'.", host);
+ continue;
+ }
+
+ if (siteURI.getPort() > 0)
+ {
+ port = siteURI.getPort();
+ }
+
+ Collection<SSOUser> ssoUsers = ssoManager.getRemoteUsers(ssoSite, subject);
+
+ if (ssoUsers != null)
+ {
+ for (SSOUser ssoUser : ssoUsers)
+ {
+ String realm = ssoSite.getRealm();
+ PasswordCredential pwc = ssoManager.getCredentials(ssoUser);
+
+ JetspeedSSOSiteCredentials ssoCreds = new JetspeedSSOSiteCredentials(siteURI, host, port, realm);
+ ssoCreds.setScheme(scheme);
+ ssoCreds.setChallengeResponseAuthentication(ssoSite.isChallengeResponseAuthentication());
+ ssoCreds.setFormAuthentication(ssoSite.isFormAuthentication());
+ ssoCreds.setFormUserField(ssoSite.getFormUserField());
+ ssoCreds.setFormPwdField(ssoSite.getFormPwdField());
+ ssoCreds.setUsername(pwc.getUserName());
+ ssoCreds.setPassword(pwc.getPassword());
+
+ ssoCredsList.add(ssoCreds);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.warn("Failed to retrieve sso site credentials.", e);
+ }
+ else
+ {
+ log.warn("Failed to retrieve sso site credentials. {}", e.toString());
+ }
+ }
+
+ return ssoCredsList;
+ }
+
+ public static SSOSite getBestSubjectSSOSiteByURL(SSOManager ssoManager, String url) {
+ SSOSite ssoSite = null;
+
+ try
+ {
+ ssoSite = ssoManager.getSiteByUrl(url);
+ }
+ catch (Exception e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.warn("Failed to retrieve sso site by url: " + url, e);
+ }
+ else
+ {
+ log.warn("Failed to retrieve sso site by url: '{}'. {}", url, e.toString());
+ }
+ }
+
+ if (ssoSite == null)
+ {
+ try
+ {
+ Subject subject = JSSubject.getSubject(AccessController.getContext());
+ Collection<SSOSite> ssoSites = ssoManager.getSitesForSubject(subject);
+
+ if (ssoSites != null)
+ {
+ final URI inputURI = URI.create(url);
+ URI siteURI = null;
+
+ List<SSOSite> candidates = new ArrayList<SSOSite>();
+
+ for (SSOSite candidate : ssoSites)
+ {
+ siteURI = URI.create(candidate.getURL());
+
+ if (StringUtils.equals(inputURI.getScheme(), siteURI.getScheme()) &&
+ StringUtils.equals(inputURI.getHost(), siteURI.getHost()) &&
+ inputURI.getPort() == siteURI.getPort())
+ {
+ candidates.add(candidate);
+ }
+ }
+
+ if (!candidates.isEmpty())
+ {
+ if (candidates.size() == 1)
+ {
+ ssoSite = candidates.get(0);
+ }
+ else
+ {
+ Collections.sort(candidates, new Comparator<SSOSite>() {
+ @Override
+ public int compare(SSOSite site1, SSOSite site2)
+ {
+ URI uri1 = URI.create(site1.getURL());
+ URI uri2 = URI.create(site2.getURL());
+ int di1 = StringUtils.indexOfDifference(inputURI.getPath(), uri1.getPath());
+ int di2 = StringUtils.indexOfDifference(inputURI.getPath(), uri2.getPath());
+
+ if (di1 == di2)
+ {
+ return 0;
+ }
+ else if (di1 < di2)
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ });
+
+ ssoSite = candidates.get(candidates.size() - 1);
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.warn("Failed to retrieve sso site.", e);
+ }
+ else
+ {
+ log.warn("Failed to retrieve sso site. {}", e.toString());
+ }
+ }
+ }
+
+ return ssoSite;
+ }
+}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOIFramePortlet.java Sat Nov 1 14:26:28 2014
@@ -92,7 +92,7 @@ public class SSOIFramePortlet extends IF
public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException
{
String siteUrl = request.getPreferences().getValue("SRC", "");
- SSOSite site = sso.getSiteByUrl(siteUrl);
+ SSOSite site = JetspeedSSOUtils.getBestSubjectSSOSiteByURL(sso, siteUrl);
if (site != null)
{
try
@@ -141,11 +141,12 @@ public class SSOIFramePortlet extends IF
SSOSite site = null;
if (siteUrl != null)
{
- site = sso.getSiteByUrl(siteUrl);
+ site = JetspeedSSOUtils.getBestSubjectSSOSiteByURL(sso, siteUrl);
}
if (site == null)
{
- response.getWriter().print(SSOWebContentPortlet.NO_CREDENTIALS);
+ String warningMessage = getResourceBundle(request.getLocale()).getString("no.credentials");
+ response.getWriter().print(warningMessage);
return;
}
try
@@ -159,7 +160,8 @@ public class SSOIFramePortlet extends IF
}
else
{
- response.getWriter().print(SSOWebContentPortlet.NO_CREDENTIALS);
+ String warningMessage = getResourceBundle(request.getLocale()).getString("no.credentials");
+ response.getWriter().print(warningMessage);
return;
}
}
@@ -167,7 +169,8 @@ public class SSOIFramePortlet extends IF
{
if (e.getMessage().equals(SSOException.NO_CREDENTIALS_FOR_SITE))
{
- response.getWriter().print(SSOWebContentPortlet.NO_CREDENTIALS);
+ String warningMessage = getResourceBundle(request.getLocale()).getString("no.credentials");
+ response.getWriter().print(warningMessage);
return;
}
else
@@ -197,7 +200,7 @@ public class SSOIFramePortlet extends IF
actionResponse.setPortletMode(PortletMode.EDIT); // stay on edit
}
String siteUrl = request.getPreferences().getValue("SRC", "");
- SSOSite site = sso.getSiteByUrl(siteUrl);
+ SSOSite site = JetspeedSSOUtils.getBestSubjectSSOSiteByURL(sso, siteUrl);
try
{
if (!SecurityHelper.isEmpty(siteUrl) && !SecurityHelper.isEmpty(ssoPrincipal) && !SecurityHelper.isEmpty(ssoCredential))
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOInitHttpRequestCommand.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOInitHttpRequestCommand.java?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOInitHttpRequestCommand.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOInitHttpRequestCommand.java Sat Nov 1 14:26:28 2014
@@ -44,20 +44,21 @@ public class SSOInitHttpRequestCommand e
if (ssoCredsList != null && !ssoCredsList.isEmpty())
{
- JetspeedSSOSiteCredentials firstCreds = ssoCredsList.get(0);
-
- if (firstCreds.isFormAuthentication())
+ for (JetspeedSSOSiteCredentials ssoCreds : ssoCredsList)
{
- URI remoteURI = context.getRemoteURI();
-
- if (remoteURI != null && remoteURI.equals(firstCreds.getBaseURI()))
+ if (ssoCreds.isFormAuthentication())
{
- HttpRequestBase httpRequest = new HttpPost(remoteURI);
- List <NameValuePair> formParams = new ArrayList<NameValuePair>();
- formParams.add(new BasicNameValuePair(firstCreds.getFormUserField(), firstCreds.getUsername()));
- formParams.add(new BasicNameValuePair(firstCreds.getFormPwdField(), firstCreds.getPassword()));
- ((HttpPost) httpRequest).setEntity(new UrlEncodedFormEntity(formParams));
- return httpRequest;
+ URI remoteURI = context.getRemoteURI();
+
+ if (remoteURI != null && remoteURI.equals(ssoCreds.getBaseURI()))
+ {
+ HttpRequestBase httpRequest = new HttpPost(remoteURI);
+ List <NameValuePair> formParams = new ArrayList<NameValuePair>();
+ formParams.add(new BasicNameValuePair(ssoCreds.getFormUserField(), ssoCreds.getUsername()));
+ formParams.add(new BasicNameValuePair(ssoCreds.getFormPwdField(), ssoCreds.getPassword()));
+ ((HttpPost) httpRequest).setEntity(new UrlEncodedFormEntity(formParams));
+ return httpRequest;
+ }
}
}
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOPortletUtil.java Sat Nov 1 14:26:28 2014
@@ -104,7 +104,7 @@ public abstract class SSOPortletUtil
public static PasswordCredential getCredentialsForSite(SSOManager sso, String siteUrl, RenderRequest request)
{
PasswordCredential pwc = null;
- SSOSite site = sso.getSiteByUrl(siteUrl);
+ SSOSite site = JetspeedSSOUtils.getBestSubjectSSOSiteByURL(sso, siteUrl);
if (site != null)
{
return getCredentialsForSite(sso, site, request);
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOProxyPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOProxyPortlet.java?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOProxyPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOProxyPortlet.java Sat Nov 1 14:26:28 2014
@@ -128,7 +128,8 @@ public class SSOProxyPortlet extends Gen
if (ssoSite == null)
{
- response.getWriter().print(SSOWebContentPortlet.NO_CREDENTIALS);
+ String warningMessage = getResourceBundle(request.getLocale()).getString("no.credentials");
+ response.getWriter().print(warningMessage);
return;
}
// Set the content type
@@ -136,7 +137,7 @@ public class SSOProxyPortlet extends Gen
try
{
StringBuffer page= new StringBuffer();
- SSOSite site = sso.getSiteByUrl(ssoSite);
+ SSOSite site = JetspeedSSOUtils.getBestSubjectSSOSiteByURL(sso, ssoSite);
if (site == null)
{
response.getWriter().println("<P>Could not find site with name "+ssoSite+"</P>");
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOReverseProxyIFramePortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOReverseProxyIFramePortlet.java?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOReverseProxyIFramePortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOReverseProxyIFramePortlet.java Sat Nov 1 14:26:28 2014
@@ -17,10 +17,6 @@
package org.apache.jetspeed.portlets.sso;
import java.io.IOException;
-import java.net.URI;
-import java.security.AccessController;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import javax.portlet.PortletConfig;
@@ -28,14 +24,8 @@ import javax.portlet.PortletException;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import javax.security.auth.Subject;
-import org.apache.commons.lang.StringUtils;
-import org.apache.jetspeed.security.JSSubject;
-import org.apache.jetspeed.security.PasswordCredential;
import org.apache.jetspeed.sso.SSOManager;
-import org.apache.jetspeed.sso.SSOSite;
-import org.apache.jetspeed.sso.SSOUser;
import org.apache.portals.applications.webcontent2.portlet.IFrameGenericPortlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,90 +59,17 @@ public class SSOReverseProxyIFramePortle
@Override
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
{
- List<JetspeedSSOSiteCredentials> ssoCredsList = getJetspeedSSOSiteCredentialsList();
+ List<JetspeedSSOSiteCredentials> ssoCredsList = JetspeedSSOUtils.getSubjectSSOSiteCredentials(ssoManager);
- if (ssoCredsList != null && !ssoCredsList.isEmpty())
+ if (ssoCredsList.isEmpty())
{
- request.getPortletSession().setAttribute(SUBJECT_SSO_SITE_CREDS, ssoCredsList, PortletSession.APPLICATION_SCOPE);
+ String warningMessage = getResourceBundle(request.getLocale()).getString("no.credentials");
+ response.getWriter().print(warningMessage);
+ return;
}
- super.doView(request, response);
- }
-
- protected List<JetspeedSSOSiteCredentials> getJetspeedSSOSiteCredentialsList()
- {
- List<JetspeedSSOSiteCredentials> ssoCredsList = new ArrayList<JetspeedSSOSiteCredentials>();
-
- try
- {
- Subject subject = JSSubject.getSubject(AccessController.getContext());
- Collection<SSOSite> ssoSites = ssoManager.getSitesForSubject(subject);
+ request.getPortletSession().setAttribute(SUBJECT_SSO_SITE_CREDS, ssoCredsList, PortletSession.APPLICATION_SCOPE);
- if (ssoSites != null)
- {
- URI siteURI = null;
- String scheme = "http";
- String host = null;
- int port = 80;
-
- for (SSOSite ssoSite : ssoSites)
- {
- siteURI = URI.create(ssoSite.getURL());
-
- if (StringUtils.isNotEmpty(siteURI.getScheme()))
- {
- scheme = siteURI.getScheme();
- }
-
- host = siteURI.getHost();
-
- if (StringUtils.isEmpty(host))
- {
- log.warn("Skipping invalid SSO site URI (no host): '{}'.", host);
- continue;
- }
-
- if (siteURI.getPort() > 0)
- {
- port = siteURI.getPort();
- }
-
- Collection<SSOUser> ssoUsers = ssoManager.getRemoteUsers(ssoSite, subject);
-
- if (ssoUsers != null)
- {
- for (SSOUser ssoUser : ssoUsers)
- {
- String realm = ssoSite.getRealm();
- PasswordCredential pwc = ssoManager.getCredentials(ssoUser);
-
- JetspeedSSOSiteCredentials ssoCreds = new JetspeedSSOSiteCredentials(siteURI, host, port, realm);
- ssoCreds.setScheme(scheme);
- ssoCreds.setChallengeResponseAuthentication(ssoSite.isChallengeResponseAuthentication());
- ssoCreds.setFormAuthentication(ssoSite.isFormAuthentication());
- ssoCreds.setFormUserField(ssoSite.getFormUserField());
- ssoCreds.setFormPwdField(ssoSite.getFormPwdField());
- ssoCreds.setUsername(pwc.getUserName());
- ssoCreds.setPassword(pwc.getPassword());
-
- ssoCredsList.add(ssoCreds);
- }
- }
- }
- }
- }
- catch (Exception e)
- {
- if (log.isDebugEnabled())
- {
- log.warn("Failed to retrieve sso site credentials.", e);
- }
- else
- {
- log.warn("Failed to retrieve sso site credentials. {}", e.toString());
- }
- }
-
- return ssoCredsList;
+ super.doView(request, response);
}
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/sso/SSOWebContentPortlet.java Sat Nov 1 14:26:28 2014
@@ -97,6 +97,9 @@ public class SSOWebContentPortlet extend
public static final String SSO_TYPE_DEFAULT = SSO_TYPE_BASIC; // handled well even if nothing but credentials are set (see: doRequestedAuthentication)
+ /**
+ * @deprecated Use the key, 'no.credentials', from the portlet resource bundle instead.
+ */
public static final String NO_CREDENTIALS = "<p>No credentials configured for current user.</p>";
public static final String[] SSO_TYPES =
@@ -211,7 +214,7 @@ public class SSOWebContentPortlet extend
// processPreferencesAction(request, actionResponse);
// get the POST params -- requires HTML post params named above
String siteUrl = actionRequest.getPreferences().getValue("SRC", "");
- SSOSite site = sso.getSiteByUrl(siteUrl);
+ SSOSite site = JetspeedSSOUtils.getBestSubjectSSOSiteByURL(sso, siteUrl);
try
{
@@ -252,12 +255,13 @@ public class SSOWebContentPortlet extend
if (siteName != null)
{
- site = sso.getSiteByUrl(siteName);
+ site = JetspeedSSOUtils.getBestSubjectSSOSiteByURL(sso, siteName);
}
if (site == null)
{
- response.getWriter().print(NO_CREDENTIALS);
+ String warningMessage = getResourceBundle(request.getLocale()).getString("no.credentials");
+ response.getWriter().print(warningMessage);
return;
}
else
@@ -271,7 +275,8 @@ public class SSOWebContentPortlet extend
}
else
{
- response.getWriter().print(NO_CREDENTIALS);
+ String warningMessage = getResourceBundle(request.getLocale()).getString("no.credentials");
+ response.getWriter().print(warningMessage);
return;
}
}
Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages.properties?rev=1635955&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages.properties (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages.properties Sat Nov 1 14:26:28 2014
@@ -0,0 +1,16 @@
+# 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.
+
+no.credentials = <p>No credentials configured for current user.</p>
Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages_en.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages_en.properties?rev=1635955&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages_en.properties (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/sso/resources/Messages_en.properties Sat Nov 1 14:26:28 2014
@@ -0,0 +1,16 @@
+# 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.
+
+no.credentials = <p>No credentials configured for current user.</p>
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/portlet.xml Sat Nov 1 14:26:28 2014
@@ -1538,6 +1538,7 @@
<portlet-mode>HELP</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
+ <resource-bundle>org.apache.jetspeed.portlets.sso.resources.Messages</resource-bundle>
<portlet-info>
<title>SSOReverseProxyIFrame</title>
<short-title>SSOReverseProxyIFrame</short-title>
@@ -1634,6 +1635,7 @@
<portlet-mode>HELP</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
+ <resource-bundle>org.apache.jetspeed.portlets.sso.resources.Messages</resource-bundle>
<portlet-info>
<title>SSOFormBasedAuthReverseProxyIFrame</title>
<short-title>SSOFormBasedAuthReverseProxyIFrame</short-title>
@@ -1725,6 +1727,7 @@
<portlet-mode>HELP</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
+ <resource-bundle>org.apache.jetspeed.portlets.sso.resources.Messages</resource-bundle>
<portlet-info>
<title>SSO IFrame</title>
<short-title>SSO</short-title>
@@ -1746,7 +1749,7 @@
</preference>
<preference>
<name>SRC</name>
- <value>/demo/sso-demo</value>
+ <value>http://localhost:8080/j2-admin/examples/urlauth.jsp</value>
</preference>
<preference>
<name>HEIGHT</name>
@@ -1769,28 +1772,20 @@
<value>true</value>
</preference>
<preference>
+ <name>SCROLLING</name>
+ <value>AUTO</value>
+ </preference>
+ <preference>
<name>sso.type</name>
<value>url.base64</value>
</preference>
<preference>
<name>sso.url.Principal</name>
- <value>sso-principal</value>
+ <value>user</value>
</preference>
<preference>
<name>sso.url.Credential</name>
- <value>sso-credential</value>
- </preference>
- <preference>
- <name>sso.form.Action</name>
- <value></value>
- </preference>
- <preference>
- <name>sso.form.Principal</name>
- <value>USERID</value>
- </preference>
- <preference>
- <name>sso.form.Credential</name>
- <value>PASSWORD</value>
+ <value>pass</value>
</preference>
<preference>
<name>sso.form.Args</name>
@@ -1823,17 +1818,17 @@
<portlet-mode>VIEW</portlet-mode>
<portlet-mode>HELP</portlet-mode>
</supports>
- <supported-locale>en</supported-locale>
+ <supported-locale>en</supported-locale>
+ <resource-bundle>org.apache.jetspeed.portlets.sso.resources.Messages</resource-bundle>
<portlet-info>
<title>SSO Web Content</title>
<short-title>SSO Content</short-title>
<keywords>web,content,webnav,bridge,proxy,rewrite,SSO,single,sign-on</keywords>
</portlet-info>
- <portlet-preferences>
- <!-- NY TIMES EXAMPLE, user ID is 'jetspeed_test0' and password is 'jetspeed' -->
+ <portlet-preferences>
<preference>
<name>SRC</name>
- <value>http://www.nytimes.com</value>
+ <value>http://localhost:8080/j2-admin/examples/formauth_success.jsp</value>
</preference>
<preference>
<name>PROXYHOST</name>
@@ -1849,15 +1844,15 @@
</preference>
<preference>
<name>sso.form.Action</name>
- <value>http://www.nytimes.com/auth/login</value>
+ <value>http://localhost:8080/j2-admin/examples/formauth.jsp</value>
</preference>
<preference>
<name>sso.form.Principal</name>
- <value>USERID</value>
+ <value>user</value>
</preference>
<preference>
<name>sso.form.Credential</name>
- <value>PASSWORD</value>
+ <value>pass</value>
</preference>
<preference>
<name>sso.form.Args</name>
@@ -1895,14 +1890,13 @@
<portlet id="SSOProxyPortlet">
<description>SSO Proxy Portlet</description>
- <portlet-name>SSOProxyPortletPortlet</portlet-name>
+ <portlet-name>SSOProxyPortlet</portlet-name>
<display-name>SSOProxyPortlet</display-name>
<portlet-class>org.apache.jetspeed.portlets.sso.SSOProxyPortlet</portlet-class>
<init-param>
<name>EditPage</name>
<value>/WEB-INF/security/sso/edit-sso-proxy.vm</value>
</init-param>
-
<expiration-cache>-1</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
@@ -1910,6 +1904,7 @@
<portlet-mode>EDIT</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
+ <resource-bundle>org.apache.jetspeed.portlets.sso.resources.Messages</resource-bundle>
<portlet-info>
<title>SSOProxyPortlet</title>
<short-title>SSOProxyPortlet</short-title>
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/security/sso/sso-demo.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/security/sso/sso-demo.html?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/security/sso/sso-demo.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/security/sso/sso-demo.html Sat Nov 1 14:26:28 2014
@@ -14,21 +14,22 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<p>Here are the credentials you need to enter for the two demos on this page:</p>
+
+<p>
+ Here are the credentials you need to enter for the SSO demo portlets on this page:
+</p>
+
<table border="1" cellspacing="1" cellpadding="3">
-<tr>
-<th class="portlet-section-header">Demo Portlet</th>
-<th class="portlet-section-header">SSO Principal</th>
-<th class="portlet-section-header">SSO Credential</th>
-</tr>
-<tr>
-<td class='portlet-section-body'>SSO IFrame Demo</td>
-<td class='portlet-section-body'>007</td>
-<td class='portlet-section-body'>secret-password</td>
-</tr>
-<tr>
-<td class='portlet-section-body'>SSO Web Content Demo</td>
-<td class='portlet-section-body'>jetspeed_test0</td>
-<td class='portlet-section-body'>jetspeed</td>
-</tr>
-</table>
\ No newline at end of file
+ <tr>
+ <th class="portlet-section-header">SSO Principal</th>
+ <th class="portlet-section-header">SSO Credential</th>
+ </tr>
+ <tr>
+ <td class='portlet-section-body'>admin</td>
+ <td class='portlet-section-body'>admin</td>
+ </tr>
+ <tr>
+ <td class='portlet-section-body'>manager</td>
+ <td class='portlet-section-body'>manager</td>
+ </tr>
+</table>
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/basicauth_success.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/basicauth_success.jsp?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/basicauth_success.jsp (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/basicauth_success.jsp Sat Nov 1 14:26:28 2014
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<%--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -12,56 +13,72 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY
See the License for the specific language governing permissions and
limitations under the License.
--%>
-
-<%--
-WARNING:
-
- This example is provided to demonstrate the SSO feature of SSOReverseProxyIFrame portlet.
- This is not for production use!
- You should consult with other examples if you want to implement an authentication.
-
---%>
-
-<%@ page language="java"%>
-<%@ page import="javax.servlet.http.HttpServletRequest" %>
-<%@ page import="org.apache.commons.codec.binary.Base64" %>
-<%@ page import="org.apache.commons.lang.StringUtils" %>
-
-<%!
-private String getUsername(HttpServletRequest req)
-{
- try
- {
- String authorization = req.getHeader("Authorization");
-
- if (authorization != null)
- {
- Base64 base64 = new Base64();
- String userInfo = new String(base64.decode(authorization.substring(6).getBytes()));
- String [] userInfoArray = StringUtils.split(userInfo, ":");
- return userInfoArray[0];
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- return null;
-}
-%>
<html>
-<head>
-<title>Authorized by Basic authentication!</title>
-</head>
-<body>
-<p>Hello, <%=session.getAttribute("examples.basicauth.username")%>. You have been authorized by Basic authentication !!!</p>
-
-<hr/>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Jetspeed 2 - Want to Get Involved? (Basic SSO Example)</title>
+ <style type="text/css" media="all">
+ @import url("http://portals.apache.org/jetspeed-2/css/maven-base.css");
+ @import url("http://portals.apache.org/jetspeed-2/css/maven-theme.css");
+ @import url("http://portals.apache.org/jetspeed-2/css/site.css");
+ </style>
+ <link rel="stylesheet" href="http://portals.apache.org/jetspeed-2/css/print.css" type="text/css" media="print" />
+ </head>
+ <body class="composite">
+
+ <div id="contentBox">
+ <div class="section"><h2><a name="Want_to_Get_Involved"></a>Want to Get Involved? (Basic SSO Example)</h2>
+<div class="section"><h3>Hello, <%=session.getAttribute("examples.basicauth.username")%>!</h3>
+<p>You have been authorized by Basic authentication through Jetspeed-2 SSO.</p>
+</div>
+<div class="section"><h3><a name="Why_Should_I_Get_Involved"></a>Why Should I Get Involved?</h3>
+<p>
+ There are many reasons why you want to get involved, just a few strong points:
+ <ul><li>If you help others solve their issues, they will most likely help you when you run into some problems.</li>
+<li>By contributing patches, you can influence the prioritization of functionality and get your changes incorporated.</li>
+<li>By reporting issues, you help Jetspeed-2 become a stronger project and improve its quality overall.</li>
+<li>You will meet and get to know great people as well as share and learn best practices which will help you on
+ your project.</li>
+</ul>
+
+ We are looking forward to have you part of our community!
+ </p>
+</div>
+<div class="section"><h3><a name="How_do_I_Join_the_Project"></a>How do I Join the Project?</h3>
+<p>
+ Projects at Apache operate under a <a class="externalLink" href="http://www.apache.org/foundation/how-it-works.html#meritocracy">meritocracy</a>.
+ To become a committer, you first need to demonstrate your committment. The best way to do so is to start contributing patch,
+ participate in the community and make your interest known. It takes time and willingness to help and contribute! This may
+ seem a bit intimidating at first, but the community will always help people who show interest and committment.
+ </p>
+</div>
+<div class="section"><h3><a name="Simple_Things_I_Can_Do_to_Help"></a>Simple Things I Can Do to Help</h3>
<p>
-This example is provided to demonstrate the SSO feature of SSOReverseProxyIFrame portlet.<br/>
-<strong>This is not for production use! You should consult with other examples <br/>if you want to implement an authentication.</strong>
+ There are many ways to help with Jetspeed-2 as with most open source projects:
+ <ul><li>Subscribe to the <a class="externalLink" href="http://portals.apache.org/jetspeed-2/mail-lists.html">user mailing list</a> and help answer questions from the community.
+ In open source a thriving community makes the project successful. Don't be shy to ask basic questions, we have all
+ been there.</li>
+<li>Report bugs and issues that you encounter in <a class="externalLink" href="http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10492">Jetspeed-2 bug tracking system</a>.
+ Prior to reporting a bug, make sure to discuss the issue on the <a class="externalLink" href="http://portals.apache.org/jetspeed-2/mail-lists.html">user mailing list</a> or even the
+ <a class="externalLink" href="http://portals.apache.org/jetspeed-2/mail-lists.html">developer mailing list</a>.</li>
+<li>When you encounter an issue, you may be compelled to fix it. We encourage this as this makes for a vibrant
+ community. Once you have a fix, <a class="externalLink" href="http://portals.apache.org/jetspeed-2/devguide/patches.html">submit a patch</a> on the reporting issue.</li>
+</ul>
</p>
+</div>
+<div class="section"><h3><a name="Other_Resources_for_Help"></a>Other Resources for Help</h3>
+<p>
+ Here are some useful links for other resources for help.
+ <ul><li><a class="externalLink" href="http://portals.apache.org/development/code-standards.html">Portals project coding standards</a>.</li>
+<li><a class="externalLink" href="http://portals.apache.org/development/documentation.html">Portals project documentation standards</a>.</li>
+<li><a class="externalLink" href="http://www.apache.org/foundation/how-it-works.html">How does the Apache Software Foundation work</a>?</li>
+<li><a class="externalLink" href="http://people.apache.org/~coar/mlists.html#portals.apache.org">Portals mailing lists statistics</a>. This can be helpful
+ to help you decide which mailing list to subscribe to.</li>
+</ul>
+</p>
+</subection></div>
+
+ </div>
-</body>
+ </body>
</html>
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/formauth_success.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/formauth_success.jsp?rev=1635955&r1=1635954&r2=1635955&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/formauth_success.jsp (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/formauth_success.jsp Sat Nov 1 14:26:28 2014
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<%--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -12,29 +13,72 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY
See the License for the specific language governing permissions and
limitations under the License.
--%>
-
-<%--
-WARNING:
-
- This example is provided to demonstrate the SSO feature of SSOReverseProxyIFrame portlet.
- This is not for production use!
- You should consult with other examples if you want to implement an authentication.
-
---%>
-
-<%@ page language="java"%>
<html>
-<head>
-<title>Authorized by form-based authentication!</title>
-</head>
-<body>
-<p>Hello, <%=session.getAttribute("examples.formauth.username")%>. You have been authorized by form-based authentication !!!</p>
-
-<hr/>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Jetspeed 2 - Want to Get Involved? (Form SSO Example)</title>
+ <style type="text/css" media="all">
+ @import url("http://portals.apache.org/jetspeed-2/css/maven-base.css");
+ @import url("http://portals.apache.org/jetspeed-2/css/maven-theme.css");
+ @import url("http://portals.apache.org/jetspeed-2/css/site.css");
+ </style>
+ <link rel="stylesheet" href="http://portals.apache.org/jetspeed-2/css/print.css" type="text/css" media="print" />
+ </head>
+ <body class="composite">
+
+ <div id="contentBox">
+ <div class="section"><h2><a name="Want_to_Get_Involved"></a>Want to Get Involved? (Form SSO Example)</h2>
+<div class="section"><h3>Hello, <%=session.getAttribute("examples.formauth.username")%>!</h3>
+<p>You have been authorized by Form authentication through Jetspeed-2 SSO.</p>
+</div>
+<div class="section"><h3><a name="Why_Should_I_Get_Involved"></a>Why Should I Get Involved?</h3>
+<p>
+ There are many reasons why you want to get involved, just a few strong points:
+ <ul><li>If you help others solve their issues, they will most likely help you when you run into some problems.</li>
+<li>By contributing patches, you can influence the prioritization of functionality and get your changes incorporated.</li>
+<li>By reporting issues, you help Jetspeed-2 become a stronger project and improve its quality overall.</li>
+<li>You will meet and get to know great people as well as share and learn best practices which will help you on
+ your project.</li>
+</ul>
+
+ We are looking forward to have you part of our community!
+ </p>
+</div>
+<div class="section"><h3><a name="How_do_I_Join_the_Project"></a>How do I Join the Project?</h3>
+<p>
+ Projects at Apache operate under a <a class="externalLink" href="http://www.apache.org/foundation/how-it-works.html#meritocracy">meritocracy</a>.
+ To become a committer, you first need to demonstrate your committment. The best way to do so is to start contributing patch,
+ participate in the community and make your interest known. It takes time and willingness to help and contribute! This may
+ seem a bit intimidating at first, but the community will always help people who show interest and committment.
+ </p>
+</div>
+<div class="section"><h3><a name="Simple_Things_I_Can_Do_to_Help"></a>Simple Things I Can Do to Help</h3>
<p>
-This example is provided to demonstrate the SSO feature of SSOReverseProxyIFrame portlet.<br/>
-<strong>This is not for production use! You should consult with other examples <br/>if you want to implement an authentication.</strong>
+ There are many ways to help with Jetspeed-2 as with most open source projects:
+ <ul><li>Subscribe to the <a class="externalLink" href="http://portals.apache.org/jetspeed-2/mail-lists.html">user mailing list</a> and help answer questions from the community.
+ In open source a thriving community makes the project successful. Don't be shy to ask basic questions, we have all
+ been there.</li>
+<li>Report bugs and issues that you encounter in <a class="externalLink" href="http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10492">Jetspeed-2 bug tracking system</a>.
+ Prior to reporting a bug, make sure to discuss the issue on the <a class="externalLink" href="http://portals.apache.org/jetspeed-2/mail-lists.html">user mailing list</a> or even the
+ <a class="externalLink" href="http://portals.apache.org/jetspeed-2/mail-lists.html">developer mailing list</a>.</li>
+<li>When you encounter an issue, you may be compelled to fix it. We encourage this as this makes for a vibrant
+ community. Once you have a fix, <a class="externalLink" href="http://portals.apache.org/jetspeed-2/devguide/patches.html">submit a patch</a> on the reporting issue.</li>
+</ul>
</p>
+</div>
+<div class="section"><h3><a name="Other_Resources_for_Help"></a>Other Resources for Help</h3>
+<p>
+ Here are some useful links for other resources for help.
+ <ul><li><a class="externalLink" href="http://portals.apache.org/development/code-standards.html">Portals project coding standards</a>.</li>
+<li><a class="externalLink" href="http://portals.apache.org/development/documentation.html">Portals project documentation standards</a>.</li>
+<li><a class="externalLink" href="http://www.apache.org/foundation/how-it-works.html">How does the Apache Software Foundation work</a>?</li>
+<li><a class="externalLink" href="http://people.apache.org/~coar/mlists.html#portals.apache.org">Portals mailing lists statistics</a>. This can be helpful
+ to help you decide which mailing list to subscribe to.</li>
+</ul>
+</p>
+</subection></div>
+
+ </div>
-</body>
+ </body>
</html>
Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth.jsp?rev=1635955&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth.jsp (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth.jsp Sat Nov 1 14:26:28 2014
@@ -0,0 +1,95 @@
+<%--
+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.
+--%>
+
+<%--
+WARNING:
+
+ This example is provided to demonstrate the SSO feature of SSOReverseProxyIFrame portlet.
+ This is not for production use!
+ You should consult with other examples if you want to implement an authentication.
+
+--%>
+
+<%@ page language="java"%>
+<%@ page import="java.util.Map" %>
+<%@ page import="java.util.HashMap" %>
+<%@ page import="javax.servlet.http.HttpServletResponse" %>
+<%@ page import="org.apache.commons.codec.binary.Base64" %>
+<%@ page import="org.apache.commons.lang.StringUtils" %>
+
+<%!
+private Map userInfoMap = new HashMap();
+
+public void jspInit()
+{
+ userInfoMap.put("manager", "manager");
+ userInfoMap.put("admin", "admin");
+}
+
+private boolean authenticate(HttpServletRequest req)
+{
+ try
+ {
+ String username = req.getParameter("user");
+ String password = req.getParameter("pass");
+
+ if (username != null && password != null)
+ {
+ Base64 decoder = new Base64();
+ username = new String(decoder.decode(username));
+ password = new String(decoder.decode(password));
+
+ if (password.equals(userInfoMap.get(username)))
+ {
+ req.getSession().setAttribute("examples.formauth.username", username);
+ return true;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ return false;
+}
+%>
+<%
+if (authenticate(request))
+{
+ response.sendRedirect("urlauth_success.jsp");
+}
+else
+{
+%>
+<html>
+<head>
+<title>URL Authentication Example</title>
+</head>
+<body>
+
+<p>
+This example is provided to demonstrate the SSO feature of SSOIFramePortlet.<br/>
+<strong>This is not for production use! You should consult with other examples <br/>if you want to implement an authentication.</strong>
+</p>
+<hr/>
+
+<p>Please access with a URL having proper authentication information.</p>
+
+</body>
+</html>
+<%
+}
+%>
Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth_success.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth_success.jsp?rev=1635955&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth_success.jsp (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/examples/urlauth_success.jsp Sat Nov 1 14:26:28 2014
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<%--
+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.
+--%>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Jetspeed 2 - Want to Get Involved? (URL SSO Example)</title>
+ <style type="text/css" media="all">
+ @import url("http://portals.apache.org/jetspeed-2/css/maven-base.css");
+ @import url("http://portals.apache.org/jetspeed-2/css/maven-theme.css");
+ @import url("http://portals.apache.org/jetspeed-2/css/site.css");
+ </style>
+ <link rel="stylesheet" href="http://portals.apache.org/jetspeed-2/css/print.css" type="text/css" media="print" />
+ </head>
+ <body class="composite">
+
+ <div id="contentBox">
+ <div class="section"><h2><a name="Want_to_Get_Involved"></a>Want to Get Involved? (URL SSO Example)</h2>
+<div class="section"><h3>Hello, <%=session.getAttribute("examples.formauth.username")%>!</h3>
+<p>You have been authorized by URL authentication through Jetspeed-2 SSO.</p>
+</div>
+<div class="section"><h3><a name="Why_Should_I_Get_Involved"></a>Why Should I Get Involved?</h3>
+<p>
+ There are many reasons why you want to get involved, just a few strong points:
+ <ul><li>If you help others solve their issues, they will most likely help you when you run into some problems.</li>
+<li>By contributing patches, you can influence the prioritization of functionality and get your changes incorporated.</li>
+<li>By reporting issues, you help Jetspeed-2 become a stronger project and improve its quality overall.</li>
+<li>You will meet and get to know great people as well as share and learn best practices which will help you on
+ your project.</li>
+</ul>
+
+ We are looking forward to have you part of our community!
+ </p>
+</div>
+<div class="section"><h3><a name="How_do_I_Join_the_Project"></a>How do I Join the Project?</h3>
+<p>
+ Projects at Apache operate under a <a class="externalLink" href="http://www.apache.org/foundation/how-it-works.html#meritocracy">meritocracy</a>.
+ To become a committer, you first need to demonstrate your committment. The best way to do so is to start contributing patch,
+ participate in the community and make your interest known. It takes time and willingness to help and contribute! This may
+ seem a bit intimidating at first, but the community will always help people who show interest and committment.
+ </p>
+</div>
+<div class="section"><h3><a name="Simple_Things_I_Can_Do_to_Help"></a>Simple Things I Can Do to Help</h3>
+<p>
+ There are many ways to help with Jetspeed-2 as with most open source projects:
+ <ul><li>Subscribe to the <a class="externalLink" href="http://portals.apache.org/jetspeed-2/mail-lists.html">user mailing list</a> and help answer questions from the community.
+ In open source a thriving community makes the project successful. Don't be shy to ask basic questions, we have all
+ been there.</li>
+<li>Report bugs and issues that you encounter in <a class="externalLink" href="http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10492">Jetspeed-2 bug tracking system</a>.
+ Prior to reporting a bug, make sure to discuss the issue on the <a class="externalLink" href="http://portals.apache.org/jetspeed-2/mail-lists.html">user mailing list</a> or even the
+ <a class="externalLink" href="http://portals.apache.org/jetspeed-2/mail-lists.html">developer mailing list</a>.</li>
+<li>When you encounter an issue, you may be compelled to fix it. We encourage this as this makes for a vibrant
+ community. Once you have a fix, <a class="externalLink" href="http://portals.apache.org/jetspeed-2/devguide/patches.html">submit a patch</a> on the reporting issue.</li>
+</ul>
+</p>
+</div>
+<div class="section"><h3><a name="Other_Resources_for_Help"></a>Other Resources for Help</h3>
+<p>
+ Here are some useful links for other resources for help.
+ <ul><li><a class="externalLink" href="http://portals.apache.org/development/code-standards.html">Portals project coding standards</a>.</li>
+<li><a class="externalLink" href="http://portals.apache.org/development/documentation.html">Portals project documentation standards</a>.</li>
+<li><a class="externalLink" href="http://www.apache.org/foundation/how-it-works.html">How does the Apache Software Foundation work</a>?</li>
+<li><a class="externalLink" href="http://people.apache.org/~coar/mlists.html#portals.apache.org">Portals mailing lists statistics</a>. This can be helpful
+ to help you decide which mailing list to subscribe to.</li>
+</ul>
+</p>
+</subection></div>
+
+ </div>
+
+ </body>
+</html>
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.