Subject: OpenSAML user discussion
List archive
- From: "Bryn Ryans" <>
- To: <>
- Subject: RE: [OpenSAML] Failed to add <ds:keyinfo> element into the subjectConfirmationData object
- Date: Thu, 9 Jul 2009 13:43:34 -0400
subjData.getUnknownXMLObjects().add(keyInfoElement);
From: Thilina Mahesh
Buddhika [mailto:]
Sent: Thursday, July 09, 2009
10:18 AM
To:
Subject: [OpenSAML] Failed to add
<ds:keyinfo> element into the subjectConfirmationData object
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
DISCLAIMER: This email message and all attachments transmitted
with it are for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Please DO NOT
forward this email outside of the recipient's Company unless
expressly authorized to do so herein. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.Any views expressed in this email
message are those of the individual sender except where the sender
specifically states them to be the views of Ventyx.
|
Archive powered by MHonArc 2.6.16.