Created
September 4, 2012 23:36
-
-
Save jm2dev/3628084 to your computer and use it in GitHub Desktop.
Extract EntityDescriptor from Shibboleth bulk metadata file and remove Extensions nodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare namespace html = "http://www.w3.org/1999/xhtml"; | |
declare namespace a = "urn:oasis:names:tc:SAML:2.0:metadata"; | |
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" | |
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" | |
xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" | |
xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui" | |
xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
Name="urn:mace:switch.ch:SWITCHaai" | |
validUntil="2012-09-09T19:59:01Z" | |
xsi:schemaLocation="urn:oasis:names:tc:SAML:2.0:metadata saml-schema-metadata-2.0.xsd urn:mace:shibboleth:metadata:1.0 shibboleth-metadata-1.0.xsd urn:oasis:names:tc:SAML:metadata:ui saml-metadata-ui-1.0.xsd http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd"> | |
{ | |
let $id := "https://aai-login.fh-htwchur.ch/idp/shibboleth" | |
for $entity in doc()/a:EntitiesDescriptor/a:EntityDescriptor[@entityID = $id] | |
let $entityId := $entity/@entityID | |
let $idpssoDescriptor := $entity/IDPSSODescriptor/(@*, * except Extensions) | |
let $attributeAuthorityDescriptor := $entity/AttributeAuthorityDescriptor/(@*, * except Extensions) | |
return ($entityId, <IDPSSODescriptor>{$idpssoDescriptor}</IDPSSODescriptor>, <AttributeAuthorityDescriptor>{$attributeAuthorityDescriptor}</AttributeAuthorityDescriptor>) | |
}</EntityDescriptor> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$id should be an input parameter, like the classical bash $1