Author: mposolda
Date: 2012-01-09 08:56:26 -0500 (Mon, 09 Jan 2012)
New Revision: 8283
Added:
components/sso/trunk/josso/gatein-agent-josso181/
components/sso/trunk/josso/gatein-agent-josso181/pom.xml
components/sso/trunk/josso/gatein-agent-josso181/src/
components/sso/trunk/josso/gatein-agent-josso181/src/main/
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/impl/
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/impl/GateInAuthenticationDelegateImpl.java
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/impl/GateInJOSSOAgentFactoryImpl.java
components/sso/trunk/josso/gatein-agent-josso181/src/test/
components/sso/trunk/josso/gatein-agent-josso182/
components/sso/trunk/josso/gatein-agent-josso182/pom.xml
components/sso/trunk/josso/gatein-agent-josso182/src/
components/sso/trunk/josso/gatein-agent-josso182/src/main/
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/impl/
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/impl/GateInAuthenticationDelegateImpl.java
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/impl/GateInJOSSOAgentFactoryImpl.java
components/sso/trunk/josso/gatein-agent-josso182/src/test/
Removed:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInAgentRequest.java
Modified:
components/sso/trunk/agent/pom.xml
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInLocalSession.java
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInSSOAgent.java
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/JOSSOAgent.java
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/LocalSessionImpl.java
components/sso/trunk/agent/src/test/java/org/gatein/sso/agent/josso/TestAssertionValidation.java
components/sso/trunk/josso/gatein-josso-plugin/src/main/java/org/gatein/sso/josso/plugin/GateinIdentityPlugin.java
components/sso/trunk/josso/gatein-josso-portal/pom.xml
components/sso/trunk/josso/gatein-josso-portal/src/main/assembly/src.xml
components/sso/trunk/josso/gatein-josso-portal/src/main/resources/plugin/lib/josso-gateway-config.xml
components/sso/trunk/josso/pom.xml
components/sso/trunk/pom.xml
Log:
GTNSSO-1 Support for JOSSO 1.8.2 and newer
Modified: components/sso/trunk/agent/pom.xml
===================================================================
--- components/sso/trunk/agent/pom.xml 2012-01-09 04:11:01 UTC (rev 8282)
+++ components/sso/trunk/agent/pom.xml 2012-01-09 13:56:26 UTC (rev 8283)
@@ -20,7 +20,6 @@
<dependency>
<groupId>org.gatein.sso</groupId>
<artifactId>sso-auth-callback</artifactId>
- <version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Deleted:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInAgentRequest.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInAgentRequest.java 2012-01-09
04:11:01 UTC (rev 8282)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInAgentRequest.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -1,59 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.gatein.sso.agent.josso;
-
-import org.josso.agent.LocalSession;
-
-import org.josso.agent.http.HttpSSOAgentRequest;
-import org.josso.agent.http.JOSSOSecurityContext;
-
-/**
- *
- * @author <a href="mailto:sgonzalez@josso.org">Sebastian Gonzalez
Oyuela</a>
- */
-public class GateInAgentRequest extends HttpSSOAgentRequest
-{
- private JOSSOSecurityContext ctx;
-
- public GateInAgentRequest(int action, String sessionId, LocalSession session,
- String assertionId)
- {
- super(action, sessionId, session, assertionId);
- }
-
- public GateInAgentRequest(int action, String sessionId, LocalSession session)
- {
- super(action, sessionId, session);
- }
-
- public void setSecurityContext(JOSSOSecurityContext ctx)
- {
- this.ctx = ctx;
- }
-
- public JOSSOSecurityContext getSecurityContext()
- {
- return this.ctx;
- }
-
-}
Modified:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInLocalSession.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInLocalSession.java 2012-01-09
04:11:01 UTC (rev 8282)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInLocalSession.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -23,10 +23,11 @@
package org.gatein.sso.agent.josso;
import javax.servlet.http.HttpSession;
-import org.josso.agent.http.JOSSOSecurityContext;
-import org.josso.agent.http.WebAccessControlUtil;
/**
+ * Forked class {@link org.josso.servlet.agent.GenericServletLocalSession} . We don't
want dependency
+ * on josso-servlet-agent library because we need our own agent {@link GateInSSOAgent} to
be used instead of
+ * {@link org.josso.servlet.agent.GenericServletSSOAgent} from josso-servlet-agent
*
* @author <a href="mailto:sgonzalez@josso.org">Sebastian Gonzalez
Oyuela</a>
*/
@@ -39,12 +40,6 @@
setWrapped(httpSession);
setMaxInactiveInterval(httpSession.getMaxInactiveInterval());
-
}
- public void setSecurityContext(JOSSOSecurityContext ctx)
- {
- HttpSession session = (HttpSession) getWrapped();
- session.setAttribute(WebAccessControlUtil.KEY_JOSSO_SECURITY_CONTEXT, ctx);
- }
}
Modified:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInSSOAgent.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInSSOAgent.java 2012-01-09
04:11:01 UTC (rev 8282)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInSSOAgent.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -21,11 +21,13 @@
*/
package org.gatein.sso.agent.josso;
-import org.apache.log4j.Logger;
-
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.josso.agent.SSOAgentRequest;
import org.josso.agent.http.HttpSSOAgent;
+import org.josso.gateway.identity.service.SSOIdentityManagerService;
+import java.lang.reflect.Method;
import java.security.Principal;
/**
@@ -34,22 +36,15 @@
*
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
-public class GateInSSOAgent extends HttpSSOAgent
+public class GateInSSOAgent extends HttpSSOAgent
{
- private static final Logger log = Logger.getLogger(GateInSSOAgent.class);
+ private static final Logger log = LoggerFactory.getLogger(GateInSSOAgent.class);
protected Principal authenticate(SSOAgentRequest request)
{
- try
- {
- String ssoSessionId = request.getSessionId();
- return this.getSSOIdentityManager().findUserInSession(ssoSessionId);
- }
- catch(Exception e)
- {
- throw new RuntimeException(e);
- }
+ GateInAuthenticationDelegate authDelegate =
GateInJOSSOAgentFactory.getInstance().getAuthenticationDelegate();
+ return authDelegate.authenticate(this.getSSOIdentityManager(), request);
}
protected boolean isAuthenticationAlwaysRequired()
Modified:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/JOSSOAgent.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/JOSSOAgent.java 2012-01-09
04:11:01 UTC (rev 8282)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/JOSSOAgent.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -24,8 +24,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.log4j.Logger;
-
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.gatein.wci.security.Credentials;
import org.josso.agent.Lookup;
@@ -38,10 +38,10 @@
*/
public class JOSSOAgent
{
- private static Logger log = Logger.getLogger(Logger.class);
- private static JOSSOAgent singleton;
+ private static Logger log = LoggerFactory.getLogger(JOSSOAgent.class);
+ private static JOSSOAgent singleton;
- private HttpSSOAgent httpAgent;
+ private HttpSSOAgent httpAgent;
private JOSSOAgent()
{
@@ -75,14 +75,16 @@
}
return JOSSOAgent.singleton;
}
-
- public void validateTicket(HttpServletRequest httpRequest,HttpServletResponse
httpResponse) throws Exception
+
+ public void validateTicket(HttpServletRequest httpRequest,HttpServletResponse
httpResponse) throws Exception
{
String ticket = httpRequest.getParameter("josso_assertion_id");
- log.debug("Trying to validate the following Ticket: "+ticket);
+ log.debug("Trying to validate the following Ticket: " + ticket);
+ String requester = httpRequest.getContextPath().substring(1);
+
//Use the JOSSO Client Library to validate the token and extract the subject that was
authenticated
- SSOAgentRequest agentRequest = this.doMakeSSOAgentRequest(SSOAgentRequest.ACTION_RELAY,
+ SSOAgentRequest agentRequest = this.doMakeSSOAgentRequest(requester,
SSOAgentRequest.ACTION_RELAY,
null, ticket, httpRequest, httpResponse);
SingleSignOnEntry entry = this.httpAgent.processRequest(agentRequest);
@@ -94,25 +96,23 @@
String principal = entry.principal.getName();
log.debug("-----------------------------------------------------------");
- log.debug("SessionId: "+sessionId);
- log.debug("AssertionId: "+assertionId);
- log.debug("Principal: "+principal);
+ log.debug("SessionId: " + sessionId);
+ log.debug("AssertionId: " + assertionId);
+ log.debug("Principal: " + principal);
log.debug("-----------------------------------------------------------");
Credentials credentials = new Credentials(principal, "");
httpRequest.getSession().setAttribute(Credentials.CREDENTIALS, credentials);
httpRequest.getSession().setAttribute("username", principal);
+
+ // TODO: this is needed for using default login module stack instead of
SSOLoginModule. Should be moved to some abstract superclass instead.
+ httpRequest.getSession().setAttribute("authenticatedCredentials",
credentials);
}
}
- protected SSOAgentRequest doMakeSSOAgentRequest(int action, String sessionId, String
assertionId,
+ protected SSOAgentRequest doMakeSSOAgentRequest(String requester, int action, String
sessionId, String assertionId,
HttpServletRequest hreq,
HttpServletResponse hres)
{
- GateInAgentRequest r = new GateInAgentRequest(action, sessionId, new
GateInLocalSession(hreq.getSession()), assertionId);
- r.setRequest(hreq);
- r.setResponse(hres);
-
- return r;
-
- }
+ return GateInJOSSOAgentFactory.getInstance().getSSOAgentRequest(requester, action,
sessionId,assertionId, hreq, hres);
+ }
}
Modified:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/LocalSessionImpl.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/LocalSessionImpl.java 2012-01-09
04:11:01 UTC (rev 8282)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/LocalSessionImpl.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -31,7 +31,10 @@
import java.util.Iterator;
/**
- *
+ * Forked class {@link org.josso.servlet.agent.LocalSessionImpl} . We don't want
dependency
+ * on josso-servlet-agent library because we need our own agent {@link GateInSSOAgent} to
be used instead of
+ * {@link org.josso.servlet.agent.GenericServletSSOAgent} from josso-servlet-agent
+ *
* @author <a href="mailto:sgonzalez@josso.org">Sebastian Gonzalez
Oyuela</a>
*/
public class LocalSessionImpl implements LocalSession
Modified:
components/sso/trunk/agent/src/test/java/org/gatein/sso/agent/josso/TestAssertionValidation.java
===================================================================
---
components/sso/trunk/agent/src/test/java/org/gatein/sso/agent/josso/TestAssertionValidation.java 2012-01-09
04:11:01 UTC (rev 8282)
+++
components/sso/trunk/agent/src/test/java/org/gatein/sso/agent/josso/TestAssertionValidation.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -28,7 +28,6 @@
import org.josso.agent.SSOAgent;
import org.josso.agent.Lookup;
import org.josso.agent.SSOAgentRequest;
-import org.josso.agent.LocalSession;
import org.josso.agent.SingleSignOnEntry;
import org.josso.servlet.agent.GenericServletSSOAgentRequest;
@@ -65,7 +64,7 @@
String assertionId = "";
- SSOAgentRequest request = new
GenericServletSSOAgentRequest(SSOAgentRequest.ACTION_RELAY,
+ SSOAgentRequest request = new GenericServletSSOAgentRequest("portal",
SSOAgentRequest.ACTION_RELAY,
null,
new GenericServletLocalSession(null),
assertionId);
Added: components/sso/trunk/josso/gatein-agent-josso181/pom.xml
===================================================================
--- components/sso/trunk/josso/gatein-agent-josso181/pom.xml (rev
0)
+++ components/sso/trunk/josso/gatein-agent-josso181/pom.xml 2012-01-09 13:56:26 UTC (rev
8283)
@@ -0,0 +1,71 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>sso-josso-parent</artifactId>
+ <groupId>org.gatein.sso</groupId>
+ <version>1.1.1-CR01-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>sso-agent-josso181</artifactId>
+ <packaging>jar</packaging>
+
+ <name>GateIn JOSSO agent for JOSSO 1.8.1 and older</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.gatein.sso</groupId>
+ <artifactId>sso-agent</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.josso</groupId>
+ <artifactId>josso-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.josso</groupId>
+ <artifactId>josso-agent</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.josso</groupId>
+ <artifactId>josso-core</artifactId>
+ <version>1.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.josso</groupId>
+ <artifactId>josso-agent</artifactId>
+ <version>1.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.josso</groupId>
+ <artifactId>josso-agent-shared</artifactId>
+ <version>1.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.josso</groupId>
+ <artifactId>josso-agents-bin</artifactId>
+ <version>1.8.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-deps-to-lib</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added:
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/impl/GateInAuthenticationDelegateImpl.java
===================================================================
---
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/impl/GateInAuthenticationDelegateImpl.java
(rev 0)
+++
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/impl/GateInAuthenticationDelegateImpl.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2012, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.gatein.sso.agent.josso.impl;
+
+import org.gatein.sso.agent.josso.GateInAuthenticationDelegate;
+import org.josso.agent.SSOAgentRequest;
+import org.josso.gateway.identity.exceptions.SSOIdentityException;
+import org.josso.gateway.identity.service.SSOIdentityManagerService;
+
+import java.security.Principal;
+
+/**
+ * Implementation for josso 1.8.1 and older
+ *
+ * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
+ */
+public class GateInAuthenticationDelegateImpl implements GateInAuthenticationDelegate
+{
+
+ public Principal authenticate(SSOIdentityManagerService identityManager,
SSOAgentRequest request)
+ {
+ try
+ {
+ return identityManager.findUserInSession(request.getSessionId());
+ }
+ catch (SSOIdentityException se)
+ {
+ throw new RuntimeException(se);
+ }
+ }
+
+}
Added:
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/impl/GateInJOSSOAgentFactoryImpl.java
===================================================================
---
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/impl/GateInJOSSOAgentFactoryImpl.java
(rev 0)
+++
components/sso/trunk/josso/gatein-agent-josso181/src/main/java/org/gatein/sso/agent/josso/impl/GateInJOSSOAgentFactoryImpl.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2012, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.gatein.sso.agent.josso.impl;
+
+import org.gatein.sso.agent.josso.GateInAuthenticationDelegate;
+import org.gatein.sso.agent.josso.GateInJOSSOAgentFactory;
+import org.gatein.sso.agent.josso.GateInLocalSession;
+import org.josso.agent.SSOAgentRequest;
+import org.josso.agent.http.HttpSSOAgentRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Implementation for josso 1.8.1 and older
+ *
+ * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
+ */
+public class GateInJOSSOAgentFactoryImpl extends GateInJOSSOAgentFactory
+{
+ private GateInAuthenticationDelegate authDelegate = new
GateInAuthenticationDelegateImpl();
+
+ @Override
+ public SSOAgentRequest getSSOAgentRequest(String requester, int action, String
sessionId, String assertionId, HttpServletRequest hreq, HttpServletResponse hres)
+ {
+ HttpSSOAgentRequest agentRequest = new HttpSSOAgentRequest(action, sessionId,
+ new GateInLocalSession(hreq.getSession()), assertionId);
+ agentRequest.setRequest(hreq);
+ agentRequest.setResponse(hres);
+
+ return agentRequest;
+ }
+
+ @Override
+ public GateInAuthenticationDelegate getAuthenticationDelegate()
+ {
+ return authDelegate;
+ }
+}
Added: components/sso/trunk/josso/gatein-agent-josso182/pom.xml
===================================================================
--- components/sso/trunk/josso/gatein-agent-josso182/pom.xml (rev
0)
+++ components/sso/trunk/josso/gatein-agent-josso182/pom.xml 2012-01-09 13:56:26 UTC (rev
8283)
@@ -0,0 +1,21 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>sso-josso-parent</artifactId>
+ <groupId>org.gatein.sso</groupId>
+ <version>1.1.1-CR01-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>sso-agent-josso182</artifactId>
+ <packaging>jar</packaging>
+
+ <name>GateIn JOSSO agent for JOSSO 1.8.2 and newer</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.gatein.sso</groupId>
+ <artifactId>sso-agent</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Added:
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/impl/GateInAuthenticationDelegateImpl.java
===================================================================
---
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/impl/GateInAuthenticationDelegateImpl.java
(rev 0)
+++
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/impl/GateInAuthenticationDelegateImpl.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2012, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.gatein.sso.agent.josso.impl;
+
+import org.gatein.sso.agent.josso.GateInAuthenticationDelegate;
+import org.josso.agent.SSOAgentRequest;
+import org.josso.gateway.identity.exceptions.SSOIdentityException;
+import org.josso.gateway.identity.service.SSOIdentityManagerService;
+
+import java.security.Principal;
+
+/**
+ * Implementation for josso 1.8.2 and newer
+ *
+ * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
+ */
+public class GateInAuthenticationDelegateImpl implements GateInAuthenticationDelegate
+{
+
+ public Principal authenticate(SSOIdentityManagerService identityManager,
SSOAgentRequest request)
+ {
+ try
+ {
+ return identityManager.findUserInSession(request.getRequester(),
request.getSessionId());
+ }
+ catch (SSOIdentityException se)
+ {
+ throw new RuntimeException(se);
+ }
+ }
+
+}
Added:
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/impl/GateInJOSSOAgentFactoryImpl.java
===================================================================
---
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/impl/GateInJOSSOAgentFactoryImpl.java
(rev 0)
+++
components/sso/trunk/josso/gatein-agent-josso182/src/main/java/org/gatein/sso/agent/josso/impl/GateInJOSSOAgentFactoryImpl.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2012, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.gatein.sso.agent.josso.impl;
+
+import org.gatein.sso.agent.josso.GateInAuthenticationDelegate;
+import org.gatein.sso.agent.josso.GateInJOSSOAgentFactory;
+import org.gatein.sso.agent.josso.GateInLocalSession;
+import org.josso.agent.SSOAgentRequest;
+import org.josso.agent.http.HttpSSOAgentRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Implementation for josso 1.8.2 and newer
+ *
+ * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
+ */
+public class GateInJOSSOAgentFactoryImpl extends GateInJOSSOAgentFactory
+{
+
+ private GateInAuthenticationDelegate authDelegate = new
GateInAuthenticationDelegateImpl();
+
+ @Override
+ public SSOAgentRequest getSSOAgentRequest(String requester, int action, String
sessionId, String assertionId,
+ HttpServletRequest hreq, HttpServletResponse
hres)
+ {
+ HttpSSOAgentRequest agentRequest = new HttpSSOAgentRequest(requester, action,
sessionId,
+ new GateInLocalSession(hreq.getSession()), assertionId);
+ agentRequest.setRequest(hreq);
+ agentRequest.setResponse(hres);
+
+ return agentRequest;
+ }
+
+ @Override
+ public GateInAuthenticationDelegate getAuthenticationDelegate()
+ {
+ return authDelegate;
+ }
+
+}
Modified:
components/sso/trunk/josso/gatein-josso-plugin/src/main/java/org/gatein/sso/josso/plugin/GateinIdentityPlugin.java
===================================================================
---
components/sso/trunk/josso/gatein-josso-plugin/src/main/java/org/gatein/sso/josso/plugin/GateinIdentityPlugin.java 2012-01-09
04:11:01 UTC (rev 8282)
+++
components/sso/trunk/josso/gatein-josso-plugin/src/main/java/org/gatein/sso/josso/plugin/GateinIdentityPlugin.java 2012-01-09
13:56:26 UTC (rev 8283)
@@ -148,8 +148,9 @@
public BaseRole[] findRolesByUserKey(UserKey userKey)
throws SSOIdentityException
- {
- return null;
+ {
+ // Return empty role set for now. We may think about extending auth-callback for
obtain GateIn roles via REST.
+ return new BaseRole[] {};
}
public BaseUser loadUser(UserKey userKey) throws NoSuchUserException,
@@ -172,6 +173,11 @@
return null;
}
+ public String loadUID(CredentialKey key, CredentialProvider cp) throws
SSOIdentityException
+ {
+ return null;
+ }
+
public boolean bind(String username, String password)
throws SSOAuthenticationException
{
@@ -179,8 +185,7 @@
{
// return this.portalIdentityService.authenticate(username, password);
log.debug("Performing Authentication........................");
- log.debug("Username: "+username);
- log.debug("Password: "+password);
+ log.debug("Username: " + username);
StringBuilder urlBuffer = new StringBuilder();
urlBuffer.append("http://" + this.gateInHost + ":" +
this.gateInPort + "/"
Modified: components/sso/trunk/josso/gatein-josso-portal/pom.xml
===================================================================
--- components/sso/trunk/josso/gatein-josso-portal/pom.xml 2012-01-09 04:11:01 UTC (rev
8282)
+++ components/sso/trunk/josso/gatein-josso-portal/pom.xml 2012-01-09 13:56:26 UTC (rev
8283)
@@ -14,52 +14,42 @@
<dependency>
<groupId>org.josso</groupId>
<artifactId>josso-agents-bin</artifactId>
- <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.josso</groupId>
<artifactId>josso-agent-shared</artifactId>
- <version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
- <version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
- <version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
- <version>2.5.5</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
- <version>0.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
- <version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-spring</artifactId>
- <version>3.4.3</version>
</dependency>
<dependency>
<groupId>org.gatein.sso</groupId>
<artifactId>sso-agent</artifactId>
- <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.gatein.sso</groupId>
<artifactId>sso-auth-callback</artifactId>
- <version>${project.version}</version>
</dependency>
<dependency>
@@ -74,8 +64,15 @@
<dependency>
<groupId>org.gatein.sso</groupId>
<artifactId>sso-josso-plugin</artifactId>
- <version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.gatein.sso</groupId>
+ <artifactId>sso-agent-josso181</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.sso</groupId>
+ <artifactId>sso-agent-josso182</artifactId>
+ </dependency>
<dependency>
<groupId>apache-log4j</groupId>
<artifactId>log4j</artifactId>
Modified: components/sso/trunk/josso/gatein-josso-portal/src/main/assembly/src.xml
===================================================================
--- components/sso/trunk/josso/gatein-josso-portal/src/main/assembly/src.xml 2012-01-09
04:11:01 UTC (rev 8282)
+++ components/sso/trunk/josso/gatein-josso-portal/src/main/assembly/src.xml 2012-01-09
13:56:26 UTC (rev 8283)
@@ -7,10 +7,28 @@
<fileSets>
<fileSet>
-
<directory>src/main/resources</directory>
<outputDirectory></outputDirectory>
</fileSet>
+ <fileSet>
+ <directory>src/main/resources/gatein.ear</directory>
+ <outputDirectory>gatein.ear-josso182</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources/gatein.ear</directory>
+ <outputDirectory>gatein.ear-josso182</outputDirectory>
+ </fileSet>
+
+ <!-- We need to use old josso libraries for josso 1.8.1 packaging. Libraries
are included in dependencies of project gatein-agent-josso181
+ and downloaded thanks to maven-dependency-plugin declared in pom.xml of
gatein-agent-josso181 module. -->
+ <fileSet>
+ <directory>../gatein-agent-josso181/target/dependency</directory>
+ <outputDirectory>gatein.ear/lib</outputDirectory>
+ <includes>
+ <include>josso-agents-bin-1.8.0.jar</include>
+ <include>josso-agent-shared-1.8.1.jar</include>
+ </includes>
+ </fileSet>
</fileSets>
<dependencySets>
@@ -20,8 +38,6 @@
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>false</useTransitiveDependencies>
<includes>
- <include>org.josso:josso-agents-bin</include>
- <include>org.josso:josso-agent-shared</include>
<include>org.springframework:spring-beans</include>
<include>org.springframework:spring-context</include>
<include>org.springframework:spring-core</include>
@@ -33,6 +49,24 @@
</includes>
</dependencySet>
+ <dependencySet>
+ <outputDirectory>gatein.ear-josso182/lib</outputDirectory>
+ <useProjectArtifact>false</useProjectArtifact>
+ <useTransitiveDependencies>false</useTransitiveDependencies>
+ <includes>
+ <include>org.josso:josso-agents-bin</include>
+ <include>org.josso:josso-agent-shared</include>
+ <include>org.springframework:spring-beans</include>
+ <include>org.springframework:spring-context</include>
+ <include>org.springframework:spring-core</include>
+ <include>commons-discovery:commons-discovery</include>
+ <include>org.apache.axis:axis</include>
+ <include>org.apache.xbean:xbean-spring</include>
+ <include>org.gatein.sso:sso-agent</include>
+ <include>org.gatein.sso:sso-auth-callback</include>
+ </includes>
+ </dependencySet>
+
<dependencySet>
<outputDirectory>plugin/webapps/josso/WEB-INF/lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
Modified:
components/sso/trunk/josso/gatein-josso-portal/src/main/resources/plugin/lib/josso-gateway-config.xml
===================================================================
---
components/sso/trunk/josso/gatein-josso-portal/src/main/resources/plugin/lib/josso-gateway-config.xml 2012-01-09
04:11:01 UTC (rev 8282)
+++
components/sso/trunk/josso/gatein-josso-portal/src/main/resources/plugin/lib/josso-gateway-config.xml 2012-01-09
13:56:26 UTC (rev 8283)
@@ -303,6 +303,11 @@
<simple-key-adapter id="josso-simple-key-adapter"/>
<!-- ===================================================================== -->
+ <!-- SSO Certificate key adapter used for strong authentication -->
+ <!-- ===================================================================== -->
+ <certificate-key-adapter id="josso-certificate-key-adapter"/>
+
+ <!-- ===================================================================== -->
<!-- Spring Mail Sender bean. Configure mail delivery settings here -->
<!-- ===================================================================== -->
<s:bean id="josso-spring-mailsender"
class="org.springframework.mail.javamail.JavaMailSenderImpl">
Modified: components/sso/trunk/josso/pom.xml
===================================================================
--- components/sso/trunk/josso/pom.xml 2012-01-09 04:11:01 UTC (rev 8282)
+++ components/sso/trunk/josso/pom.xml 2012-01-09 13:56:26 UTC (rev 8283)
@@ -15,8 +15,10 @@
<name>GateIn SSO - JOSSO</name>
<modules>
+ <module>gatein-agent-josso181</module>
+ <module>gatein-agent-josso182</module>
<module>gatein-josso-portal</module>
<module>gatein-josso-plugin</module>
- </modules>
+ </modules>
</project>
Modified: components/sso/trunk/pom.xml
===================================================================
--- components/sso/trunk/pom.xml 2012-01-09 04:11:01 UTC (rev 8282)
+++ components/sso/trunk/pom.xml 2012-01-09 13:56:26 UTC (rev 8283)
@@ -61,12 +61,20 @@
<version.cas.client>3.1.9</version.cas.client>
<!-- josso -->
- <version.josso>1.8.1</version.josso>
+ <version.josso>1.8.2</version.josso>
<!-- xbean -->
<version.xbean>3.4.3</version.xbean>
+ <!-- spring -->
+ <version.spring>2.5.5</version.spring>
+ <!-- commons discovery -->
+ <version.commons.discovery>0.2</version.commons.discovery>
+
+ <!-- apache axis -->
+ <version.axis>1.4</version.axis>
+
<!-- exo -->
<org.exoplatform.core.version>2.4.3-GA</org.exoplatform.core.version>
<org.exoplatform.ws.version>2.2.3-GA</org.exoplatform.ws.version>
@@ -84,6 +92,33 @@
<dependencyManagement>
<dependencies>
+ <!-- internal -->
+ <dependency>
+ <groupId>org.gatein.sso</groupId>
+ <artifactId>sso-auth-callback</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.sso</groupId>
+ <artifactId>sso-agent</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.sso</groupId>
+ <artifactId>sso-josso-plugin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.sso</groupId>
+ <artifactId>sso-agent-josso181</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.sso</groupId>
+ <artifactId>sso-agent-josso182</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
<!-- junit -->
<dependency>
<groupId>junit</groupId>
@@ -124,6 +159,11 @@
<artifactId>josso-agent-shared</artifactId>
<version>${version.josso}</version>
</dependency>
+ <dependency>
+ <groupId>org.josso</groupId>
+ <artifactId>josso-agents-bin</artifactId>
+ <version>${version.josso}</version>
+ </dependency>
<dependency>
<groupId>org.josso</groupId>
<artifactId>josso-servlet-agent</artifactId>
@@ -152,6 +192,35 @@
</exclusions>
</dependency>
+ <!-- Spring (needed for JOSSO -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${version.spring}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${version.spring}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${version.spring}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-discovery</groupId>
+ <artifactId>commons-discovery</artifactId>
+ <version>${version.commons.discovery}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis</groupId>
+ <artifactId>axis</artifactId>
+ <version>${version.axis}</version>
+ </dependency>
+
<!-- logging -->
<dependency>
<groupId>apache-log4j</groupId>
@@ -274,6 +343,16 @@
<build>
+ <!-- Set plugin versions here -->
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>