Author: sohil.shah(a)jboss.com
Date: 2009-12-06 10:31:35 -0500 (Sun, 06 Dec 2009)
New Revision: 949
Added:
components/sso/trunk/packaging/opensso/src/main/config/plugin/WEB-INF/
components/sso/trunk/packaging/opensso/src/main/config/plugin/WEB-INF/classes/
components/sso/trunk/packaging/opensso/src/main/config/plugin/WEB-INF/classes/gatein.properties
Modified:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/GenericSSOAgent.java
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/opensso/OpenSSOAgent.java
components/sso/trunk/gatein-opensso-plugin/src/main/java/org/gatein/sso/opensso/plugin/AuthenticationPlugin.java
components/sso/trunk/packaging/cas/src/main/config/gatein/portal.war/WEB-INF/web.xml
components/sso/trunk/packaging/opensso/pom.xml
components/sso/trunk/packaging/opensso/src/main/config/gatein/portal.war/WEB-INF/web.xml
Log:
opensso integration - code stablization
Modified:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/GenericSSOAgent.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/GenericSSOAgent.java 2009-12-06
14:30:49 UTC (rev 948)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/GenericSSOAgent.java 2009-12-06
15:31:35 UTC (rev 949)
@@ -39,9 +39,12 @@
*/
public class GenericSSOAgent extends InitiateLoginServlet
{
+ private static final long serialVersionUID = 6330639010812906309L;
+
private static Logger log = Logger.getLogger(GenericSSOAgent.class);
- private String casServerUrl;
+ private String ssoServerUrl;
+ private String ssoCookieName;
@Override
@@ -49,7 +52,8 @@
{
super.init();
- this.casServerUrl =
this.getServletConfig().getInitParameter("casServerUrl");
+ this.ssoServerUrl =
this.getServletConfig().getInitParameter("ssoServerUrl");
+ this.ssoCookieName =
this.getServletConfig().getInitParameter("ssoCookieName");
}
@Override
@@ -82,7 +86,7 @@
if (ticket != null && ticket.trim().length() > 0)
{
- CASAgent.getInstance(this.casServerUrl).validateTicket(httpRequest, ticket);
+ CASAgent.getInstance(this.ssoServerUrl).validateTicket(httpRequest, ticket);
}
else if (jossoAssertion != null && jossoAssertion.trim().length() > 0)
{
@@ -91,7 +95,7 @@
else
{
//See if an OpenSSO Token was used
- OpenSSOAgent.getInstance().validateTicket(httpRequest);
+ OpenSSOAgent.getInstance(this.ssoServerUrl,
this.ssoCookieName).validateTicket(httpRequest);
}
}
}
Modified:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/opensso/OpenSSOAgent.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/opensso/OpenSSOAgent.java 2009-12-06
14:30:49 UTC (rev 948)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/opensso/OpenSSOAgent.java 2009-12-06
15:31:35 UTC (rev 949)
@@ -42,17 +42,16 @@
private static Logger log = Logger.getLogger(OpenSSOAgent.class);
private static OpenSSOAgent singleton;
- private String cookieName;
- private String openSSOUrl;
+ private String cookieName;
+ private String serverUrl;
- private OpenSSOAgent()
- {
- //TODO: make this part of externally configured properties
- this.cookieName = "iPlanetDirectoryPro";
- this.openSSOUrl = "http://localhost:8888/opensso";
+ private OpenSSOAgent(String serverUrl, String cookieName)
+ {
+ this.serverUrl = serverUrl;
+ this.cookieName = cookieName;
}
- public static OpenSSOAgent getInstance()
+ public static OpenSSOAgent getInstance(String serverUrl, String cookieName)
{
if(OpenSSOAgent.singleton == null)
{
@@ -60,33 +59,13 @@
{
if(OpenSSOAgent.singleton == null)
{
- OpenSSOAgent.singleton = new OpenSSOAgent();
+ OpenSSOAgent.singleton = new OpenSSOAgent(serverUrl, cookieName);
}
}
}
return OpenSSOAgent.singleton;
}
- public String getCookieName()
- {
- return cookieName;
- }
-
- public void setCookieName(String cookieName)
- {
- this.cookieName = cookieName;
- }
-
- public String getOpenSSOUrl()
- {
- return openSSOUrl;
- }
-
- public void setOpenSSOUrl(String openSSOUrl)
- {
- this.openSSOUrl = openSSOUrl;
- }
-
public void validateTicket(HttpServletRequest httpRequest) throws Exception
{
String token = null;
@@ -124,7 +103,7 @@
PostMethod post = null;
try
{
- String url = this.openSSOUrl+"/identity/isTokenValid";
+ String url = this.serverUrl+"/identity/isTokenValid";
post = new PostMethod(url);
post.addParameter("tokenid", token);
@@ -159,7 +138,7 @@
try
{
String uid = null;
- String url = this.openSSOUrl+"/identity/attributes";
+ String url = this.serverUrl+"/identity/attributes";
post = new PostMethod(url);
post.addParameter("subjectid", token);
post.addParameter("attributes_names", "uid");
Modified:
components/sso/trunk/gatein-opensso-plugin/src/main/java/org/gatein/sso/opensso/plugin/AuthenticationPlugin.java
===================================================================
---
components/sso/trunk/gatein-opensso-plugin/src/main/java/org/gatein/sso/opensso/plugin/AuthenticationPlugin.java 2009-12-06
14:30:49 UTC (rev 948)
+++
components/sso/trunk/gatein-opensso-plugin/src/main/java/org/gatein/sso/opensso/plugin/AuthenticationPlugin.java 2009-12-06
15:31:35 UTC (rev 949)
@@ -21,7 +21,11 @@
*/
package org.gatein.sso.opensso.plugin;
+import java.util.Properties;
import java.util.Map;
+import java.io.InputStream;
+import java.io.IOException;
+
import java.security.Principal;
import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
@@ -79,15 +83,33 @@
public AuthenticationPlugin()
{
-
}
public void init(Subject subject, Map sharedState, Map options)
{
- //TODO: make this configurable
- this.gateInHost = "localhost";
- this.gateInPort = "8080";
- this.gateInContext = "portal";
+ InputStream is = null;
+ try
+ {
+ //Load the GateIn properties
+ Properties properties = new Properties();
+ is =
Thread.currentThread().getContextClassLoader().getResourceAsStream("gatein.properties");
+ properties.load(is);
+
+ this.gateInHost = properties.getProperty("host");
+ this.gateInPort = properties.getProperty("port");
+ this.gateInContext = properties.getProperty("context");
+ }
+ catch(IOException ioe)
+ {
+
+ }
+ finally
+ {
+ if(is != null)
+ {
+ try{is.close();}catch(Exception e){}
+ }
+ }
}
public int process(Callback[] callbacks, int state) throws AuthLoginException
Modified:
components/sso/trunk/packaging/cas/src/main/config/gatein/portal.war/WEB-INF/web.xml
===================================================================
---
components/sso/trunk/packaging/cas/src/main/config/gatein/portal.war/WEB-INF/web.xml 2009-12-06
14:30:49 UTC (rev 948)
+++
components/sso/trunk/packaging/cas/src/main/config/gatein/portal.war/WEB-INF/web.xml 2009-12-06
15:31:35 UTC (rev 949)
@@ -182,8 +182,8 @@
<servlet-name>InitiateLoginServlet</servlet-name>
<servlet-class>org.gatein.sso.agent.GenericSSOAgent</servlet-class>
<init-param>
- <param-name>casServerUrl</param-name>
- <param-value>http://localhost:8888/cas</param-value>
+ <param-name>ssoServerUrl</param-name>
+ <param-value>http://localhost:8888/cas</param-value>
</init-param>
</servlet>
Modified: components/sso/trunk/packaging/opensso/pom.xml
===================================================================
--- components/sso/trunk/packaging/opensso/pom.xml 2009-12-06 14:30:49 UTC (rev 948)
+++ components/sso/trunk/packaging/opensso/pom.xml 2009-12-06 15:31:35 UTC (rev 949)
@@ -149,6 +149,9 @@
<copy
todir="${basedir}/target/plugin/webapps/opensso/config/auth/default">
<fileset
dir="${basedir}/src/main/config/plugin/config/auth/default"/>
</copy>
+ <copy
todir="${basedir}/target/plugin/webapps/opensso/WEB-INF">
+ <fileset
dir="${basedir}/src/main/config/plugin/WEB-INF"/>
+ </copy>
<!-- prepare the plugin jar -->
<copy
tofile="${basedir}/target/plugin/webapps/opensso/WEB-INF/lib/gatein-opensso-plugin.jar"
Modified:
components/sso/trunk/packaging/opensso/src/main/config/gatein/portal.war/WEB-INF/web.xml
===================================================================
---
components/sso/trunk/packaging/opensso/src/main/config/gatein/portal.war/WEB-INF/web.xml 2009-12-06
14:30:49 UTC (rev 948)
+++
components/sso/trunk/packaging/opensso/src/main/config/gatein/portal.war/WEB-INF/web.xml 2009-12-06
15:31:35 UTC (rev 949)
@@ -182,9 +182,13 @@
<servlet-name>InitiateLoginServlet</servlet-name>
<servlet-class>org.gatein.sso.agent.GenericSSOAgent</servlet-class>
<init-param>
- <param-name>casServerUrl</param-name>
- <param-value>http://localhost:8888/cas</param-value>
- </init-param>
+ <param-name>ssoServerUrl</param-name>
+ <param-value>http://localhost:8888/opensso</param-value>
+ </init-param>
+ <init-param>
+ <param-name>ssoCookieName</param-name>
+ <param-value>iPlanetDirectoryPro</param-value>
+ </init-param>
</servlet>
<servlet>
Added:
components/sso/trunk/packaging/opensso/src/main/config/plugin/WEB-INF/classes/gatein.properties
===================================================================
---
components/sso/trunk/packaging/opensso/src/main/config/plugin/WEB-INF/classes/gatein.properties
(rev 0)
+++
components/sso/trunk/packaging/opensso/src/main/config/plugin/WEB-INF/classes/gatein.properties 2009-12-06
15:31:35 UTC (rev 949)
@@ -0,0 +1,5 @@
+host=localhost
+
+port=8080
+
+context=portal
\ No newline at end of file
Show replies by date