-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add XSL stylesheet that summarizes security contacts
- Loading branch information
Tom Scavo
committed
Jan 10, 2017
1 parent
4105dad
commit e78a1ea
Showing
1 changed file
with
113 additions
and
0 deletions.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| Copyright 2017 Internet2 | ||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
| <!-- | ||
| security_contacts_summary_json.xsl | ||
| This XSL transform takes a SAML metadata aggregate and produces | ||
| a JSON file that summarizes the security contacts in metadata. | ||
| --> | ||
| <xsl:stylesheet version="1.0" | ||
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" | ||
| xmlns:remd="http://refeds.org/metadata" | ||
| xmlns:icmd="http://id.incommon.org/metadata"> | ||
|
|
||
| <!-- Output is plain text --> | ||
| <xsl:output method="text"/> | ||
|
|
||
| <xsl:template match="/"> | ||
|
|
||
| <!-- count the # of entities that contain at least one REFEDS security contact --> | ||
| <xsl:variable name="numEntitiesStandardSecurityContact" select=" | ||
| count( | ||
| /md:EntitiesDescriptor/md:EntityDescriptor[ | ||
| md:ContactPerson[ | ||
| @contactType = 'other' | ||
| and | ||
| @remd:contactType = 'http://refeds.org/metadata/contactType/security' | ||
| ] | ||
| ] | ||
| ) | ||
| "/> | ||
|
|
||
| <!-- count the # of entities that contain at least one InCommon security contact --> | ||
| <xsl:variable name="numEntitiesLegacySecurityContact" select=" | ||
| count( | ||
| /md:EntitiesDescriptor/md:EntityDescriptor[ | ||
| md:ContactPerson[ | ||
| @contactType = 'other' | ||
| and | ||
| @icmd:contactType = 'http://id.incommon.org/metadata/contactType/security' | ||
| ] | ||
| ] | ||
| ) | ||
| "/> | ||
|
|
||
| <!-- count the # of entities with at least one security contact (of any type) --> | ||
| <xsl:variable name="totalNumEntitiesSecurityContact" select=" | ||
| count( | ||
| /md:EntitiesDescriptor/md:EntityDescriptor[ | ||
| md:ContactPerson[ | ||
| @contactType = 'other' | ||
| and ( | ||
| @remd:contactType = 'http://refeds.org/metadata/contactType/security' | ||
| or | ||
| @icmd:contactType = 'http://id.incommon.org/metadata/contactType/security' | ||
| ) | ||
| ] | ||
| ] | ||
| ) | ||
| "/> | ||
|
|
||
| <xsl:text>[ </xsl:text> | ||
|
|
||
| <xsl:text> { </xsl:text> | ||
| <xsl:text> "heading": "Entities with standard security contact", </xsl:text> | ||
| <xsl:text> "value": </xsl:text> | ||
| <xsl:value-of select="$numEntitiesStandardSecurityContact"/> | ||
| <xsl:text> </xsl:text> | ||
| <xsl:text> </xsl:text> | ||
| <xsl:text> } </xsl:text> | ||
|
|
||
| <xsl:text> , </xsl:text> | ||
|
|
||
| <xsl:text> { </xsl:text> | ||
| <xsl:text> "heading": "Entities with legacy security contact", </xsl:text> | ||
| <xsl:text> "value": </xsl:text> | ||
| <xsl:value-of select="$numEntitiesLegacySecurityContact"/> | ||
| <xsl:text> </xsl:text> | ||
| <xsl:text> </xsl:text> | ||
| <xsl:text> } </xsl:text> | ||
|
|
||
| <xsl:text> , </xsl:text> | ||
|
|
||
| <xsl:text> { </xsl:text> | ||
| <xsl:text> "heading": "Total entities with security contact", </xsl:text> | ||
| <xsl:text> "value": </xsl:text> | ||
| <xsl:value-of select="$totalNumEntitiesSecurityContact"/> | ||
| <xsl:text> </xsl:text> | ||
| <xsl:text> </xsl:text> | ||
| <xsl:text> } </xsl:text> | ||
|
|
||
| <xsl:text>] </xsl:text> | ||
|
|
||
| </xsl:template> | ||
|
|
||
| <xsl:template match="text()"> | ||
| <!-- do nothing --> | ||
| </xsl:template> | ||
| </xsl:stylesheet> |