diff --git a/build/query-entities.pl b/build/query-entities.pl index 799842dd..e54f85f6 100755 --- a/build/query-entities.pl +++ b/build/query-entities.pl @@ -14,13 +14,15 @@ sub help { print<<'EOF'; -usage: query-entities.pl [--help] [--head] [--idp] [--sp] [--reg ] [--notreg ] +usage: query-entities.pl [--help] [--head] [--entityID] [--idp] [--sp] [--reg ] [--notreg ] Outputs the entityID, display name(s) and other information about entities in the given SAML metadata aggregate file. --help - prints this help and exits --head - prints out a header for the CSV file +--entityID - outputs a list of entityIDs only + (can only have one of --head and --entityID specified) --idp - only outputs IdPs --sp - only outputs SPs @@ -28,7 +30,7 @@ sub help { --reg - outputs entities registered by registrationAuthority --notreg - outputs those entities NOT registered by registrationAuthority - (By default the script outputs all entities; can only have one of -reg or -notreg) + (By default the script outputs all entities; can only have one of --reg or --notreg) Example 1: To output all SPs in the UK federation metadata which have been imported (i.e. are not registered by the UKAMF registrationAuthority http://ukfederation.org.uk), and to include a header on the CSV file: @@ -49,6 +51,7 @@ sub help { my $notreg; my $help; my $head; +my $entityID; my $result = GetOptions( "idp" => \$idp, @@ -56,7 +59,8 @@ sub help { "reg=s" => \$reg, "notreg=s" => \$notreg, "help" => \$help, - "head" => \$head + "head" => \$head, + "entityID" => \$entityID ); if ($help) { @@ -92,6 +96,13 @@ sub help { exit 3; } +# Can only have one of --head and --entityID +if ( $head && $entityID ) { + print "\nError: can only have one of --head and --entityID set at the same time\n"; + help(); + exit 3 +} + # # Debug printing of input flags # @@ -168,6 +179,10 @@ () if ( $section->first_child('SPSSODescriptor') ) { $type = "SP"; } if ( ($sp && $type eq "SP") || ($idp && $type eq "IdP") ) { - print "$type, $entityID, $registrationAuthority, \"$ODN\", $URL\n" + if ($entityID) { + print "$entityID\n"; + } else { + print "$type, $entityID, $registrationAuthority, \"$ODN\", $URL\n" + } } }