Last active
April 12, 2018 13:33
-
-
Save canariecaf/d12d26c1ceed02d87f86ddc30b5c31b8 to your computer and use it in GitHub Desktop.
Scrub ADFS Metadata to simple SAML2 metadata
This file contains hidden or 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
| <?xml version="1.0"?> | |
| <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:ds="http://www.w3.org/2000/09/xmldsig#" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" | |
| xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" | |
| xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui" | |
| xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706"> | |
| <xsl:output method="xml" indent="yes"/> | |
| <xsl:strip-space elements="*" /> | |
| <xsl:template match="node() | @*"> | |
| <xsl:copy> | |
| <xsl:apply-templates select="node() | @*"/> | |
| </xsl:copy> | |
| </xsl:template> | |
| <xsl:template match="ds:Signature"/> | |
| <xsl:template match="md:RoleDescriptor"/> | |
| <xsl:template match="md:SPSSODescriptor"/> | |
| <xsl:template match="saml:Attribute"/> | |
| </xsl:stylesheet> |
This file contains hidden or 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
| #!/bin/bash | |
| #Script to get metadata from ADFS server, clean it up and reduce it to include only what's needed | |
| #to import into fedmanager | |
| #Script takes one parameter which is the URL to the metadata on the ADFS server | |
| if [ $# -ne 1 ] | |
| then | |
| echo "Usage $0 URL_to_ADFS_metadata" | |
| exit -99 | |
| fi | |
| ADFS_URL=$1 | |
| wget -q -O /tmp/ADFS_MD.$$.xml ${ADFS_URL} | |
| if [ $? -ne 0 ] | |
| then | |
| echo "Getting metadata from ${ADFS_URL} failed." | |
| exit -98 | |
| fi | |
| xmllint --format /tmp/ADFS_MD.$$.xml > /tmp/ADFS_MD_pretty.$$.xml | |
| xsltproc adfs2md.xsl /tmp/ADFS_MD_pretty.$$.xml | |
| #Clean up temporary files | |
| #rm -f /tmp.ADFS*$$* | |
This file contains hidden or 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
| Put the two files in a directory and use like: | |
| ./getMD.sh https://adfs.institution.ca/FederationMetadata/2007-06/FederationMetadata.xml | |
| then copy/paste metadata to your tool of choice or redirect output to file. | |
| With the above the scope needs to be added manually in FedMgr _before_ creating the IdP. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment