Author: anil.saldhana(a)jboss.com
Date: 2012-02-22 16:21:07 -0500 (Wed, 22 Feb 2012)
New Revision: 1431
Added:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/util/StringUtilTestCase.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/AbstractSAMLConfigurationProvider.java
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/IDPType.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/KeyValueType.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/ProviderType.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/SPType.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/StringUtil.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/IDPMetadataConfigurationProvider.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/SPPostMetadataConfigurationProvider.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/SPRedirectMetadataConfigurationProvider.java
federation/trunk/picketlink-web/src/test/java/org/picketlink/test/identity/federation/web/saml/config/IDPMetadataConfigurationProviderUnitTestCase.java
federation/trunk/picketlink-web/src/test/java/org/picketlink/test/identity/federation/web/saml/config/SPPostMetadataConfigurationProviderUnitTestCase.java
Log:
PLFED-266: an abstract saml configuration provider that can additionally take in the
configuration from picketlink-idfed.xml
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
===================================================================
---
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -116,6 +116,7 @@
import org.picketlink.identity.federation.saml.v2.SAML2Object;
import org.picketlink.identity.federation.saml.v2.protocol.RequestAbstractType;
import org.picketlink.identity.federation.saml.v2.protocol.StatusResponseType;
+import org.picketlink.identity.federation.web.config.AbstractSAMLConfigurationProvider;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.core.HTTPContext;
import org.picketlink.identity.federation.web.core.IdentityParticipantStack;
@@ -1053,27 +1054,36 @@
}
}
+ String configFile = GeneralConstants.CONFIG_FILE_LOCATION;
+ context = (Context) getContainer();
+
+ InputStream is = context.getServletContext().getResourceAsStream(configFile);
+
//Work on the IDP Configuration
if (configProvider != null)
{
try
{
idpConfiguration = configProvider.getIDPConfiguration();
+
+ //Additionally parse the config file
+ if (is != null && configProvider instanceof
AbstractSAMLConfigurationProvider)
+ {
+ ((AbstractSAMLConfigurationProvider) configProvider).setConfigFile(is);
+ }
}
catch (ProcessingException e)
{
throw new RuntimeException(ErrorCodes.PROCESSING_EXCEPTION +
e.getLocalizedMessage());
}
+ catch (ParsingException e)
+ {
+ throw new RuntimeException(ErrorCodes.PARSING_ERROR +
e.getLocalizedMessage());
+ }
}
- String configFile = GeneralConstants.CONFIG_FILE_LOCATION;
-
- context = (Context) getContainer();
-
if (idpConfiguration == null)
{
-
- InputStream is = context.getServletContext().getResourceAsStream(configFile);
if (is == null)
throw new RuntimeException(ErrorCodes.IDP_WEBBROWSER_VALVE_CONF_FILE_MISSING
+ configFile);
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java
===================================================================
---
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/BaseFormAuthenticator.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -73,6 +73,7 @@
import org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType;
import org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorType;
import org.picketlink.identity.federation.saml.v2.metadata.KeyDescriptorType;
+import org.picketlink.identity.federation.web.config.AbstractSAMLConfigurationProvider;
import org.picketlink.identity.federation.web.constants.GeneralConstants;
import org.picketlink.identity.federation.web.util.ConfigurationUtil;
import org.picketlink.identity.federation.web.util.SAMLConfigurationProvider;
@@ -396,6 +397,10 @@
if (configProvider != null)
{
spConfiguration = configProvider.getSPConfiguration();
+ if (configProvider instanceof AbstractSAMLConfigurationProvider)
+ {
+ ((AbstractSAMLConfigurationProvider) configProvider).setConfigFile(is);
+ }
}
else
{
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/IDPType.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/IDPType.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/IDPType.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -21,6 +21,8 @@
*/
package org.picketlink.identity.federation.core.config;
+import org.picketlink.identity.federation.core.util.StringUtil;
+
/**
*
* IDP Type defines the configuration for an Identity
@@ -220,4 +222,26 @@
this.encrypt = value;
}
-}
+ /**
+ * Import values from another {@link IDPType}
+ * @param other
+ */
+ public void importFrom(IDPType other)
+ {
+ super.importFrom(other);
+
+ String attributeManager = other.getAttributeManager();
+ if (StringUtil.isNotNull(attributeManager))
+ {
+ setAttributeManager(attributeManager);
+ }
+ assertionValidity = other.getAssertionValidity();
+
+ encrypt = other.isEncrypt();
+
+ if (StringUtil.isNotNull(other.getRoleGenerator()))
+ {
+ this.roleGenerator = other.getRoleGenerator();
+ }
+ }
+}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/KeyValueType.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/KeyValueType.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/KeyValueType.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -98,4 +98,17 @@
this.value = value;
}
-}
+ /**
+ * Create a new instance
+ * @param key
+ * @param value
+ * @return
+ */
+ public static KeyValueType create(String key, String value)
+ {
+ KeyValueType keyValueType = new KeyValueType();
+ keyValueType.setKey(key);
+ keyValueType.setValue(value);
+ return keyValueType;
+ }
+}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/ProviderType.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/ProviderType.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/ProviderType.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -26,6 +26,8 @@
import javax.xml.crypto.dsig.CanonicalizationMethod;
+import org.picketlink.identity.federation.core.util.StringUtil;
+
/**
* Base Type for IDP and SP
*
@@ -268,4 +270,27 @@
{
return additionalOptions.get(key);
}
+
+ /**
+ * Import values from another {@link IDPType}
+ * @param other
+ */
+ public void importFrom(ProviderType other)
+ {
+ KeyProviderType keyProvider = other.getKeyProvider();
+ if (keyProvider != null)
+ {
+ setKeyProvider(keyProvider);
+ }
+
+ String can = other.getCanonicalizationMethod();
+ if (StringUtil.isNotNull(can))
+ {
+ setCanonicalizationMethod(can);
+ }
+
+ trust = other.getTrust();
+
+ additionalOptions.putAll(other.additionalOptions);
+ }
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/SPType.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/SPType.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/config/SPType.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -21,6 +21,7 @@
*/
package org.picketlink.identity.federation.core.config;
+
/**
* Service Provider Type
*
@@ -44,7 +45,6 @@
*/
public class SPType extends ProviderType
{
-
protected String serviceURL;
protected String idpMetadataFile;
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/StringUtil.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/StringUtil.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/util/StringUtil.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -22,7 +22,9 @@
package org.picketlink.identity.federation.core.util;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -139,8 +141,19 @@
*/
public static List<String> tokenize(String str)
{
+ return tokenize(str, ",");
+ }
+
+ /**
+ * Given a delimited string, get the tokens as a {@link List}
+ * @param str
+ * @param delimiter the delimiter
+ * @return
+ */
+ public static List<String> tokenize(String str, String delimiter)
+ {
List<String> list = new ArrayList<String>();
- StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ StringTokenizer tokenizer = new StringTokenizer(str, delimiter);
while (tokenizer.hasMoreTokens())
{
list.add(tokenizer.nextToken());
@@ -149,6 +162,24 @@
}
/**
+ * Given a string that is comma delimited and contains key-value pairs
+ * @param keyValuePairString
+ * @return
+ */
+ public static Map<String, String> tokenizeKeyValuePair(String
keyValuePairString)
+ {
+ Map<String, String> map = new HashMap<String, String>();
+
+ List<String> tokens = tokenize(keyValuePairString);
+ for (String token : tokens)
+ {
+ int location = token.indexOf('=');
+ map.put(token.substring(0, location), token.substring(location + 1));
+ }
+ return map;
+ }
+
+ /**
* Given a masked password {@link String}, decode it
* @param maskedString a password string that is masked
* @param salt Salt
Added:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/util/StringUtilTestCase.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/util/StringUtilTestCase.java
(rev 0)
+++
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/util/StringUtilTestCase.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.picketlink.test.identity.federation.core.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.picketlink.identity.federation.core.util.StringUtil;
+
+/**
+ * Unit test {@link StringUtil}
+ * @author Anil Saldhana
+ * @since Feb 22, 2012
+ */
+public class StringUtilTestCase
+{
+ @Test
+ public void testTokenizeKeyValuePairs() throws Exception
+ {
+ String str = "a=b,c=d,e=f";
+ Map<String, String> map = StringUtil.tokenizeKeyValuePair(str);
+
+ assertEquals("b", map.get("a"));
+ assertEquals("d", map.get("c"));
+ assertEquals("f", map.get("e"));
+ }
+
+ @Test
+ public void testTokenize() throws Exception
+ {
+ String str = "a,b";
+
+ String theOtherString = "a/b;c/d";
+
+ List<String> list = StringUtil.tokenize(str);
+ assertEquals(2, list.size());
+ assertTrue(list.contains("a"));
+ assertTrue(list.contains("b"));
+
+ List<String> bigList = StringUtil.tokenize(theOtherString, ";");
+ assertEquals(2, bigList.size());
+ for (String token : bigList)
+ {
+ List<String> theList = StringUtil.tokenize(token, "/");
+
+ if (token.equals("a/b"))
+ {
+ assertTrue(theList.contains("a"));
+ assertTrue(theList.contains("b"));
+ }
+ else if (token.equals("c/d"))
+ {
+ assertTrue(theList.contains("c"));
+ assertTrue(theList.contains("d"));
+ }
+ else
+ throw new RuntimeException("Unknown");
+ }
+ }
+}
\ No newline at end of file
Added:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/AbstractSAMLConfigurationProvider.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/AbstractSAMLConfigurationProvider.java
(rev 0)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/AbstractSAMLConfigurationProvider.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.picketlink.identity.federation.web.config;
+
+import java.io.InputStream;
+
+import org.picketlink.identity.federation.core.ErrorCodes;
+import org.picketlink.identity.federation.core.config.IDPType;
+import org.picketlink.identity.federation.core.config.SPType;
+import org.picketlink.identity.federation.core.exceptions.ParsingException;
+import org.picketlink.identity.federation.core.exceptions.ProcessingException;
+import org.picketlink.identity.federation.core.parsers.config.SAMLConfigParser;
+import org.picketlink.identity.federation.web.util.SAMLConfigurationProvider;
+
+/**
+ * An abstact class to hold the common functionality across providers
+ * @author Anil Saldhana
+ * @since Feb 22, 2012
+ */
+public abstract class AbstractSAMLConfigurationProvider implements
SAMLConfigurationProvider
+{
+ public static final String VALIDATING_ALIAS = "ValidatingAlias";
+
+ protected IDPType configParsedIDPType = null;
+
+ protected SPType configParsedSPType = null;
+
+ public void setConfigFile(InputStream is) throws ParsingException
+ {
+ if (is == null)
+ {
+ throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT);
+ }
+
+ SAMLConfigParser parser = new SAMLConfigParser();
+ Object parsedObject = parser.parse(is);
+ if (parsedObject instanceof IDPType)
+ configParsedIDPType = (IDPType) parsedObject;
+ else
+ configParsedSPType = (SPType) parsedObject;
+ }
+
+ public abstract IDPType getIDPConfiguration() throws ProcessingException;
+
+ public abstract SPType getSPConfiguration() throws ProcessingException;
+}
\ No newline at end of file
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/IDPMetadataConfigurationProvider.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/IDPMetadataConfigurationProvider.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/IDPMetadataConfigurationProvider.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -49,7 +49,9 @@
* @author Anil Saldhana
* @since Feb 15, 2012
*/
-public class IDPMetadataConfigurationProvider implements SAMLConfigurationProvider
+public class IDPMetadataConfigurationProvider extends AbstractSAMLConfigurationProvider
+ implements
+ SAMLConfigurationProvider
{
public static final String IDP_MD_FILE = "idp-metadata.xml";
@@ -76,6 +78,11 @@
}
}
+ if (configParsedIDPType != null)
+ {
+ idpType.importFrom(configParsedIDPType);
+ }
+
return idpType;
}
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/SPPostMetadataConfigurationProvider.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/SPPostMetadataConfigurationProvider.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/SPPostMetadataConfigurationProvider.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -49,7 +49,9 @@
* @author Anil Saldhana
* @since Feb 15, 2012
*/
-public class SPPostMetadataConfigurationProvider implements SAMLConfigurationProvider
+public class SPPostMetadataConfigurationProvider extends
AbstractSAMLConfigurationProvider
+ implements
+ SAMLConfigurationProvider
{
public static final String SP_MD_FILE = "sp-metadata.xml";
@@ -81,7 +83,10 @@
throw new ProcessingException(e);
}
}
-
+ if (configParsedSPType != null)
+ {
+ spType.importFrom(configParsedSPType);
+ }
return spType;
}
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/SPRedirectMetadataConfigurationProvider.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/SPRedirectMetadataConfigurationProvider.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/config/SPRedirectMetadataConfigurationProvider.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -49,7 +49,9 @@
* @author Anil Saldhana
* @since Feb 15, 2012
*/
-public class SPRedirectMetadataConfigurationProvider implements
SAMLConfigurationProvider
+public class SPRedirectMetadataConfigurationProvider extends
AbstractSAMLConfigurationProvider
+ implements
+ SAMLConfigurationProvider
{
public static final String SP_MD_FILE = "sp-metadata.xml";
@@ -81,7 +83,10 @@
throw new ProcessingException(e);
}
}
-
+ if (configParsedSPType != null)
+ {
+ spType.importFrom(configParsedSPType);
+ }
return spType;
}
Modified:
federation/trunk/picketlink-web/src/test/java/org/picketlink/test/identity/federation/web/saml/config/IDPMetadataConfigurationProviderUnitTestCase.java
===================================================================
---
federation/trunk/picketlink-web/src/test/java/org/picketlink/test/identity/federation/web/saml/config/IDPMetadataConfigurationProviderUnitTestCase.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-web/src/test/java/org/picketlink/test/identity/federation/web/saml/config/IDPMetadataConfigurationProviderUnitTestCase.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -24,8 +24,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import java.io.InputStream;
+
import org.junit.Test;
import org.picketlink.identity.federation.core.config.IDPType;
+import org.picketlink.identity.federation.core.config.TrustType;
import org.picketlink.identity.federation.core.exceptions.ProcessingException;
import org.picketlink.identity.federation.web.config.IDPMetadataConfigurationProvider;
@@ -45,4 +48,23 @@
assertEquals("https://idp.testshib.org/idp/profile/SAML2/POST/SSO",
idp.getIdentityURL());
}
+ @Test
+ public void testIDPTypeWithConfig() throws Exception
+ {
+ IDPMetadataConfigurationProvider provider = new
IDPMetadataConfigurationProvider();
+ InputStream is = Thread.currentThread().getContextClassLoader()
+
.getResourceAsStream("saml2/logout/idp/WEB-INF/picketlink-idfed.xml");
+ assertNotNull(is);
+ provider.setConfigFile(is);
+
+ IDPType idp = provider.getIDPConfiguration();
+ assertNotNull(idp);
+
assertEquals("https://idp.testshib.org/idp/profile/SAML2/POST/SSO",
idp.getIdentityURL());
+
+ TrustType trust = idp.getTrust();
+ assertNotNull(trust);
+ assertEquals("localhost,jboss.com,jboss.org", trust.getDomains());
+
+
assertEquals("org.picketlink.identity.federation.core.impl.EmptyAttributeManager",
idp.getAttributeManager());
+ }
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-web/src/test/java/org/picketlink/test/identity/federation/web/saml/config/SPPostMetadataConfigurationProviderUnitTestCase.java
===================================================================
---
federation/trunk/picketlink-web/src/test/java/org/picketlink/test/identity/federation/web/saml/config/SPPostMetadataConfigurationProviderUnitTestCase.java 2012-02-22
18:49:45 UTC (rev 1430)
+++
federation/trunk/picketlink-web/src/test/java/org/picketlink/test/identity/federation/web/saml/config/SPPostMetadataConfigurationProviderUnitTestCase.java 2012-02-22
21:21:07 UTC (rev 1431)
@@ -24,6 +24,8 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import java.io.InputStream;
+
import org.junit.Test;
import org.picketlink.identity.federation.core.config.SPType;
import org.picketlink.identity.federation.core.exceptions.ProcessingException;
@@ -45,4 +47,18 @@
assertEquals("https://sp.testshib.org/Shibboleth.sso/SAML2/POST",
sp.getServiceURL());
}
+ @Test
+ public void testSPTypeWithConfig() throws Exception
+ {
+ SPPostMetadataConfigurationProvider provider = new
SPPostMetadataConfigurationProvider();
+ InputStream is = Thread.currentThread().getContextClassLoader()
+
.getResourceAsStream("saml2/logout/sp/sales/WEB-INF/picketlink-idfed.xml");
+ assertNotNull(is);
+ provider.setConfigFile(is);
+
+ SPType sp = provider.getSPConfiguration();
+ assertNotNull(sp);
+
assertEquals("https://sp.testshib.org/Shibboleth.sso/SAML2/POST",
sp.getServiceURL());
+ }
+
}
\ No newline at end of file