Author: anil.saldhana(a)jboss.com
Date: 2009-10-12 12:09:28 -0400 (Mon, 12 Oct 2009)
New Revision: 847
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/EmptyRoleGenerator.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/RoleGenerator.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2AttributeHandler.java
Removed:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/interfaces/RoleGenerator.java
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatRoleGenerator.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/EmptyAttributeManager.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/impl/BaseHandlerConfig.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2Handler.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/constants/GeneralConstants.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/BaseSAML2Handler.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/RolesGenerationHandler.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/roles/DefaultRoleGenerator.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java
Log:
JBID-198: saml2 handler arch
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatRoleGenerator.java
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatRoleGenerator.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatRoleGenerator.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -30,7 +30,7 @@
import org.apache.catalina.Role;
import org.apache.catalina.User;
import org.apache.catalina.realm.GenericPrincipal;
-import org.jboss.identity.federation.web.interfaces.RoleGenerator;
+import org.jboss.identity.federation.core.interfaces.RoleGenerator;
/**
* Generate roles from Tomcat Principal
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPRedirectValve.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -51,6 +51,7 @@
import org.jboss.identity.federation.core.exceptions.ConfigurationException;
import org.jboss.identity.federation.core.exceptions.ParsingException;
import org.jboss.identity.federation.core.exceptions.ProcessingException;
+import org.jboss.identity.federation.core.interfaces.RoleGenerator;
import org.jboss.identity.federation.core.saml.v2.common.IDGenerator;
import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
import
org.jboss.identity.federation.core.saml.v2.exceptions.IssueInstantMissingException;
@@ -63,7 +64,6 @@
import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
import org.jboss.identity.federation.saml.v2.protocol.RequestAbstractType;
import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
-import org.jboss.identity.federation.web.interfaces.RoleGenerator;
import org.jboss.identity.federation.web.util.ConfigurationUtil;
import org.jboss.identity.federation.web.util.HTTPRedirectUtil;
import org.jboss.identity.federation.web.util.RedirectBindingUtil;
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -51,6 +51,7 @@
import org.jboss.identity.federation.core.exceptions.ParsingException;
import org.jboss.identity.federation.core.impl.DelegatedAttributeManager;
import org.jboss.identity.federation.core.interfaces.AttributeManager;
+import org.jboss.identity.federation.core.interfaces.RoleGenerator;
import org.jboss.identity.federation.core.interfaces.TrustKeyConfigurationException;
import org.jboss.identity.federation.core.interfaces.TrustKeyManager;
import org.jboss.identity.federation.core.interfaces.TrustKeyProcessingException;
@@ -59,7 +60,6 @@
import org.jboss.identity.federation.core.saml.v2.exceptions.IssuerNotTrustedException;
import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
import org.jboss.identity.federation.saml.v2.protocol.RequestAbstractType;
-import org.jboss.identity.federation.web.interfaces.RoleGenerator;
import org.jboss.identity.federation.web.util.ConfigurationUtil;
import org.jboss.identity.federation.web.util.IDPWebRequestUtil;
import org.jboss.identity.federation.web.util.RedirectBindingSignatureUtil;
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/EmptyAttributeManager.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/EmptyAttributeManager.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/EmptyAttributeManager.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -44,4 +44,10 @@
{
return new HashMap<String, Object>();
}
+
+ @Override
+ public String toString()
+ {
+ return EmptyAttributeManager.class.getName();
+ }
}
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/EmptyRoleGenerator.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/EmptyRoleGenerator.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/EmptyRoleGenerator.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.identity.federation.core.impl;
+
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.identity.federation.core.interfaces.RoleGenerator;
+
+/**
+ * A Role Generator that generates no roles
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 12, 2009
+ */
+public class EmptyRoleGenerator implements RoleGenerator
+{
+ /**
+ * @see {@code RoleGenerator#generateRoles(Principal)}
+ */
+ public List<String> generateRoles(Principal principal)
+ {
+ return new ArrayList<String>();
+ }
+}
\ No newline at end of file
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/RoleGenerator.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/RoleGenerator.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/RoleGenerator.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.identity.federation.core.interfaces;
+
+import java.security.Principal;
+import java.util.List;
+
+/**
+ * Generate roles given a principal
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 21, 2009
+ */
+public interface RoleGenerator
+{
+ /**
+ * Generate roles given a principal
+ * @param principal
+ * @return
+ */
+ List<String> generateRoles(Principal principal);
+}
\ No newline at end of file
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/impl/BaseHandlerConfig.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/impl/BaseHandlerConfig.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/impl/BaseHandlerConfig.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -35,9 +35,7 @@
protected Map<String, Object> params = new HashMap<String, Object>();
/**
- * Does the config contain the key?
- * @param key
- * @return
+ * @see SAML2HandlerChainConfig#containsKey(String)
*/
public boolean containsKey(String key)
{
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2Handler.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2Handler.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/interfaces/SAML2Handler.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -20,7 +20,9 @@
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
package org.jboss.identity.federation.core.saml.v2.interfaces;
+
+import org.jboss.identity.federation.core.exceptions.ConfigurationException;
import org.jboss.identity.federation.core.exceptions.ProcessingException;
/**
@@ -34,13 +36,15 @@
* Initialize the handler
* @param handlerConfig Handler Config
*/
- void initChainConfig(SAML2HandlerChainConfig handlerChainConfig);
+ void initChainConfig(SAML2HandlerChainConfig handlerChainConfig)
+ throws ConfigurationException;
/**
* Initialize the handler from configuration
* @param options
*/
- void initHandlerConfig(SAML2HandlerConfig handlerConfig);
+ void initHandlerConfig(SAML2HandlerConfig handlerConfig)
+ throws ConfigurationException;
/**
* Generate a SAML Request to be sent to the IDP
Modified:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/constants/GeneralConstants.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/constants/GeneralConstants.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/constants/GeneralConstants.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -32,6 +32,7 @@
String ATTRIBUTES = "ATTRIBUTES";
String ATTRIBUTE_KEYS = "ATTRIBUTE_KEYS";
+ String ATTIBUTE_MANAGER = "ATTRIBUTE_MANAGER";
String CONFIGURATION = "CONFIGURATION";
Modified:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/BaseSAML2Handler.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/BaseSAML2Handler.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/BaseSAML2Handler.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -20,10 +20,11 @@
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
package org.jboss.identity.federation.web.handlers.saml2;
-
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
+import org.jboss.identity.federation.core.exceptions.ConfigurationException;
import org.jboss.identity.federation.core.exceptions.ProcessingException;
import org.jboss.identity.federation.core.saml.v2.interfaces.SAML2Handler;
import org.jboss.identity.federation.core.saml.v2.interfaces.SAML2HandlerChainConfig;
@@ -47,11 +48,13 @@
* @param options
*/
public void initHandlerConfig(SAML2HandlerConfig handlerConfig)
+ throws ConfigurationException
{
this.handlerConfig = handlerConfig;
}
public void initChainConfig(SAML2HandlerChainConfig handlerChainConfig)
+ throws ConfigurationException
{
this.handlerChainConfig = handlerChainConfig;
}
Modified:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/RolesGenerationHandler.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/RolesGenerationHandler.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/RolesGenerationHandler.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -23,10 +23,15 @@
import java.security.Principal;
import java.util.List;
-
+
import javax.servlet.http.HttpSession;
+import org.apache.log4j.Logger;
+import org.jboss.identity.federation.core.config.IDPType;
+import org.jboss.identity.federation.core.exceptions.ConfigurationException;
import org.jboss.identity.federation.core.exceptions.ProcessingException;
+import org.jboss.identity.federation.core.impl.EmptyRoleGenerator;
+import org.jboss.identity.federation.core.interfaces.RoleGenerator;
import org.jboss.identity.federation.core.saml.v2.interfaces.SAML2HandlerChainConfig;
import org.jboss.identity.federation.core.saml.v2.interfaces.SAML2HandlerConfig;
import org.jboss.identity.federation.core.saml.v2.interfaces.SAML2HandlerRequest;
@@ -34,7 +39,6 @@
import org.jboss.identity.federation.saml.v2.protocol.LogoutRequestType;
import org.jboss.identity.federation.web.constants.GeneralConstants;
import org.jboss.identity.federation.web.core.HTTPContext;
-import org.jboss.identity.federation.web.interfaces.RoleGenerator;
/**
* Handles the generation of roles
@@ -43,34 +47,30 @@
*/
public class RolesGenerationHandler extends BaseSAML2Handler
{
+ private static Logger log = Logger.getLogger(RolesGenerationHandler.class);
+ private boolean trace = log.isTraceEnabled();
- @SuppressWarnings("unused")
- private transient RoleGenerator rg = null;
+ private transient RoleGenerator roleGenerator = new EmptyRoleGenerator();
- public void initChainConfig(SAML2HandlerChainConfig handlerConfig)
+ @Override
+ public void initChainConfig(SAML2HandlerChainConfig handlerChainConfig) throws
ConfigurationException
{
- rg = (RoleGenerator) handlerConfig.getParameter(GeneralConstants.ROLE_GENERATOR);
- }
+ super.initChainConfig(handlerChainConfig);
+ Object config =
this.handlerChainConfig.getParameter(GeneralConstants.CONFIGURATION);
+ if(config instanceof IDPType)
+ {
+ IDPType idpType = (IDPType) config;
+ String roleGeneratorString = idpType.getRoleGenerator();
+ this.insantiateRoleValidator(roleGeneratorString);
+ }
+ }
@Override
- public void initHandlerConfig(SAML2HandlerConfig handlerConfig)
+ public void initHandlerConfig(SAML2HandlerConfig handlerConfig) throws
ConfigurationException
{
super.initHandlerConfig(handlerConfig);
-
- if(this.handlerConfig.containsKey(GeneralConstants.ROLE_GENERATOR))
- {
- String clazzName = (String)
this.handlerConfig.getParameter(GeneralConstants.ROLE_GENERATOR);
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- try
- {
- rg = (RoleGenerator) tcl.loadClass(clazzName).newInstance();
- }
- catch(Exception e)
- {
- throw new RuntimeException("Unable to instantiate Role
Generator:",e);
- }
-
- }
+ String roleGeneratorString = (String)
this.handlerConfig.getParameter(GeneralConstants.ATTIBUTE_MANAGER);
+ this.insantiateRoleValidator(roleGeneratorString);
}
@SuppressWarnings("unchecked")
@@ -93,8 +93,7 @@
if(roles == null)
{
- RoleGenerator rg = (RoleGenerator)
request.getOptions().get(GeneralConstants.ROLE_GENERATOR);
- roles = rg.generateRoles(userPrincipal);
+ roles = roleGenerator.generateRoles(userPrincipal);
session.setAttribute(GeneralConstants.ROLES_ID, roles);
}
response.setRoles(roles);
@@ -104,4 +103,24 @@
throws ProcessingException
{
}
+
+ private void insantiateRoleValidator(String attribStr)
+ throws ConfigurationException
+ {
+ if(attribStr != null && !"".equals(attribStr))
+ {
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ try
+ {
+ roleGenerator = (RoleGenerator) tcl.loadClass(attribStr).newInstance();
+ if(trace)
+ log.trace("RoleGenerator set to " + this.roleGenerator);
+ }
+ catch (Exception e)
+ {
+ log.error("Exception initializing role generator:",e);
+ throw new ConfigurationException();
+ }
+ }
+ }
}
\ No newline at end of file
Added:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2AttributeHandler.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2AttributeHandler.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/handlers/saml2/SAML2AttributeHandler.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.identity.federation.web.handlers.saml2;
+
+
+import org.apache.log4j.Logger;
+import org.jboss.identity.federation.core.config.IDPType;
+import org.jboss.identity.federation.core.exceptions.ConfigurationException;
+import org.jboss.identity.federation.core.exceptions.ProcessingException;
+import org.jboss.identity.federation.core.impl.EmptyAttributeManager;
+import org.jboss.identity.federation.core.interfaces.AttributeManager;
+import org.jboss.identity.federation.core.saml.v2.interfaces.SAML2HandlerChainConfig;
+import org.jboss.identity.federation.core.saml.v2.interfaces.SAML2HandlerConfig;
+import org.jboss.identity.federation.core.saml.v2.interfaces.SAML2HandlerRequest;
+import org.jboss.identity.federation.core.saml.v2.interfaces.SAML2HandlerResponse;
+import org.jboss.identity.federation.web.constants.GeneralConstants;
+
+/**
+ * Handler dealing with attributes for SAML2
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Oct 12, 2009
+ */
+public class SAML2AttributeHandler extends BaseSAML2Handler
+{
+ private static Logger log = Logger.getLogger(SAML2AttributeHandler.class);
+ private boolean trace = log.isTraceEnabled();
+
+ protected AttributeManager attribManager = new EmptyAttributeManager();
+
+ @Override
+ public void initChainConfig(SAML2HandlerChainConfig handlerChainConfig) throws
ConfigurationException
+ {
+ super.initChainConfig(handlerChainConfig);
+ Object config =
this.handlerChainConfig.getParameter(GeneralConstants.CONFIGURATION);
+ if(config instanceof IDPType)
+ {
+ IDPType idpType = (IDPType) config;
+ String attribStr = idpType.getAttributeManager();
+ insantiateAttributeManager(attribStr);
+ }
+ }
+
+ @Override
+ public void initHandlerConfig(SAML2HandlerConfig handlerConfig) throws
ConfigurationException
+ {
+ super.initHandlerConfig(handlerConfig);
+
+ String attribStr = (String)
this.handlerConfig.getParameter(GeneralConstants.ATTIBUTE_MANAGER);
+ this.insantiateAttributeManager(attribStr);
+ }
+
+ public void handleRequestType(SAML2HandlerRequest request, SAML2HandlerResponse
response) throws ProcessingException
+ {
+ }
+
+ public void handleStatusResponseType(SAML2HandlerRequest request, SAML2HandlerResponse
response)
+ throws ProcessingException
+ {
+ }
+
+ private void insantiateAttributeManager(String attribStr)
+ throws ConfigurationException
+ {
+ if(attribStr != null && !"".equals(attribStr))
+ {
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ try
+ {
+ attribManager = (AttributeManager) tcl.loadClass(attribStr).newInstance();
+ if(trace)
+ log.trace("AttributeManager set to " + this.attribManager);
+ }
+ catch (Exception e)
+ {
+ log.error("Exception initializing attribute manager:",e);
+ throw new ConfigurationException();
+ }
+ }
+ }
+}
\ No newline at end of file
Deleted:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/interfaces/RoleGenerator.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/interfaces/RoleGenerator.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/interfaces/RoleGenerator.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.jboss.identity.federation.web.interfaces;
-
-import java.security.Principal;
-import java.util.List;
-
-/**
- * Generate roles given a principal
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 21, 2009
- */
-public interface RoleGenerator
-{
- /**
- * Generate roles given a principal
- * @param principal
- * @return
- */
- List<String> generateRoles(Principal principal);
-}
\ No newline at end of file
Modified:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/roles/DefaultRoleGenerator.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/roles/DefaultRoleGenerator.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/roles/DefaultRoleGenerator.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -29,7 +29,7 @@
import java.util.Properties;
import java.util.StringTokenizer;
-import org.jboss.identity.federation.web.interfaces.RoleGenerator;
+import org.jboss.identity.federation.core.interfaces.RoleGenerator;
/**
* Simple Role Generator that looks
Modified:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java 2009-10-12
15:51:31 UTC (rev 846)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java 2009-10-12
16:09:28 UTC (rev 847)
@@ -50,6 +50,7 @@
import org.jboss.identity.federation.core.impl.DelegatedAttributeManager;
import org.jboss.identity.federation.core.interfaces.AttributeManager;
import org.jboss.identity.federation.core.interfaces.ProtocolContext;
+import org.jboss.identity.federation.core.interfaces.RoleGenerator;
import org.jboss.identity.federation.core.interfaces.TrustKeyConfigurationException;
import org.jboss.identity.federation.core.interfaces.TrustKeyManager;
import org.jboss.identity.federation.core.interfaces.TrustKeyProcessingException;
@@ -73,7 +74,6 @@
import org.jboss.identity.federation.saml.v2.protocol.StatusResponseType;
import org.jboss.identity.federation.web.constants.GeneralConstants;
import org.jboss.identity.federation.web.core.HTTPContext;
-import org.jboss.identity.federation.web.interfaces.RoleGenerator;
import org.jboss.identity.federation.web.roles.DefaultRoleGenerator;
import org.jboss.identity.federation.web.util.ConfigurationUtil;
import org.jboss.identity.federation.web.util.IDPWebRequestUtil;