Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] Need XMLObject in assertion, I believe

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] Need XMLObject in assertion, I believe


Chronological Thread 
  • From: "Jason Countryman" <>
  • To:
  • Subject: Re: [OpenSAML] Need XMLObject in assertion, I believe
  • Date: Wed, 21 Apr 2010 16:38:29 -0400

You're right.  All I'm looking to do is a quick and dirty way of plugging that in.  This is what I have currently, but it's producing some strange output:

SAMLObjectBuilder<Attribute> attributeBuilder111 = (SAMLObjectBuilder<Attribute>) builderFactory.getBuilder(Attribute.DEFAULT_ELEMENT_NAME);
Attribute userRoleAttribute = attributeBuilder111.buildObject();
userRoleAttribute.setName("UserRole");
userRoleAttribute.setNameFormat("http://www.hhs.gov/healthit/nhin");                     
XSStringBuilder stringBuilder111 = (XSStringBuilder) Configuration.getBuilderFactory().getBuilder(XSString.TYPE_NAME);
XSString userRoleValue = stringBuilder111.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,XSString.TYPE_NAME);
userRoleValue.setValue("<nhin:Role xmlns:nhin=\"http://www.hhs.gov/healthit/nhin\" code=\"112247003\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Medical doctor\" />");                     
                     
userRoleAttribute.getAttributeValues().add(userRoleValue);



But the output it's creating has some weird extra chars:

<saml2:Attribute Name="UserRole" NameFormat="http://www.hhs.gov/healthit/nhin">
   <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">&lt;nhin:Role xmlns:nhin="http://www.hhs.gov/healthit/nhin" code="112247003" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical doctor" /></saml2:AttributeValue>
<saml2:Attribute>

Where what I'm looking for is this:

<saml2:Attribute Name="UserRole" NameFormat="http://www.hhs.gov/healthit/nhin">
   <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
       <nhin:Role xmlns:nhin="http://www.hhs.gov/healthit/nhin" code="112247003" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical doctor" />
   </saml2:AttributeValue>
<saml2:Attribute>

And I'm hoping to do it quick and dirty...not terribly complicated.


______________________________
Jason T. Countryman
Programmer
Community Computer Service


---------- Original Message -----------
From: Brent Putman <>
To: mace-opensaml-users <>
Sent: Wed, 21 Apr 2010 15:50:32 -0400
Subject: Re: [OpenSAML] Need XMLObject in assertion, I believe

> On 4/21/2010 3:10 PM, Jason Countryman wrote:

> I need to create the following element to put into an Attribute element:

>
> <nhin:Role xmlns:nhin=\"http://www.hhs.gov/healthit/nhin\" code=\"112247003\" codeSystem=\"2.16.840.1.113883.6.96\" codeSystemName=\"SNOMED CT\" displayName=\"Medical doctor\" />

>
> I think you probably mean inside an AttributeValue element, inside an Attribute element, right?  As in:
>
> <saml:Attribute>
>   <saml:AttributeValue>
>     <nhin:Role ..... />
>   </saml:AttributeValue>
> </saml:Attribute
>
>

>
> How would I go about creating this?  I'm assuming this would use an XMLObject and the XMLObjectBuilder, but I'm not sure.

>
> Yes, more or less.
>
> See this post:
>
> https://mail.internet2.edu/wws/arc/mace-opensaml-users/2009-11/msg00017.html
>
> The correct way (#1 there) is to implement an XML object provider and supporting clases (builder, marshaller, unmarshaller) for your nhin:Role element.  It's not that hard, but you'll need to consult the user's guide docs mentioned there.  Looking at some of the existing SAML and other XML object provider examples would probably also be helpful.
>
> You can consider taking the XSAny shortcut (#2), esp. if you primarily just need to generate this using OpenSAML and not consume.
>
> HTH,
> Brent
------- End of Original Message -------
This message has been scanned for viruses and dangerous content by MailScanner, SpamAssassin & ClamAV.

This message and any attachments may contain information that is protected by law as privileged and confidential, and
is transmitted for the sole use of the intended recipient(s). If you are not the intended recipient, you are hereby notified
that any use, dissemination, copying or retention of this e-mail or the information contained herein is strictly prohibited.
If you received this e-mail in error, please immediately notify the sender by e-mail, and permanently delete this e-mail.



Archive powered by MHonArc 2.6.16.

Top of Page