Author: mposolda
Date: 2012-01-09 09:00:39 -0500 (Mon, 09 Jan 2012)
New Revision: 8284
Added:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInAuthenticationDelegate.java
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInJOSSOAgentFactory.java
Log:
GTNSSO-1 Support for JOSSO 1.8.2 and newer
Added:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInAuthenticationDelegate.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInAuthenticationDelegate.java
(rev 0)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInAuthenticationDelegate.java 2012-01-09
14:00:39 UTC (rev 8284)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+import org.josso.agent.SSOAgentRequest;
+import org.josso.gateway.identity.service.SSOIdentityManagerService;
+
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
+ */
+public interface GateInAuthenticationDelegate
+{
+
+ /**
+ * Authenticate against JOSSO Identity Manager. Implementation may be different for
various version of JOSSO.
+ *
+ * @param identityManager
+ * @param request
+ * @return principal, which is result of successful agent authentication
+ */
+ public Principal authenticate(SSOIdentityManagerService identityManager,
SSOAgentRequest request);
+
+}
Added:
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInJOSSOAgentFactory.java
===================================================================
---
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInJOSSOAgentFactory.java
(rev 0)
+++
components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/GateInJOSSOAgentFactory.java 2012-01-09
14:00:39 UTC (rev 8284)
@@ -0,0 +1,81 @@
+/*
+ * 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;
+
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.josso.agent.SSOAgentRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Abstraction of factory, where concrete implementation of factory can be different for
various josso versions.
+ *
+ * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
+ */
+public abstract class GateInJOSSOAgentFactory
+{
+ private static AtomicReference<GateInJOSSOAgentFactory> INSTANCE = new
AtomicReference<GateInJOSSOAgentFactory>();
+
+ private static final Logger log =
LoggerFactory.getLogger(GateInJOSSOAgentFactory.class);
+
+ public static GateInJOSSOAgentFactory getInstance()
+ {
+ GateInJOSSOAgentFactory result = INSTANCE.get();
+
+ if (result == null)
+ {
+ INSTANCE.compareAndSet(null, createInstance());
+ result = INSTANCE.get();
+ }
+
+ return result;
+ }
+
+ /**
+ * @return Concrete factory, where the factory implementation can be different
according to josso version.
+ */
+ private static GateInJOSSOAgentFactory createInstance()
+ {
+ try
+ {
+ Class<?> factoryClass =
Thread.currentThread().getContextClassLoader().loadClass("org.gatein.sso.agent.josso.impl.GateInJOSSOAgentFactoryImpl");
+ return (GateInJOSSOAgentFactory)factoryClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public abstract SSOAgentRequest getSSOAgentRequest(String requester, int action,
String sessionId, String assertionId,
+ HttpServletRequest hreq,
HttpServletResponse hres);
+
+
+ public abstract GateInAuthenticationDelegate getAuthenticationDelegate();
+
+
+}