From 50e502de0a5ffdc88d9d7dd2f8d1447a3335824c Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Tue, 7 Nov 2017 17:45:40 +0100
Subject: [PATCH] update POD documentation

---
 lib/IdPAccountManager/SAMLMetadata.pm | 62 ++++++++++-----------------
 lib/IdPAccountManager/Tools.pm        |  8 ++--
 2 files changed, 27 insertions(+), 43 deletions(-)

diff --git a/lib/IdPAccountManager/SAMLMetadata.pm b/lib/IdPAccountManager/SAMLMetadata.pm
index 9d5e210..72c6a15 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 732c21a..d3dea2f 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.
 
-- 
GitLab