Jump to content

Recommended Posts

I am trying to add a xmlns namespace attribute to an Assertion tag inside before signing it but i can't figure out why it wont add.

Php Code: http://snipt.org/zfEf3[1]

Full Output: http://snipt.org/zfEg2[2]

The part in question is adding xmlns="urn:oasis:names:tc:SAML:1.0:assertion" to the tag below

<Assertion IssueInstant="2013-02-21T05:02:46Z" Issuer="urn:client:comsec:1.0" MajorVersion="1" MinorVersion="1" AssertionID="_56319a08ed26ab103077"> 

needs to be

<Assertion xmlns="urn:oasis:names:tc:SAML:1.0:assertion" IssueInstant="2013-02-21T05:02:46Z" Issuer="urn:client:comsec:1.0" MajorVersion="1" MinorVersion="1" AssertionID="_56319a08ed26ab103077">

but whatever I do it wont add the xmlns tag in there. here is the section of php that pertains to it.

$assertion = $xml->createElementNS('urn:oasis:names:tc:SAML:1.0:protocol', 'Assertion');
$assertion->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:saml', 'urn:oasis:names:tc:SAML:1.0:assertion');
$assertion->setAttribute('IssueInstant', gmdate('Y-m-d\\TH:i:s\\Z', $now));
$assertion->setAttribute('Issuer', 'urn:client:comsec:1.0');
$assertion->setAttribute('MajorVersion', '1');
$assertion->setAttribute('MinorVersion', '1');
$resp->appendChild($assertion);

I have tried changeing the

 $assertion = $xml->createElementNS('urn:oasis:names:tc:SAML:1.0:protocol', 'Assertion');

to

 $assertion = $xml->createElementNS('urn:oasis:names:tc:SAML:1.0:assertion', 'Assertion');

but that doesn't add it. It changes the main tag from <Assertion .... /> to <saml:Assertion ..../>.

Any help would be wonderful.

Edited by slimm609
Link to comment
https://forums.phpfreaks.com/topic/274758-help-with-xml-doms/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.