Picketlink SVN: r581 - federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-01 09:14:43 -0500 (Wed, 01 Dec 2010)
New Revision: 581
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java
Log:
addtl fixes
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2010-12-01 13:21:53 UTC (rev 580)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2010-12-01 14:14:43 UTC (rev 581)
@@ -542,7 +542,7 @@
AssertionType assertion = this.validateSAMLAssertionResponse(baseResponse, "testcontext", "jduke",
SAMLUtil.SAML2_HOLDER_OF_KEY_URI);
// validate the holder of key contents.
- SubjectConfirmationType subjConfirmation = (SubjectConfirmationType) assertion.getSubject().getConfirmation().get(1);
+ SubjectConfirmationType subjConfirmation = (SubjectConfirmationType) assertion.getSubject().getConfirmation().get(0);
this.validateHolderOfKeyContents(subjConfirmation, WSTrustConstants.KEY_TYPE_PUBLIC, certificate, false);
}
@@ -579,7 +579,7 @@
AssertionType assertion = this.validateSAMLAssertionResponse(baseResponse, "testcontext", "jduke",
SAMLUtil.SAML2_HOLDER_OF_KEY_URI);
// validate the holder of key contents.
- SubjectConfirmationType subjConfirmation = (SubjectConfirmationType) assertion.getSubject().getConfirmation().get(1) ;
+ SubjectConfirmationType subjConfirmation = (SubjectConfirmationType) assertion.getSubject().getConfirmation().get(0) ;
this.validateHolderOfKeyContents(subjConfirmation, WSTrustConstants.KEY_TYPE_PUBLIC, certificate, true);
}
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java 2010-12-01 13:21:53 UTC (rev 580)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java 2010-12-01 14:14:43 UTC (rev 581)
@@ -29,11 +29,8 @@
import java.util.Arrays;
import java.util.GregorianCalendar;
import java.util.HashMap;
-import java.util.List;
-import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult;
@@ -41,8 +38,9 @@
import junit.framework.TestCase;
+import org.picketlink.identity.federation.core.parsers.saml.SAMLAssertionParser;
import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
-import org.picketlink.identity.federation.core.wstrust.StandardSecurityToken;
+import org.picketlink.identity.federation.core.wstrust.SecurityToken;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
import org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext;
import org.picketlink.identity.federation.core.wstrust.WSTrustUtil;
@@ -50,9 +48,14 @@
import org.picketlink.identity.federation.core.wstrust.plugins.saml.SAMLUtil;
import org.picketlink.identity.federation.core.wstrust.wrappers.Lifetime;
import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
-import org.picketlink.identity.federation.core.wstrust.writers.WSTrustRequestWriter;
+import org.picketlink.identity.federation.core.wstrust.writers.WSTrustRequestWriter;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AudienceRestrictionType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.ConditionsType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.NameIDType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.SubjectConfirmationDataType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.SubjectConfirmationType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.SubjectType;
import org.picketlink.identity.federation.ws.trust.RequestedReferenceType;
import org.picketlink.identity.federation.ws.trust.StatusType;
import org.picketlink.identity.federation.ws.trust.ValidateTargetType;
@@ -60,7 +63,6 @@
import org.picketlink.identity.federation.ws.wss.secext.SecurityTokenReferenceType;
import org.picketlink.identity.xmlsec.w3.xmldsig.KeyInfoType;
import org.picketlink.identity.xmlsec.w3.xmldsig.X509DataType;
-import org.picketlink.identity.xmlsec.w3.xmlenc.EncryptedKeyType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -92,10 +94,10 @@
* @throws Exception if an error occurs while running the test.
*/
public void testIssueSAMLV20Token() throws Exception
- {
- fail( "Work on this");
+ {
+ SAMLAssertionParser assertionParser = new SAMLAssertionParser();
- /*// create a WSTrustRequestContext with a simple WS-Trust request.
+ // create a WSTrustRequestContext with a simple WS-Trust request.
RequestSecurityToken request = new RequestSecurityToken();
request.setLifetime(WSTrustUtil.createDefaultLifetime(3600000));
request.setAppliesTo(WSTrustUtil.createAppliesTo("http://services.testcorp.org/provider2"));
@@ -108,7 +110,10 @@
this.provider.issueToken(context);
assertNotNull("Unexpected null security token", context.getSecurityToken());
- JAXBContext jaxbContext = JAXBContext.newInstance("org.picketlink.identity.federation.saml.v2.assertion");
+ SecurityToken securityToken = context.getSecurityToken();
+
+ AssertionType assertion = assertionParser.fromElement( (Element) securityToken.getTokenValue() );
+ /*JAXBContext jaxbContext = JAXBContext.newInstance("org.picketlink.identity.federation.saml.v2.assertion");
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
JAXBElement<?> parsedElement = (JAXBElement<?>) unmarshaller.unmarshal((Element) context.getSecurityToken()
.getTokenValue());
@@ -116,7 +121,7 @@
assertEquals("Unexpected element type", AssertionType.class, parsedElement.getDeclaredType());
AssertionType assertion = (AssertionType) parsedElement.getValue();
- StandardSecurityToken securityToken = (StandardSecurityToken) context.getSecurityToken();
+ StandardSecurityToken securityToken = (StandardSecurityToken) context.getSecurityToken();*/
assertEquals("Unexpected token id", securityToken.getTokenID(), assertion.getID());
assertEquals("Unexpected token issuer", "PicketLinkSTS", assertion.getIssuer().getValue());
@@ -125,29 +130,23 @@
assertNotNull("Unexpected null conditions", conditions);
assertNotNull("Unexpected null value for NotBefore attribute", conditions.getNotBefore());
assertNotNull("Unexpected null value for NotOnOrAfter attribute", conditions.getNotOnOrAfter());
- assertEquals("Unexpected number of conditions", 1, conditions.getConditionOrAudienceRestrictionOrOneTimeUse()
- .size());
- assertTrue("Unexpected condition type",
- conditions.getConditionOrAudienceRestrictionOrOneTimeUse().get(0) instanceof AudienceRestrictionType);
- AudienceRestrictionType restrictionType = (AudienceRestrictionType) conditions
- .getConditionOrAudienceRestrictionOrOneTimeUse().get(0);
+ assertEquals("Unexpected number of conditions", 1, conditions.getConditions().size());
+
+ AudienceRestrictionType restrictionType = (AudienceRestrictionType) conditions.getConditions().get(0);
assertNotNull("Unexpected null audience list", restrictionType.getAudience());
assertEquals("Unexpected number of audience elements", 1, restrictionType.getAudience().size());
assertEquals("Unexpected audience value", "http://services.testcorp.org/provider2", restrictionType.getAudience()
- .get(0));
+ .get(0).toString());
// check the contents of the assertion subject.
SubjectType subject = assertion.getSubject();
- assertNotNull("Unexpected null subject", subject);
- assertEquals("Unexpected subject content size", 2, subject.getContent().size());
- JAXBElement<?> content = subject.getContent().get(0);
- assertEquals("Unexpected content type", NameIDType.class, content.getDeclaredType());
- NameIDType nameID = (NameIDType) content.getValue();
+ assertNotNull("Unexpected null subject", subject);
+
+ NameIDType nameID = (NameIDType) subject.getSubType().getBaseID();
assertEquals("Unexpected name id qualifier", "urn:picketlink:identity-federation", nameID.getNameQualifier());
assertEquals("Unexpected name id", "sguilhen", nameID.getValue());
- content = subject.getContent().get(1);
- assertEquals("Unexpected content type", SubjectConfirmationType.class, content.getDeclaredType());
- SubjectConfirmationType confirmation = (SubjectConfirmationType) content.getValue();
+
+ SubjectConfirmationType confirmation = (SubjectConfirmationType) subject.getConfirmation().get(0);
assertEquals("Unexpected confirmation method", SAMLUtil.SAML2_BEARER_URI, confirmation.getMethod());
// validate the attached token reference created by the SAML provider.
@@ -161,7 +160,7 @@
KeyIdentifierType keyId = (KeyIdentifierType) securityRef.getAny().get(0);
assertEquals("Unexpected key value type", SAMLUtil.SAML2_VALUE_TYPE, keyId.getValueType());
assertNotNull("Unexpected null key identifier value", keyId.getValue());
- assertEquals(assertion.getID(), keyId.getValue().substring(1));*/
+ assertEquals(assertion.getID(), keyId.getValue().substring(1));
}
/**
@@ -174,8 +173,7 @@
*/
public void testIssueSAMLV20HolderOfKeyToken() throws Exception
{
- fail( "work" );
- /*// create a WSTrustRequestContext with a simple WS-Trust request.
+ // create a WSTrustRequestContext with a simple WS-Trust request.
RequestSecurityToken request = new RequestSecurityToken();
request.setLifetime(WSTrustUtil.createDefaultLifetime(3600000));
request.setAppliesTo(WSTrustUtil.createAppliesTo("http://services.testcorp.org/provider2"));
@@ -197,24 +195,31 @@
AssertionType assertion = SAMLUtil.fromElement((Element) context.getSecurityToken().getTokenValue());
SubjectType subject = assertion.getSubject();
assertNotNull("Unexpected null subject", subject);
- assertEquals("Unexpected subject content size", 2, subject.getContent().size());
+
+ /*assertEquals("Unexpected subject content size", 2, subject.getContent().size());
JAXBElement<?> content = subject.getContent().get(0);
assertEquals("Unexpected content type", NameIDType.class, content.getDeclaredType());
- NameIDType nameID = (NameIDType) content.getValue();
+ */
+
+ NameIDType nameID = (NameIDType) subject.getSubType().getBaseID();
assertEquals("Unexpected name id qualifier", "urn:picketlink:identity-federation", nameID.getNameQualifier());
assertEquals("Unexpected name id", "sguilhen", nameID.getValue());
- content = subject.getContent().get(1);
- assertEquals("Unexpected content type", SubjectConfirmationType.class, content.getDeclaredType());
- SubjectConfirmationType confirmation = (SubjectConfirmationType) content.getValue();
+
+ SubjectConfirmationType confirmation = (SubjectConfirmationType) subject.getConfirmation().get(0);
assertEquals("Unexpected confirmation method", SAMLUtil.SAML2_HOLDER_OF_KEY_URI, confirmation.getMethod());
- List<Object> confirmationContent = confirmation.getSubjectConfirmationData().getContent();
+
+ /*List<Object> confirmationContent = confirmation.getSubjectConfirmationData().getContent();
assertEquals("Unexpected subject confirmation content size", 1, confirmationContent.size());
JAXBElement<?> keyInfoElement = (JAXBElement<?>) confirmationContent.get(0);
assertEquals("Unexpected subject confirmation context type", KeyInfoType.class, keyInfoElement.getDeclaredType());
KeyInfoType keyInfo = (KeyInfoType) keyInfoElement.getValue();
assertEquals("Unexpected key info content size", 1, keyInfo.getContent().size());
JAXBElement<?> encKeyElement = (JAXBElement<?>) keyInfo.getContent().get(0);
- assertEquals("Unexpected key info content type", EncryptedKeyType.class, encKeyElement.getDeclaredType());
+ assertEquals("Unexpected key info content type", EncryptedKeyType.class, encKeyElement.getDeclaredType());*/
+
+ SubjectConfirmationDataType confirmData = confirmation.getSubjectConfirmationData();
+
+ KeyInfoType keyInfo = (KeyInfoType) confirmData.getAnyType();
// Now let's set an asymmetric proof of possession token in the context.
Certificate certificate = this.getCertificate("keystore/sts_keystore.jks", "testpass", "service1");
@@ -226,21 +231,19 @@
// check if the assertion has a subject confirmation that contains the encoded certificate.
assertion = SAMLUtil.fromElement((Element) context.getSecurityToken().getTokenValue());
- subject = assertion.getSubject();
- content = subject.getContent().get(0);
- assertEquals("Unexpected content type", NameIDType.class, content.getDeclaredType());
- nameID = (NameIDType) content.getValue();
+ subject = assertion.getSubject();
+ nameID = (NameIDType) subject.getSubType().getBaseID();
assertEquals("Unexpected name id qualifier", "urn:picketlink:identity-federation", nameID.getNameQualifier());
- assertEquals("Unexpected name id", "sguilhen", nameID.getValue());
- content = subject.getContent().get(1);
- assertEquals("Unexpected content type", SubjectConfirmationType.class, content.getDeclaredType());
- confirmation = (SubjectConfirmationType) content.getValue();
+ assertEquals("Unexpected name id", "sguilhen", nameID.getValue());
+ confirmation = (SubjectConfirmationType) subject.getConfirmation().get(0);
assertEquals("Unexpected confirmation method", SAMLUtil.SAML2_HOLDER_OF_KEY_URI, confirmation.getMethod());
- confirmationContent = confirmation.getSubjectConfirmationData().getContent();
+
+
+ /*confirmationContent = confirmation.getSubjectConfirmationData().getContent();
assertEquals("Unexpected subject confirmation content size", 1, confirmationContent.size());
keyInfoElement = (JAXBElement<?>) confirmationContent.get(0);
- assertEquals("Unexpected subject confirmation context type", KeyInfoType.class, keyInfoElement.getDeclaredType());
- keyInfo = (KeyInfoType) keyInfoElement.getValue();
+ assertEquals("Unexpected subject confirmation context type", KeyInfoType.class, keyInfoElement.getDeclaredType());*/
+ keyInfo = (KeyInfoType)confirmation.getSubjectConfirmationData().getAnyType();
assertEquals("Unexpected key info content size", 1, keyInfo.getContent().size());
// key info should contain a X509Data section with the encoded certificate.
@@ -253,7 +256,7 @@
assertEquals("Unexpected X509 data content type", byte[].class, x509CertElement.getDeclaredType());
// certificate should have been encoded to Base64, so we need to decode it first.
byte[] encodedCert = (byte[]) x509CertElement.getValue();
- assertTrue("Invalid encoded certificate found", Arrays.equals(certificate.getEncoded(), encodedCert));*/
+ assertTrue("Invalid encoded certificate found", Arrays.equals(certificate.getEncoded(), encodedCert));
}
/**
14 years
Picketlink SVN: r580 - in federation/trunk: picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml and 1 other directory.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-12-01 08:21:53 -0500 (Wed, 01 Dec 2010)
New Revision: 580
Modified:
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java
Log:
fixes
Modified: federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java
===================================================================
--- federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java 2010-12-01 01:20:01 UTC (rev 579)
+++ federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java 2010-12-01 13:21:53 UTC (rev 580)
@@ -4,8 +4,6 @@
import java.util.Map;
import java.util.Set;
-import javax.xml.bind.JAXBException;
-
import org.apache.log4j.Logger;
import org.jboss.security.identity.RoleGroup;
import org.jboss.security.identity.plugins.SimpleRole;
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java 2010-12-01 01:20:01 UTC (rev 579)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java 2010-12-01 13:21:53 UTC (rev 580)
@@ -32,7 +32,9 @@
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stax.StAXSource;
+import org.picketlink.identity.federation.core.exceptions.ConfigurationException;
import org.picketlink.identity.federation.core.exceptions.ParsingException;
+import org.picketlink.identity.federation.core.exceptions.ProcessingException;
import org.picketlink.identity.federation.core.parsers.ParserNamespaceSupport;
import org.picketlink.identity.federation.core.parsers.util.SAMLParserUtil;
import org.picketlink.identity.federation.core.parsers.util.StaxParserUtil;
@@ -43,6 +45,7 @@
import org.picketlink.identity.federation.core.util.TransformerUtil;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.*;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
/**
* Parse the saml assertion
@@ -53,6 +56,12 @@
{
private String ASSERTION = JBossSAMLConstants.ASSERTION.get();
+ public AssertionType fromElement( Element element ) throws ConfigurationException, ProcessingException, ParsingException
+ {
+ XMLEventReader xmlEventReader = StaxParserUtil.getXMLEventReader( DocumentUtil.getNodeAsStream(element));
+ return (AssertionType) parse(xmlEventReader);
+ }
+
/**
* @see {@link ParserNamespaceSupport#parse(XMLEventReader)}
*/
14 years
Picketlink SVN: r579 - federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-11-30 20:20:01 -0500 (Tue, 30 Nov 2010)
New Revision: 579
Modified:
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSPrincipalMappingProvider.java
Log:
fixes
Modified: federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java
===================================================================
--- federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java 2010-12-01 01:16:08 UTC (rev 578)
+++ federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java 2010-12-01 01:20:01 UTC (rev 579)
@@ -149,7 +149,7 @@
}
}
}
- catch (JAXBException e)
+ catch ( Exception e )
{
log.error("Failed to parse token", e);
}
Modified: federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSPrincipalMappingProvider.java
===================================================================
--- federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSPrincipalMappingProvider.java 2010-12-01 01:16:08 UTC (rev 578)
+++ federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSPrincipalMappingProvider.java 2010-12-01 01:20:01 UTC (rev 579)
@@ -3,8 +3,6 @@
import java.security.Principal;
import java.util.Map;
-import javax.xml.bind.JAXBException;
-
import org.apache.log4j.Logger;
import org.jboss.security.SimplePrincipal;
import org.jboss.security.mapping.MappingResult;
@@ -103,7 +101,7 @@
}*/
}
}
- catch (JAXBException e)
+ catch ( Exception e )
{
log.error("Failed to parse token", e);
}
14 years
Picketlink SVN: r578 - in federation/trunk/picketlink-fed-core/src: main/java/org/picketlink/identity/federation/core/saml/v2/factories and 2 other directories.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-11-30 20:16:08 -0500 (Tue, 30 Nov 2010)
New Revision: 578
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLAssertionFactory.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLAssertionWriter.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
Log:
fixes
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java 2010-12-01 00:48:57 UTC (rev 577)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java 2010-12-01 01:16:08 UTC (rev 578)
@@ -126,7 +126,24 @@
if( tag.equals( JBossSAMLConstants.SIGNATURE.get() ) )
{
- StaxParserUtil.bypassElementBlock(xmlEventReader, JBossSAMLConstants.SIGNATURE.get() );
+ Document resultDocument;
+ try
+ {
+ resultDocument = DocumentUtil.createDocument();
+ DOMResult domResult = new DOMResult( resultDocument );
+
+ //Let us parse <b><c><d> using transformer
+ StAXSource source = new StAXSource(xmlEventReader);
+
+ Transformer transformer = TransformerUtil.getStaxSourceToDomResultTransformer();
+ transformer.transform( source, domResult );
+ }
+ catch ( Exception e)
+ {
+ throw new RuntimeException( e );
+ }
+
+ assertion.setSignature( resultDocument.getDocumentElement() );
continue;
}
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLAssertionFactory.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLAssertionFactory.java 2010-12-01 00:48:57 UTC (rev 577)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLAssertionFactory.java 2010-12-01 01:16:08 UTC (rev 578)
@@ -167,6 +167,7 @@
SubjectType.STSubType subType = new SubjectType.STSubType();
subType.addConfirmation(confirmation);
subType.addBaseID(nameID);
+ subject.setSubType(subType);
}
return subject;
}
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLAssertionWriter.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLAssertionWriter.java 2010-12-01 00:48:57 UTC (rev 577)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/writers/SAMLAssertionWriter.java 2010-12-01 01:16:08 UTC (rev 578)
@@ -39,10 +39,12 @@
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
import org.picketlink.identity.federation.core.util.StaxUtil;
import org.picketlink.identity.federation.core.util.StringUtil;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AdviceType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeStatementType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeStatementType.ASTChoiceType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AudienceRestrictionType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AuthnContextClassRefType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AuthnContextDeclRefType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AuthnContextDeclType;
@@ -50,6 +52,8 @@
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AuthnContextType.AuthnContextTypeSequence;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AuthnStatementType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.BaseIDAbstractType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.ConditionAbstractType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.ConditionsType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.EncryptedElementType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.NameIDType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.StatementAbstractType;
@@ -98,8 +102,46 @@
write(subject);
}
- //TODO: conditions and advice
+ ConditionsType conditions = assertion.getConditions();
+ if( conditions != null )
+ {
+ StaxUtil.writeStartElement( writer, ASSERTION_PREFIX, JBossSAMLConstants.CONDITIONS.get() , ASSERTION_NSURI.get() );
+
+ StaxUtil.writeAttribute( writer, JBossSAMLConstants.NOT_BEFORE.get(), conditions.getNotBefore().toString() );
+ StaxUtil.writeAttribute( writer, JBossSAMLConstants.NOT_ON_OR_AFTER.get(), conditions.getNotOnOrAfter().toString() );
+
+ List<ConditionAbstractType> typeOfConditions = conditions.getConditions();
+ if( typeOfConditions != null )
+ {
+ for( ConditionAbstractType typeCondition: typeOfConditions )
+ {
+ if( typeCondition instanceof AudienceRestrictionType )
+ {
+ AudienceRestrictionType art = (AudienceRestrictionType) typeCondition;
+ StaxUtil.writeStartElement( writer, ASSERTION_PREFIX, JBossSAMLConstants.AUDIENCE_RESTRICTION.get() , ASSERTION_NSURI.get() );
+ List<URI> audiences = art.getAudience();
+ if( audiences != null )
+ {
+ for( URI audience: audiences )
+ {
+ StaxUtil.writeStartElement( writer, ASSERTION_PREFIX, JBossSAMLConstants.AUDIENCE.get() , ASSERTION_NSURI.get() );
+ StaxUtil.writeCharacters(writer, audience.toString() );
+ StaxUtil.writeEndElement( writer);
+ }
+ }
+
+ StaxUtil.writeEndElement( writer);
+ }
+ }
+ }
+
+ StaxUtil.writeEndElement( writer);
+ }
+ AdviceType advice = assertion.getAdvice();
+ if( advice != null )
+ throw new RuntimeException( "Advice needs to be handled" );
+
Set<StatementAbstractType> statements = assertion.getStatements();
if( statements != null )
{
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2010-12-01 00:48:57 UTC (rev 577)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2010-12-01 01:16:08 UTC (rev 578)
@@ -371,7 +371,7 @@
AudienceRestrictionType audienceRestriction = (AudienceRestrictionType) abstractType;
assertEquals("Unexpected audience restriction list size", 1, audienceRestriction.getAudience().size());
assertEquals("Unexpected audience restriction item", "http://services.testcorp.org/provider2",
- audienceRestriction.getAudience().get(0));
+ audienceRestriction.getAudience().get(0).toString());
}
/**
@@ -432,7 +432,7 @@
AssertionType assertion = this.validateSAMLAssertionResponse(baseResponse, "testcontext", "jduke",
SAMLUtil.SAML2_HOLDER_OF_KEY_URI);
// validate the holder of key contents.
- SubjectConfirmationType subjConfirmation = (SubjectConfirmationType) assertion.getSubject().getConfirmation().get(1);
+ SubjectConfirmationType subjConfirmation = (SubjectConfirmationType) assertion.getSubject().getConfirmation().get(0);
this.validateHolderOfKeyContents(subjConfirmation, WSTrustConstants.KEY_TYPE_SYMMETRIC, null, false);
// check if the response contains the STS-generated key.
@@ -1173,7 +1173,7 @@
assertEquals("Unexpected name id qualifier", "urn:picketlink:identity-federation", nameID.getNameQualifier());
assertEquals("Unexpected name id value", principal, nameID.getValue());
- SubjectConfirmationType subjType = (SubjectConfirmationType) subject.getConfirmation().get(1);
+ SubjectConfirmationType subjType = (SubjectConfirmationType) subject.getConfirmation().get(0);
assertEquals("Unexpected confirmation method", confirmationMethod, subjType.getMethod());
// validate the assertion conditions.
14 years
Picketlink SVN: r577 - in federation/trunk/picketlink-fed-core/src: main/java/org/picketlink/identity/federation/core/saml/v2/factories and 2 other directories.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-11-30 19:48:57 -0500 (Tue, 30 Nov 2010)
New Revision: 577
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenResponseParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLAssertionFactory.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAMLUtil.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
Log:
updates
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenResponseParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenResponseParser.java 2010-12-01 00:33:28 UTC (rev 576)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenResponseParser.java 2010-12-01 00:48:57 UTC (rev 577)
@@ -215,6 +215,8 @@
entropy.getAny().add(binarySecret);
}
responseToken.setEntropy(entropy);
+ EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
+ StaxParserUtil.validate(endElement, WSTrustConstants.ENTROPY );
}
else if (tag.equals(WSTrustConstants.USE_KEY))
{
@@ -272,6 +274,8 @@
requestedProofToken.setAny(computedKey);
}
responseToken.setRequestedProofToken(requestedProofToken);
+ EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
+ StaxParserUtil.validate(endElement, WSTrustConstants.REQUESTED_PROOF_TOKEN );
}
else if (tag.equals(WSTrustConstants.REQUESTED_TOKEN))
{
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLAssertionFactory.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLAssertionFactory.java 2010-12-01 00:33:28 UTC (rev 576)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/factories/SAMLAssertionFactory.java 2010-12-01 00:48:57 UTC (rev 577)
@@ -80,7 +80,8 @@
public static NameIDType createNameID(String format, String qualifier, String value)
{
NameIDType nameID = new NameIDType();
- nameID.setFormat( NetworkUtil.createURI( format ));
+ if( format != null )
+ nameID.setFormat( NetworkUtil.createURI( format ));
nameID.setNameQualifier(qualifier);
nameID.setValue(value);
return nameID;
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2010-12-01 00:33:28 UTC (rev 576)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2010-12-01 00:48:57 UTC (rev 577)
@@ -24,7 +24,6 @@
import java.util.List;
import java.util.Map;
-import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import org.apache.log4j.Logger;
@@ -43,7 +42,7 @@
import org.picketlink.identity.federation.core.wstrust.plugins.FileBasedRevocationRegistry;
import org.picketlink.identity.federation.core.wstrust.plugins.JPABasedRevocationRegistry;
import org.picketlink.identity.federation.core.wstrust.plugins.RevocationRegistry;
-import org.picketlink.identity.federation.core.wstrust.wrappers.Lifetime;
+import org.picketlink.identity.federation.core.wstrust.wrappers.Lifetime;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AttributeStatementType;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AudienceRestrictionType;
@@ -312,7 +311,7 @@
{
oldAssertion = SAMLUtil.fromElement(oldAssertionElement);
}
- catch (JAXBException je)
+ catch ( Exception je )
{
throw new WSTrustException("Error unmarshalling assertion", je);
}
@@ -392,7 +391,7 @@
{
assertion = SAMLUtil.fromElement(assertionElement);
}
- catch (JAXBException e)
+ catch ( Exception e )
{
throw new WSTrustException("Unmarshalling error:", e);
}
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAMLUtil.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAMLUtil.java 2010-12-01 00:33:28 UTC (rev 576)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAMLUtil.java 2010-12-01 00:48:57 UTC (rev 577)
@@ -24,13 +24,15 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
+import org.picketlink.identity.federation.core.exceptions.ConfigurationException;
+import org.picketlink.identity.federation.core.exceptions.ParsingException;
+import org.picketlink.identity.federation.core.exceptions.ProcessingException;
+import org.picketlink.identity.federation.core.parsers.saml.SAMLAssertionParser;
+import org.picketlink.identity.federation.core.parsers.util.StaxParserUtil;
import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.saml.v2.writers.SAMLAssertionWriter;
-import org.picketlink.identity.federation.core.util.JAXBUtil;
import org.picketlink.identity.federation.core.util.StaxUtil;
import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
import org.w3c.dom.Document;
@@ -99,10 +101,19 @@
* the {@code Element} that contains the marshaled SAMLV2.0 assertion.
* @return a reference to the unmarshaled {@code AssertionType} instance.
* @throws JAXBException if an error occurs while unmarshalling the document.
+ * @throws ConfigurationException
+ * @throws ProcessingException
+ * @throws ParsingException
*/
- public static AssertionType fromElement(Element assertionElement) throws JAXBException
+ public static AssertionType fromElement(Element assertionElement) throws JAXBException, ProcessingException, ConfigurationException, ParsingException
{
- Unmarshaller unmarshaller = JAXBUtil.getUnmarshaller("org.picketlink.identity.federation.saml.v2.assertion");
+ String assertionAsString = DocumentUtil.getDOMElementAsString(assertionElement);
+
+ SAMLAssertionParser assertionParser = new SAMLAssertionParser();
+ return (AssertionType) assertionParser.parse( StaxParserUtil.getXMLEventReader( new ByteArrayInputStream( assertionAsString.getBytes() )));
+
+
+ /*Unmarshaller unmarshaller = JAXBUtil.getUnmarshaller("org.picketlink.identity.federation.saml.v2.assertion");
Object object = unmarshaller.unmarshal(assertionElement);
if (object instanceof AssertionType)
return (AssertionType) object;
@@ -112,6 +123,6 @@
if (element.getDeclaredType().equals(AssertionType.class))
return (AssertionType) element.getValue();
}
- throw new IllegalArgumentException("Supplied document does not contain a SAMLV2.0 Assertion");
+ throw new IllegalArgumentException("Supplied document does not contain a SAMLV2.0 Assertion");*/
}
}
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2010-12-01 00:33:28 UTC (rev 576)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2010-12-01 00:48:57 UTC (rev 577)
@@ -305,8 +305,9 @@
// invoke the token service.
Source responseMessage = this.tokenService.invoke(requestMessage);
+ InputStream is = DocumentUtil.getSourceAsStream(responseMessage);
BaseRequestSecurityTokenResponse baseResponse = (BaseRequestSecurityTokenResponse) new WSTrustParser()
- .parse(DocumentUtil.getSourceAsStream(responseMessage));
+ .parse( is );
// validate the security token response.
this.validateSAMLAssertionResponse(baseResponse, "testcontext", "jduke", SAMLUtil.SAML2_BEARER_URI);
}
@@ -1152,6 +1153,7 @@
// unmarshall the SAMLV2.0 assertion.
Element assertionElement = (Element) requestedToken.getAny();
+ System.out.println( DocumentUtil.getNodeAsString(assertionElement));
AssertionType assertion = SAMLUtil.fromElement(assertionElement);
// verify the contents of the unmarshalled assertion.
14 years
Picketlink SVN: r576 - in federation/trunk/picketlink-fed-core/src: test/java/org/picketlink/test/identity/federation/core/parser/wst and 1 other directory.
by picketlink-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2010-11-30 19:33:28 -0500 (Tue, 30 Nov 2010)
New Revision: 576
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTCancelTargetParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRenewTargetParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTValidateTargetParser.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTResponseAssertionHOKCertificateTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustCancelTargetSamlTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssueAppliesToTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicCertificateTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicKeyTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssueSymmetricKeyTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustRenewTargetParsingTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustValidateSamlTestCase.java
Log:
test fixes
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTCancelTargetParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTCancelTargetParser.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTCancelTargetParser.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -35,7 +35,7 @@
import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.util.TransformerUtil;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
import org.picketlink.identity.federation.ws.trust.CancelTargetType;
import org.w3c.dom.Document;
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRenewTargetParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRenewTargetParser.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRenewTargetParser.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -31,7 +31,7 @@
import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.util.TransformerUtil;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
import org.picketlink.identity.federation.ws.trust.RenewTargetType;
import org.w3c.dom.Document;
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -206,6 +206,8 @@
entropy.getAny().add( binarySecret );
}
requestToken.setEntropy(entropy);
+ EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
+ StaxParserUtil.validate(endElement, WSTrustConstants.ENTROPY );
}
else if( tag.equals( WSTrustConstants.USE_KEY ))
{
@@ -229,8 +231,11 @@
Element domElement = StaxParserUtil.getDOMElement(xmlEventReader);//
useKeyType.setAny( domElement );
requestToken.setUseKey( useKeyType );
+
+ EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
+ StaxParserUtil.validate(endElement, WSTrustConstants.USE_KEY );
}
- else throw new RuntimeException( "unsupported " + StaxParserUtil.getStartElementName( subEvent ));
+ else throw new RuntimeException( "unsupported " + StaxParserUtil.getStartElementName( subEvent ));
}
else
{
Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTValidateTargetParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTValidateTargetParser.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTValidateTargetParser.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -35,7 +35,7 @@
import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.util.TransformerUtil;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
import org.picketlink.identity.federation.ws.trust.ValidateTargetType;
import org.w3c.dom.Document;
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTResponseAssertionHOKCertificateTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTResponseAssertionHOKCertificateTestCase.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTResponseAssertionHOKCertificateTestCase.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -33,10 +33,8 @@
import org.picketlink.identity.federation.core.parsers.wst.WSTrustParser;
import org.picketlink.identity.federation.core.saml.v2.util.XMLTimeUtil;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
-import org.picketlink.identity.federation.core.wstrust.plugins.saml.SAMLUtil;
import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityTokenResponse;
-import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityTokenResponseCollection;
-import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
+import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityTokenResponseCollection;
import org.picketlink.identity.federation.ws.addressing.EndpointReferenceType;
import org.picketlink.identity.federation.ws.trust.RequestedReferenceType;
import org.picketlink.identity.federation.ws.wss.secext.KeyIdentifierType;
@@ -49,8 +47,6 @@
*/
public class WSTResponseAssertionHOKCertificateTestCase
{
-
- @SuppressWarnings("rawtypes")
@Test
public void testWST_RSTR_Assertion() throws Exception
{
@@ -76,8 +72,9 @@
assertEquals( WSTrustConstants.KEY_TYPE_PUBLIC, rstr.getKeyType().toASCIIString() );
Element assertionElement = (Element) rstr.getRequestedSecurityToken().getAny();
- AssertionType assertion = SAMLUtil.fromElement(assertionElement);
- assertEquals( "ID_5a15fc70-daa1-4808-b70e-9cbf6b8e4d4f", assertion.getID() );
+ String id = assertionElement.getAttribute("ID" );
+
+ assertEquals( "ID_5a15fc70-daa1-4808-b70e-9cbf6b8e4d4f", id );
RequestedReferenceType ref = rstr.getRequestedAttachedReference();
SecurityTokenReferenceType secRef = ref.getSecurityTokenReference();
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustCancelTargetSamlTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustCancelTargetSamlTestCase.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustCancelTargetSamlTestCase.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -27,9 +27,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
-import java.util.List;
-import javax.xml.bind.JAXBElement;
import javax.xml.datatype.DatatypeFactory;
import org.junit.Test;
@@ -39,11 +37,11 @@
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
import org.picketlink.identity.federation.core.wstrust.writers.WSTrustRequestWriter;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
-import org.picketlink.identity.federation.saml.v2.assertion.ConditionsType;
-import org.picketlink.identity.federation.saml.v2.assertion.NameIDType;
-import org.picketlink.identity.federation.saml.v2.assertion.SubjectConfirmationType;
-import org.picketlink.identity.federation.saml.v2.assertion.SubjectType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.ConditionsType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.NameIDType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.SubjectConfirmationType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.SubjectType;
import org.picketlink.identity.federation.ws.trust.CancelTargetType;
/**
@@ -92,8 +90,17 @@
//Subject
SubjectType subject = assertion.getSubject();
- List<JAXBElement<?>> content = subject.getContent();
+ NameIDType subjectNameID = (NameIDType) subject.getSubType().getBaseID();
+
+ assertEquals( "jduke", subjectNameID.getValue() );
+ assertEquals( "urn:picketlink:identity-federation", subjectNameID.getNameQualifier() );
+
+ SubjectConfirmationType subjectConfirmationType = subject.getConfirmation().get(0);
+ assertEquals( JBossSAMLURIConstants.BEARER.get(), subjectConfirmationType.getMethod() );
+
+ /*List<JAXBElement<?>> content = subject.getContent();
+
int size = content.size();
assertEquals( 2, size );
@@ -114,7 +121,7 @@
SubjectConfirmationType subjectConfirmationType = (SubjectConfirmationType) node.getValue();
assertEquals( JBossSAMLURIConstants.BEARER.get(), subjectConfirmationType.getMethod() );
}
- }
+ } */
//Conditions
ConditionsType conditions = assertion.getConditions();
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssueAppliesToTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssueAppliesToTestCase.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssueAppliesToTestCase.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -25,8 +25,6 @@
import java.io.InputStream;
-import javax.xml.bind.JAXBElement;
-
import org.junit.Test;
import org.picketlink.identity.federation.core.parsers.wst.WSTrustParser;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
@@ -40,8 +38,7 @@
* @since Oct 14, 2010
*/
public class WSTrustIssueAppliesToTestCase
-{
- @SuppressWarnings("unchecked")
+{
@Test
public void testAppliesTo() throws Exception
{
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicCertificateTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicCertificateTestCase.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicCertificateTestCase.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -46,8 +46,6 @@
*/
public class WSTrustIssuePublicCertificateTestCase
{
-
- @SuppressWarnings("unchecked")
@Test
public void testPublicCert() throws Exception
{
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicKeyTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicKeyTestCase.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicKeyTestCase.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -43,8 +43,6 @@
*/
public class WSTrustIssuePublicKeyTestCase
{
-
- @SuppressWarnings("unchecked")
@Test
public void testPublicKey() throws Exception
{
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssueSymmetricKeyTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssueSymmetricKeyTestCase.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssueSymmetricKeyTestCase.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -44,8 +44,7 @@
* @since Oct 18, 2010
*/
public class WSTrustIssueSymmetricKeyTestCase
-{
- @SuppressWarnings("unchecked")
+{
@Test
public void testSymKey() throws Exception
{
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustRenewTargetParsingTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustRenewTargetParsingTestCase.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustRenewTargetParsingTestCase.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -25,15 +25,13 @@
import java.io.InputStream;
-import javax.xml.bind.JAXBElement;
-
import org.junit.Test;
import org.picketlink.identity.federation.core.parsers.wst.WSTrustParser;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
-import org.picketlink.identity.federation.saml.v2.assertion.NameIDType;
-import org.picketlink.identity.federation.saml.v2.assertion.SubjectType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.NameIDType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.SubjectType;
import org.picketlink.identity.federation.ws.trust.RenewTargetType;
/**
@@ -60,10 +58,6 @@
assertEquals( "ID_654b6092-c725-40ea-8044-de453b59cb28", assertion.getID() );
assertEquals( "Test STS", assertion.getIssuer().getValue() );
SubjectType subject = assertion.getSubject();
-
- @SuppressWarnings("unchecked")
- JAXBElement<NameIDType> nameID = (JAXBElement<NameIDType>) subject.getContent().get(0);
- assertEquals( "jduke", nameID.getValue().getValue());
-
+ assertEquals( "jduke", ((NameIDType)subject.getSubType().getBaseID()).getValue());
}
}
\ No newline at end of file
Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustValidateSamlTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustValidateSamlTestCase.java 2010-11-30 22:48:15 UTC (rev 575)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustValidateSamlTestCase.java 2010-12-01 00:33:28 UTC (rev 576)
@@ -29,7 +29,7 @@
import org.picketlink.identity.federation.core.parsers.wst.WSTrustParser;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
+import org.picketlink.identity.federation.newmodel.saml.v2.assertion.AssertionType;
import org.picketlink.identity.federation.ws.trust.ValidateTargetType;
/**
14 years