Author: anil.saldhana(a)jboss.com
Date: 2009-09-10 14:37:01 -0400 (Thu, 10 Sep 2009)
New Revision: 780
Added:
identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/attribute/
identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/attribute/JBossAppServerAttributeManager.java
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatAttributeManager.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/constants/AttributeConstants.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/DelegatedAttributeManager.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/interfaces/
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/AttributeManager.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/StatementUtil.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/managers/
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/managers/WebAttributeManager.java
Modified:
identity-federation/trunk/jboss-identity-bindings-jboss/pom.xml
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-4.xml
identity-federation/trunk/jboss-identity-fed-core/pom.xml
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/AuthPropertyType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/EncAlgoType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/EncryptionType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/IDPType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/KeyProviderType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/KeyValueType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/MetadataProviderType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ObjectFactory.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ProviderType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/SPType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/STSType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ServiceProviderType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ServiceProvidersType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TokenProviderType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TokenProvidersType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TrustType.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/package-info.java
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPLoginServlet.java
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/util/IDPWebRequestUtil.java
identity-federation/trunk/jboss-identity-web/src/main/resources/schema/config/jboss-identity-fed.xsd
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/jsp/login.jsp
Log:
JBID-152: phase1 commits
Added:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatAttributeManager.java
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatAttributeManager.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/TomcatAttributeManager.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -0,0 +1,46 @@
+/*
+ * 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.bindings.tomcat;
+
+import java.security.Principal;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.identity.federation.core.interfaces.AttributeManager;
+
+/**
+ * An implementation of attribute manager to get
+ * attributes of an identity
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Aug 31, 2009
+ */
+public class TomcatAttributeManager implements AttributeManager
+{
+ /**
+ * @see AttributeManager#getAttributes(Principal, List)
+ */
+ public Map<String, Object> getAttributes(Principal userPrincipal,
+ List<String> attributeKeys)
+ {
+ throw new RuntimeException("Not Implemented");
+ }
+}
\ No newline at end of file
Modified:
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-4.xml
===================================================================
---
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-4.xml 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-bindings/src/test/resources/config/test-config-4.xml 2009-09-10
18:37:01 UTC (rev 780)
@@ -7,14 +7,18 @@
</KeyProvider>
<RequestHandler>org.jboss.identity.federation.wstrust.Handler</RequestHandler>
<TokenProviders>
- <TokenProvider ProviderClass="org.jboss.SpecialTokenProvider"
TokenType="specialToken"
- TokenElement="SpecialToken"
TokenElementNS="http://www.tokens.org">
+ <TokenProvider
+ ProviderClass="org.jboss.SpecialTokenProvider"
+ TokenType="specialToken"
+ TokenElement="SpecialToken"
+ TokenElementNS="http://www.tokens.org">
<Property Name="Property1" Value="Value1"/>
<Property Name="Property2" Value="Value2"/>
</TokenProvider>
</TokenProviders>
<ServiceProviders>
- <ServiceProvider Endpoint="http://provider.endpoint/provider"
TokenType="specialToken"
- TruststoreAlias="providerAlias"/>
+ <ServiceProvider Endpoint="http://provider.endpoint/provider"
+ TokenType="specialToken"
+ TruststoreAlias="providerAlias"/>
</ServiceProviders>
</JBossSTS>
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-bindings-jboss/pom.xml
===================================================================
--- identity-federation/trunk/jboss-identity-bindings-jboss/pom.xml 2009-09-10 17:44:51
UTC (rev 779)
+++ identity-federation/trunk/jboss-identity-bindings-jboss/pom.xml 2009-09-10 18:37:01
UTC (rev 780)
@@ -70,8 +70,14 @@
</dependency>
<dependency>
<groupId>org.jboss.security</groupId>
+ <artifactId>jboss-security-spi</artifactId>
+ <version>2.0.4</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
<artifactId>jbosssx</artifactId>
- <version>2.0.2.SP6</version>
+ <version>2.0.4</version>
<scope>compile</scope>
</dependency>
<dependency>
Added:
identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/attribute/JBossAppServerAttributeManager.java
===================================================================
---
identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/attribute/JBossAppServerAttributeManager.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/attribute/JBossAppServerAttributeManager.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -0,0 +1,104 @@
+/*
+ * 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.bindings.jboss.attribute;
+
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.identity.federation.core.interfaces.AttributeManager;
+import org.jboss.security.SecurityConstants;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.security.identity.Attribute;
+import org.jboss.security.mapping.MappingContext;
+import org.jboss.security.mapping.MappingManager;
+import org.jboss.security.mapping.MappingType;
+
+/**
+ * An attribute manager implementation for JBAS
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Sep 8, 2009
+ */
+public class JBossAppServerAttributeManager implements AttributeManager
+{
+ private static Logger log = Logger.getLogger(JBossAppServerAttributeManager.class);
+ private boolean trace = log.isTraceEnabled();
+
+ /**
+ * @see AttributeManager#getAttributes(Principal, List)
+ */
+ public Map<String, Object> getAttributes(Principal userPrincipal,
List<String> attributeKeys)
+ {
+ Map<String,Object> attributeMap = new HashMap<String, Object>();
+
+ SecurityContext sc = SecurityContextAssociation.getSecurityContext();
+ if(sc != null)
+ {
+ String mappingType = MappingType.ATTRIBUTE.name();
+ MappingManager mm = sc.getMappingManager();
+ MappingContext<List<Attribute<Object>>> mc =
mm.getMappingContext(mappingType) ;
+
+ if(mc == null)
+ {
+ log.error("Mapping Context returned is null");
+ return attributeMap;
+ }
+
+ Map<String, Object> contextMap = new HashMap<String, Object>();
+ contextMap.put(SecurityConstants.PRINCIPAL_IDENTIFIER, userPrincipal);
+
+
+ List<Attribute<Object>> attList = new
ArrayList<Attribute<Object>>();
+
+ try
+ {
+ mc.performMapping(contextMap, attList);
+ }
+ catch(Exception e)
+ {
+ log.error("Exception in attribute mapping:", e);
+ }
+ attList = (List<Attribute<Object>>)
mc.getMappingResult().getMappedObject();
+
+ if(attList != null)
+ {
+ for(Attribute<Object> attribute: attList)
+ {
+ attributeMap.put(attribute.getName(),attribute.getValue());
+ }
+ }
+ }
+ else
+ {
+ if(trace)
+ {
+ log.trace("Could not obtain security context.");
+ }
+ }
+
+ return attributeMap;
+ }
+}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-core/pom.xml
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/pom.xml 2009-09-10 17:44:51 UTC (rev
779)
+++ identity-federation/trunk/jboss-identity-fed-core/pom.xml 2009-09-10 18:37:01 UTC (rev
780)
@@ -57,6 +57,12 @@
<artifactId>openid4java</artifactId>
</dependency>
<dependency>
+ <groupId>sun-jaxws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0</version>
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/AuthPropertyType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/AuthPropertyType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/AuthPropertyType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -3,7 +3,6 @@
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.09.03 at 01:21:42 PM BRT
-//
package org.jboss.identity.federation.core.config;
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/EncAlgoType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/EncAlgoType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/EncAlgoType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -3,9 +3,7 @@
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.09.03 at 01:21:42 PM BRT
-//
-
package org.jboss.identity.federation.core.config;
import javax.xml.bind.annotation.XmlEnum;
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/EncryptionType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/EncryptionType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/EncryptionType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -2,10 +2,8 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
-//
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
-
package org.jboss.identity.federation.core.config;
import javax.xml.bind.annotation.XmlAccessType;
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/IDPType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/IDPType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/IDPType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -34,6 +34,7 @@
* </sequence>
* <attribute name="AssertionValidity"
type="{http://www.w3.org/2001/XMLSchema}long" default="300000" />
* <attribute name="RoleGenerator"
type="{http://www.w3.org/2001/XMLSchema}string"
default="org.jboss.identity.federation.bindings.tomcat.TomcatRoleGenerator"
/>
+ * <attribute name="AttributeManager"
type="{http://www.w3.org/2001/XMLSchema}string"
default="org.jboss.identity.federation.bindings.tomcat.TomcatAttributeManager"
/>
* <attribute name="Encrypt"
type="{http://www.w3.org/2001/XMLSchema}boolean" default="false"
/>
* </extension>
* </complexContent>
@@ -56,6 +57,8 @@
protected Long assertionValidity;
@XmlAttribute(name = "RoleGenerator")
protected String roleGenerator;
+ @XmlAttribute(name = "AttributeManager")
+ protected String attributeManager;
@XmlAttribute(name = "Encrypt")
protected Boolean encrypt;
@@ -140,6 +143,34 @@
}
/**
+ * Gets the value of the attributeManager property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAttributeManager() {
+ if (attributeManager == null) {
+ return
"org.jboss.identity.federation.bindings.tomcat.TomcatAttributeManager";
+ } else {
+ return attributeManager;
+ }
+ }
+
+ /**
+ * Sets the value of the attributeManager property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAttributeManager(String value) {
+ this.attributeManager = value;
+ }
+
+ /**
* Gets the value of the encrypt property.
*
* @return
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/KeyProviderType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/KeyProviderType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/KeyProviderType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/KeyValueType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/KeyValueType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/KeyValueType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/MetadataProviderType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/MetadataProviderType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/MetadataProviderType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ObjectFactory.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ObjectFactory.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ObjectFactory.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
@@ -41,32 +41,34 @@
*/
public ObjectFactory() {
}
+
/**
- * Create an instance of {@link KeyProviderType }
+ * Create an instance of {@link TokenProviderType }
*
- */
- public KeyProviderType createKeyProviderType() {
- return new KeyProviderType();
- }
-
- /**
- * Create an instance of {@link TokenProviderType }
- *
- */
+ */
public TokenProviderType createTokenProviderType() {
- return new TokenProviderType();
+ return new TokenProviderType();
}
-
- /**
- * Create an instance of {@link SPType }
- *
- */
+
+
+ /**
+ * Create an instance of {@link SPType }
+ *
+ */
public SPType createSPType() {
return new SPType();
}
/**
+ * Create an instance of {@link ProviderType }
+ *
+ */
+ public ProviderType createProviderType() {
+ return new ProviderType();
+ }
+
+ /**
* Create an instance of {@link ServiceProvidersType }
*
*/
@@ -98,23 +100,48 @@
return new ClaimProviderType();
}
- /**
- * Create an instance of {@link STSType }
+ /**
+ * Create an instance of {@link TrustType }
*
- */
+ */
+ public TrustType createTrustType() {
+ return new TrustType();
+ }
+
+ /**
+ * Create an instance of {@link STSType }
+ *
+ */
public STSType createSTSType() {
- return new STSType();
+ return new STSType();
}
/**
+ * Create an instance of {@link KeyProviderType }
+ *
+ */
+ public KeyProviderType createKeyProviderType() {
+ return new KeyProviderType();
+ }
+
+ /**
* Create an instance of {@link PropertyType }
*
- */
+ */
+
public PropertyType createPropertyType() {
return new PropertyType();
}
/**
+ * Create an instance of {@link KeyValueType }
+ *
+ */
+ public KeyValueType createKeyValueType() {
+ return new KeyValueType();
+ }
+
+ /**
* Create an instance of {@link EncryptionType }
*
*/
@@ -122,45 +149,23 @@
return new EncryptionType();
}
- /**
- * Create an instance of {@link TrustType }
+ /**
+ * Create an instance of {@link MetadataProviderType }
*
*/
- public TrustType createTrustType() {
- return new TrustType();
- }
-
- /**
- * Create an instance of {@link MetadataProviderType }
- *
- */
public MetadataProviderType createMetadataProviderType() {
return new MetadataProviderType();
- }
+ }
+
/**
- * Create an instance of {@link KeyValueType }
+ * Create an instance of {@link IDPType }
*
- */
- public KeyValueType createKeyValueType() {
- return new KeyValueType();
- }
-
- /**
- * Create an instance of {@link IDPType }
- *
- */
+ */
public IDPType createIDPType() {
- return new IDPType();
+ return new IDPType();
}
- /**
- * Create an instance of {@link ProviderType }
- *
- */
- public ProviderType createProviderType() {
- return new ProviderType();
- }
/**
* Create an instance of {@link ServiceProviderType }
@@ -186,7 +191,6 @@
public JAXBElement<IDPType> createJBossIDP(IDPType value) {
return new JAXBElement<IDPType>(_JBossIDP_QNAME, IDPType.class, null,
value);
}
-
/**
* Create an instance of {@link JAXBElement }{@code <}{@link STSType }{@code
>}}
*
@@ -205,4 +209,4 @@
return new JAXBElement<SPType>(_JBossSP_QNAME, SPType.class, null, value);
}
-}
+}
\ No newline at end of file
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ProviderType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ProviderType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ProviderType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/SPType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/SPType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/SPType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/STSType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/STSType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/STSType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ServiceProviderType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ServiceProviderType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ServiceProviderType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
@@ -30,7 +30,12 @@
* <complexType name="ServiceProviderType">
* <complexContent>
* <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+<<<<<<< .mine
* <attribute name="Endpoint" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="TruststoreAlias" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
+=======
+ * <attribute name="Endpoint" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
+>>>>>>> .r772
* <attribute name="TokenType" use="required"
type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="TruststoreAlias"
type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ServiceProvidersType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ServiceProvidersType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/ServiceProvidersType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TokenProviderType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TokenProviderType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TokenProviderType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TokenProvidersType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TokenProvidersType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TokenProvidersType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TrustType.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TrustType.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/TrustType.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/package-info.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/package-info.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/config/package-info.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.10
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.09.03 at 01:21:42 PM BRT
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.09.03 at 01:21:42 PM BRT
//
@javax.xml.bind.annotation.XmlSchema(namespace =
"urn:jboss:identity-federation:config:1.0", elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/constants/AttributeConstants.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/constants/AttributeConstants.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/constants/AttributeConstants.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -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.constants;
+
+/**
+ * Constants for attributes
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Aug 31, 2009
+ */
+public interface AttributeConstants
+{
+ String COUNTRY = "country";
+ String EMAIL_ADDRESS = "email";
+ String EMPLOYEE_TYPE = "employeeType";
+ String EMPLOYEE_NUMBER = "employeeNumber";
+ String GIVEN_NAME = "givenName";
+ String PREFERRED_LANGUAGE = "preferredLanguage";
+ String PO_BOX = "postOfficeBox";
+ String POSTAL_CODE = "postalCode";
+ String POSTAL_ADDRESS ="postalAddress";
+ String SURNAME = "surname";
+ String STREET = "street";
+ String TITLE = "title";
+ String TELEPHONE = "telephoneNumber";
+}
\ No newline at end of file
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/DelegatedAttributeManager.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/DelegatedAttributeManager.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/DelegatedAttributeManager.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -0,0 +1,71 @@
+/*
+ * 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.List;
+import java.util.Map;
+
+import org.jboss.identity.federation.core.interfaces.AttributeManager;
+
+/**
+ * An attribute manager that delegates to
+ * another manager for attributes
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Aug 31, 2009
+ */
+public class DelegatedAttributeManager implements AttributeManager
+{
+ private AttributeManager delegate = new EmptyAttributeManager();
+
+ public DelegatedAttributeManager()
+ {
+ }
+
+ /**
+ * Set the delegate
+ * @param manager
+ */
+ public void setDelegate(AttributeManager manager)
+ {
+ this.delegate = manager;
+ }
+
+ /**
+ * Is the delegate set?
+ * @return
+ */
+ public boolean isDelegateSet()
+ {
+ return this.delegate != null;
+ }
+
+ /**
+ * @see AttributeManager#getAttributes(Principal, List)
+ */
+ public Map<String, Object> getAttributes(Principal userPrincipal,
List<String> attributeKeys)
+ {
+ if(delegate == null)
+ throw new RuntimeException("Delegate is not set");
+ return delegate.getAttributes(userPrincipal, attributeKeys);
+ }
+}
\ No newline at end of file
Added:
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
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/impl/EmptyAttributeManager.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -0,0 +1,47 @@
+/*
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.identity.federation.core.interfaces.AttributeManager;
+
+/**
+ * An attribute manager implementation that just returns
+ * an empty attribute map
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Sep 10, 2009
+ */
+public class EmptyAttributeManager implements AttributeManager
+{
+ /**
+ * @see AttributeManager#getAttributes(Principal, List)
+ */
+ public Map<String, Object> getAttributes(Principal userPrincipal,
+ List<String> attributeKeys)
+ {
+ return new HashMap<String, Object>();
+ }
+}
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/AttributeManager.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/AttributeManager.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/interfaces/AttributeManager.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -0,0 +1,43 @@
+/*
+ * 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;
+import java.util.Map;
+
+/**
+ * Manages the attributes for an identity
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Aug 31, 2009
+ */
+public interface AttributeManager
+{
+ /**
+ * Given a set of keys, get back attributes
+ * @param userPrincipal Principal for whom attributes need to be retrieved
+ * @param attributeKeys
+ * @return
+ */
+ Map<String, Object> getAttributes(Principal userPrincipal,
+ List<String> attributeKeys);
+}
\ No newline at end of file
Added:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/StatementUtil.java
===================================================================
---
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/StatementUtil.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/saml/v2/util/StatementUtil.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -0,0 +1,69 @@
+/*
+ * 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.saml.v2.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.identity.federation.core.constants.AttributeConstants;
+import org.jboss.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
+import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
+import org.jboss.identity.federation.saml.v2.assertion.AttributeStatementType;
+import org.jboss.identity.federation.saml.v2.assertion.AttributeType;
+import org.jboss.identity.federation.saml.v2.assertion.ObjectFactory;
+import org.jboss.identity.federation.saml.v2.assertion.StatementAbstractType;
+
+/**
+ * Deals with SAML2 Statements
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Aug 31, 2009
+ */
+public class StatementUtil
+{
+ private static ObjectFactory factory = new ObjectFactory();
+
+ public static List<StatementAbstractType>
createStatements(Map<String,Object> attributes)
+ {
+ List<StatementAbstractType> statements = new
ArrayList<StatementAbstractType>();
+
+ Set<String> keys = attributes.keySet();
+ for(String key: keys)
+ {
+ Object value = attributes.get(key);
+
+ if(AttributeConstants.EMAIL_ADDRESS.equals(key))
+ {
+ AttributeStatementType attrStatement =
JBossSAMLBaseFactory.createAttributeStatement();
+ AttributeType att = factory.createAttributeType();
+ att.setNameFormat(JBossSAMLURIConstants.NAMEID_FORMAT_EMAIL.get());
+
+ //rolename
+ att.getAttributeValue().add(value);
+ attrStatement.getAttributeOrEncryptedAttribute().add(att);
+ statements.add(attrStatement);
+ }
+ }
+ return statements;
+ }
+}
\ No newline at end of file
Added:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/managers/WebAttributeManager.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/managers/WebAttributeManager.java
(rev 0)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/managers/WebAttributeManager.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -0,0 +1,45 @@
+/*
+ * 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.managers;
+
+import java.security.Principal;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.identity.federation.core.interfaces.AttributeManager;
+
+/**
+ * A default attribute manager for web applications
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Sep 10, 2009
+ */
+public class WebAttributeManager implements AttributeManager
+{
+ /**
+ * @see AttributeManager#getAttributes(Principal, List)
+ */
+ public Map<String, Object> getAttributes(Principal userPrincipal,
+ List<String> attributeKeys)
+ {
+ throw new RuntimeException("Not implemented");
+ }
+}
\ No newline at end of file
Modified:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPLoginServlet.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPLoginServlet.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPLoginServlet.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -78,6 +78,9 @@
log("No username or password found. Redirecting to login page");
this.saveRequest(request, session);
+ if(response.isCommitted())
+ throw new RuntimeException("Response is committed. Cannot forward to
login page.");
+
this.redirectToLoginPage(request, response);
}
else
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-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/servlets/IDPServlet.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -26,7 +26,9 @@
import java.security.GeneralSecurityException;
import java.security.Principal;
import java.security.PublicKey;
+import java.util.ArrayList;
import java.util.List;
+import java.util.StringTokenizer;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
@@ -41,6 +43,8 @@
import org.jboss.identity.federation.core.config.KeyProviderType;
import org.jboss.identity.federation.core.exceptions.ConfigurationException;
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.saml.v2.constants.JBossSAMLURIConstants;
import
org.jboss.identity.federation.core.saml.v2.exceptions.IssueInstantMissingException;
import org.jboss.identity.federation.core.saml.v2.exceptions.IssuerNotTrustedException;
@@ -73,7 +77,11 @@
protected transient IDPType idpConfiguration = null;
private transient RoleGenerator rg = new DefaultRoleGenerator();
+
+ private transient DelegatedAttributeManager attribManager = new
DelegatedAttributeManager();
+ private List<String> attributeKeys = new ArrayList<String>();
+
private long assertionValidity = 5000; // 5 seconds in miliseconds
private String identityURL = null;
@@ -106,6 +114,15 @@
this.identityURL = idpConfiguration.getIdentityURL();
log.trace("Identity Provider URL=" + this.identityURL);
this.assertionValidity = idpConfiguration.getAssertionValidity();
+
+ //Get the attribute manager
+ String attributeManager = idpConfiguration.getAttributeManager();
+ if(attributeManager != null && !"".equals(attributeManager))
+ {
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ AttributeManager delegate = (AttributeManager)
tcl.loadClass(attributeManager).newInstance();
+ this.attribManager.setDelegate(delegate);
+ }
}
catch (Exception e)
{
@@ -142,6 +159,17 @@
String rgString = config.getInitParameter("ROLE_GENERATOR");
if(rgString != null && !"".equals(rgString))
this.setRoleGenerator(rgString);
+
+ //Get a list of attributes we are interested in
+ String attribList = config.getInitParameter("ATTRIBUTE_KEYS");
+ if(attribList != null && !"".equals(attribList))
+ {
+ StringTokenizer st = new StringTokenizer(attribList,",");
+ while(st != null && st.hasMoreTokens())
+ {
+ this.attributeKeys.add(st.nextToken());
+ }
+ }
}
@SuppressWarnings("unchecked")
@@ -170,6 +198,8 @@
IDPWebRequestUtil webRequestUtil = new IDPWebRequestUtil(request,
idpConfiguration, keyManager);
+ webRequestUtil.setAttributeManager(this.attribManager);
+ webRequestUtil.setAttributeKeys(attributeKeys);
if(userPrincipal != null)
{
@@ -272,6 +302,9 @@
{
try
{
+ if(samlResponse == null)
+ throw new ServletException("SAML Response has not been
generated");
+
if(this.signOutgoingMessages)
webRequestUtil.send(samlResponse, destination,relayState, response,
true,
this.keyManager.getSigningKey());
Modified:
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-web/src/main/java/org/jboss/identity/federation/web/util/IDPWebRequestUtil.java 2009-09-10
18:37:01 UTC (rev 780)
@@ -30,6 +30,7 @@
import java.security.Principal;
import java.security.PrivateKey;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
@@ -45,8 +46,9 @@
import org.jboss.identity.federation.core.config.IDPType;
import org.jboss.identity.federation.core.config.TrustType;
import org.jboss.identity.federation.core.exceptions.ConfigurationException;
-import org.jboss.identity.federation.core.exceptions.ParsingException;
-import org.jboss.identity.federation.core.saml.v2.common.IDGenerator;
+import org.jboss.identity.federation.core.exceptions.ParsingException;
+import org.jboss.identity.federation.core.interfaces.AttributeManager;
+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;
import org.jboss.identity.federation.core.saml.v2.exceptions.IssuerNotTrustedException;
@@ -54,11 +56,13 @@
import org.jboss.identity.federation.core.saml.v2.holders.IDPInfoHolder;
import org.jboss.identity.federation.core.saml.v2.holders.IssuerInfoHolder;
import org.jboss.identity.federation.core.saml.v2.holders.SPInfoHolder;
-import org.jboss.identity.federation.core.saml.v2.util.DocumentUtil;
+import org.jboss.identity.federation.core.saml.v2.util.DocumentUtil;
+import org.jboss.identity.federation.core.saml.v2.util.StatementUtil;
import org.jboss.identity.federation.saml.v2.assertion.AssertionType;
import org.jboss.identity.federation.saml.v2.assertion.AttributeStatementType;
+import org.jboss.identity.federation.saml.v2.assertion.StatementAbstractType;
import org.jboss.identity.federation.saml.v2.protocol.RequestAbstractType;
-import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
+import org.jboss.identity.federation.saml.v2.protocol.ResponseType;
import org.jboss.identity.federation.web.interfaces.TrustKeyManager;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -79,6 +83,8 @@
private IDPType idpConfiguration;
private TrustKeyManager keyManager;
+ private AttributeManager attributeManager;
+ private List<String> attribKeys;
public IDPWebRequestUtil(HttpServletRequest request, IDPType idp, TrustKeyManager
keym)
{
@@ -88,6 +94,16 @@
this.postProfile = "POST".equals(request.getMethod());
}
+ public void setAttributeKeys(List<String> attribKeys)
+ {
+ this.attribKeys = attribKeys;
+ }
+
+ public void setAttributeManager(AttributeManager attributeManager)
+ {
+ this.attributeManager = attributeManager;
+ }
+
public boolean hasSAMLRequestInRedirectProfile()
{
return redirectProfile;
@@ -148,7 +164,6 @@
sp.setResponseDestinationURI(assertionConsumerURL);
responseType = saml2Response.createResponseType(id, sp, idp, issuerHolder);
-
//Add information on the roles
AssertionType assertion = (AssertionType)
responseType.getAssertionOrEncryptedAssertion().get(0);
@@ -157,6 +172,15 @@
//Add timed conditions
saml2Response.createTimedConditions(assertion, assertionValidity);
+
+ //Add in the attributes information
+ if(this.attributeManager != null)
+ {
+ Map<String, Object> attribs =
+ attributeManager.getAttributes(userPrincipal, this.attribKeys);
+ List<StatementAbstractType> stats =
StatementUtil.createStatements(attribs);
+ assertion.getStatementOrAuthnStatementOrAuthzDecisionStatement().addAll(stats);
+ }
//Lets see how the response looks like
if(log.isTraceEnabled())
Modified:
identity-federation/trunk/jboss-identity-web/src/main/resources/schema/config/jboss-identity-fed.xsd
===================================================================
---
identity-federation/trunk/jboss-identity-web/src/main/resources/schema/config/jboss-identity-fed.xsd 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-web/src/main/resources/schema/config/jboss-identity-fed.xsd 2009-09-10
18:37:01 UTC (rev 780)
@@ -23,6 +23,10 @@
use="optional"
default="org.jboss.identity.federation.bindings.tomcat.TomcatRoleGenerator">
</attribute>
+ <attribute name="AttributeManager" type="string"
+ use="optional"
+ default="org.jboss.identity.federation.bindings.tomcat.TomcatAttributeManager">
+ </attribute>
<attribute name="Encrypt" type="boolean"
use="optional"
default="false">
</attribute>
Modified:
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/jsp/login.jsp
===================================================================
---
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/jsp/login.jsp 2009-09-10
17:44:51 UTC (rev 779)
+++
identity-federation/trunk/jboss-identity-webapps/idp-standalone/src/main/webapp/jsp/login.jsp 2009-09-10
18:37:01 UTC (rev 780)
@@ -2,12 +2,12 @@
<body>
<font size='5' color='blue'>Please Login</font><hr>
-<form action='j_security_check' method='post'>
+<form action='<%=application.getContextPath()%>/'
method='post'>
<table>
<tr><td>Name:</td>
- <td><input type='text'
name='j_username'></td></tr>
+ <td><input type='text'
name='JBID_USERNAME'></td></tr>
<tr><td>Password:</td>
- <td><input type='password' name='j_password'
size='8'></td>
+ <td><input type='password' name='JBID_PASSWORD'
size='8'></td>
</tr>
</table>
<br>