Skip to Content.
Sympa Menu

mace-opensaml-users - Failed to add <ds:keyinfo> element into the subjectConfirmationData object

Subject: OpenSAML user discussion

List archive

Failed to add <ds:keyinfo> element into the subjectConfirmationData object


Chronological Thread 
  • From: Thilina Mahesh Buddhika <>
  • To:
  • Subject: Failed to add <ds:keyinfo> element into the subjectConfirmationData object
  • Date: Thu, 9 Jul 2009 22:47:52 +0530
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=CD9nm3GSRpRFIGIt9fsKwQ80IkH85+epI1EisXDCjhrQtay9CTbf02nTLYgoL66zCG V5o2Z618wwfaYBUM8pa1K02/HJnIwyevQe3cAjMYT6R14f3R5Al64DI00nPR/PpE7FIF /P9zilGDq5IYxajCAoTR83gtphSSJPC8OhTjc=

hi,

I am trying to build a SAML 2.0 assertion with holder-of-key subject confirmation method. I have created a <ds:keyInfo> element and unmarshelled it to an instance of org.opensaml.xml.XMLObject. Then I am trying to add this object to a subjectConfirmationData object using the following code segment.

-------------------------------------------------------------------------------------------------------------------------------------------------------------
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(keyInfoElem);

XMLObject keyInfoElement = nmarshaller.unmarshall(keyInfoElem);

SAMLObjectBuilder<SubjectConfirmationData> subjectConfirmationDataBuilder =
                (SAMLObjectBuilder<SubjectConfirmationData>) builderFactory.getBuilder(SubjectConfirmationData.DEFAULT_ELEMENT_NAME);
SubjectConfirmationData subjectConfirmationData = subjectConfirmationDataBuilder.buildObject();
subjectConfirmationData.setNotBefore(creationTime);
subjectConfirmationData.setNotOnOrAfter(expirationTime);

//Add the Element that containts X509 certificate into the SubjectCOnfirmationData element
subjectConfirmationData.getOrderedChildren().add(keyInfoElement);
 
----------------------------------------------------------------------------------------------------------------------------------------------------------------
when I am trying to add the keyinfo element to the subjectConfirmationData object, I am hitting with this error.

-------------------------------------------------------------------------
java.lang.UnsupportedOperationException
    at java.util.Collections$UnmodifiableCollection.add(Collections.java:1018)
    at org.apache.rahas.impl.SAML2TokenIssuer.createSubject(SAML2TokenIssuer.java:408)
    at org.apache.rahas.impl.SAML2TokenIssuer.issue(SAML2TokenIssuer.java:154)
    at org.apache.rahas.TokenRequestDispatcher.handle(TokenRequestDispatcher.java:70)

-------------------------------------------------------------------------------------------------------------------------------------------------
I debugged the method implementation of geOrderedChildren in org.opensaml.saml2.core.impl.SubjectConfirmationDataImpl class, and found that it provides a non-editable collection object.

    public List<XMLObject> getOrderedChildren() {
        return Collections.unmodifiableList(unknownChildren);
    }

So the above exception makes sense.

What is the correct approach to add XMLObjects into SAMLConfirmationData object ? Am I missing anything ?

Thanks in advance.

best regards,
/thilina



E-Mail         :
I blog here : http://thilinamb.com



Archive powered by MHonArc 2.6.16.

Top of Page