diff --git a/lib/IdPAccountManager/SAMLMetadata.pm b/lib/IdPAccountManager/SAMLMetadata.pm index 9d5e21013d8c756277021ee73c2d0550b992e57a..72c6a15c5c59e955fae18ba9981a5187acd74fa2 100644 --- a/lib/IdPAccountManager/SAMLMetadata.pm +++ b/lib/IdPAccountManager/SAMLMetadata.pm @@ -212,68 +212,52 @@ SAMLMetadata - loading SAML federation metadata =head1 SYNOPSIS - my $federation_metadata = new IdPAccountManager::SAMLMetadata; - unless ($federation_metadata->load(federation_metadata_file_path => '/tmp/edugain-saml-metadata.xml')) { - die; - } - - my %args; - if ($options{sp_entityid}) { - $args{filter_entity_id} = $options{sp_entityid}; - } + # instanciate metadata object + my $metadata = IdPAccountManager::SAMLMetadata->new( + file => '/tmp/edugain-saml-metadata.xml' + ); - unless ($federation_metadata->parse(sp_entityid => 'https://test.federation.renater.fr/test/ressource')) { - die; - } - - ## List SAML entities - printf "Hashref representing the metadata:\n"; - IdPAccountManager::Tools::dump_var($federation_metadata->{federation_metadata_as_hashref}, 0, \*STDOUT); + # extract metadata for a single SAML entity + my $entities = $metadata->parse(id => $id); =head1 DESCRIPTION -The Test Account manager instanciates test accounts associated to a SAML Identity Provider. -This module parses a SAML2 metadata file. - -=head1 SUBROUTINES/METHODS - -=over 8 +This class parses a SAML2 metadata file. -=item C<new ARGS> +=head1 CLASS METHODS -Class method. Create a new IdPAccountManager::SAMLMetadata object. -Example: - - my $federation_metadata = new IdPAccountManager::SAMLMetadata; +=over -=item C<load ARGS> +=item new() -Loads the SAML metadata file. +Create a new IdPAccountManager::SAMLMetadata object. Supported arguments include: -=over 12 +=over -=item C<federation_metadata_file_path> +=item I<file>: metadata file path -Path of the SAML metadata file. +=back =back -=item C<parse ARGS> +=head1 INSTANCE METHODS + +=over + +=item parse() Parse the SAML metadata file. Supported arguments include: -=over 12 +=over -=item C<filter_entity_id> +=item I<id>: keep only entity with matching ID -EntityID of SAML entities to filter. +=item I<type>: keep only entity with matching type =back -=item C<print FD> - -Dumps the content of the SAML metadata to the specified FD file handler (default to STDOUT) +=back diff --git a/lib/IdPAccountManager/Tools.pm b/lib/IdPAccountManager/Tools.pm index 732c21a168b5d604643a8778f5c550a83761ded1..d3dea2fd972123dc90e3284e0ae5a65cc5162b1a 100644 --- a/lib/IdPAccountManager/Tools.pm +++ b/lib/IdPAccountManager/Tools.pm @@ -107,15 +107,15 @@ IdPAccountManager::Tools - Set of subroutines usefull for the Test Account manag The Test Account manager instanciates test accounts associated to a SAML Identity Provider. This module gathers a set of usefull subroutines. -=head1 SUBROUTINES/METHODS +=head1 FUNCTIONS -=over 8 +=over -=item C<generate_password> +=item generate_password() Returns a random password following some security guidelines. -=item C<update_ssp_authsources> +=item update_ssp_authsources() Update simpleSAMLphp authsources.php configuration file with the currently valid test accounts.