From do-not-reply at jboss.org Mon Jan 9 09:00:40 2012 Content-Type: multipart/mixed; boundary="===============0987449590408697937==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: gatein-commits at lists.jboss.org Subject: [gatein-commits] gatein SVN: r8284 - components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso. Date: Mon, 09 Jan 2012 09:00:40 -0500 Message-ID: <201201091400.q09E0ebQ005827@svn01.web.mwc.hst.phx2.redhat.com> --===============0987449590408697937== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/Gate= InAuthenticationDelegate.java components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/Gate= InJOSSOAgentFactory.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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/Gat= eInAuthenticationDelegate.java (rev 0) +++ components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/Gat= eInAuthenticationDelegate.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 Marek Posolda + */ +public interface GateInAuthenticationDelegate +{ + + /** + * Authenticate against JOSSO Identity Manager. Implementation may be d= ifferent 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/Gat= eInJOSSOAgentFactory.java (rev 0) +++ components/sso/trunk/agent/src/main/java/org/gatein/sso/agent/josso/Gat= eInJOSSOAgentFactory.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 Marek Posolda + */ +public abstract class GateInJOSSOAgentFactory +{ + private static AtomicReference INSTANCE =3D ne= w AtomicReference(); + + private static final Logger log =3D LoggerFactory.getLogger(GateInJOSSO= AgentFactory.class); + + public static GateInJOSSOAgentFactory getInstance() + { + GateInJOSSOAgentFactory result =3D INSTANCE.get(); + = + if (result =3D=3D null) + { + INSTANCE.compareAndSet(null, createInstance()); + result =3D INSTANCE.get(); + } + + return result; + } + + /** + * @return Concrete factory, where the factory implementation can be di= fferent according to josso version. + */ + private static GateInJOSSOAgentFactory createInstance() + { + try + { + Class factoryClass =3D Thread.currentThread().getContextClassL= oader().loadClass("org.gatein.sso.agent.josso.impl.GateInJOSSOAgentFactoryI= mpl"); + return (GateInJOSSOAgentFactory)factoryClass.newInstance(); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + + public abstract SSOAgentRequest getSSOAgentRequest(String requester, in= t action, String sessionId, String assertionId, + HttpServletRequest h= req, HttpServletResponse hres); + + + public abstract GateInAuthenticationDelegate getAuthenticationDelegate(= ); + = + +} --===============0987449590408697937==--