From b652c633a135be3b5965b4b2725431a664224932 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Tue, 31 Oct 2017 17:31:17 +0100
Subject: [PATCH] get rid of junk comments and debug code

---
 lib/IdPAccountManager/AuthenticationToken.pm |  3 +--
 lib/IdPAccountManager/SAMLMetadata.pm        | 20 ++----------------
 lib/IdPAccountManager/ServiceProvider.pm     |  2 +-
 lib/IdPAccountManager/TestAccount.pm         |  5 +----
 lib/IdPAccountManager/Tools.pm               |  2 +-
 lib/IdPAccountManager/WebRequest.pm          | 22 --------------------
 6 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/lib/IdPAccountManager/AuthenticationToken.pm b/lib/IdPAccountManager/AuthenticationToken.pm
index 31b6e00..2262d7d 100644
--- a/lib/IdPAccountManager/AuthenticationToken.pm
+++ b/lib/IdPAccountManager/AuthenticationToken.pm
@@ -28,7 +28,6 @@ sub new {
 
     my $self = {};
 
-    ## Bless AuthenticationToken object
     bless $self, $pkg;
 
     ## Object may be created either with a hashref as argument or an IdPAccountManager::Data::Authenticationtoken object
@@ -136,7 +135,7 @@ sub _generate_token {
     return substr(Digest::MD5::md5_hex(time . $$ . $salt), -1 * $size);
 }
 
-1;    # Magic true value required at end of module
+1;
 __END__
 
 =head1 NAME
diff --git a/lib/IdPAccountManager/SAMLMetadata.pm b/lib/IdPAccountManager/SAMLMetadata.pm
index 2ae3782..1cbfdad 100644
--- a/lib/IdPAccountManager/SAMLMetadata.pm
+++ b/lib/IdPAccountManager/SAMLMetadata.pm
@@ -21,7 +21,6 @@ sub new {
 
     my $self = { logger => $args{logger} };
 
-    ## Bless SAMLMetadata object
     bless $self, $pkg;
 
     return $self;
@@ -115,7 +114,6 @@ sub print {
     return 1.;
 }
 
-## Internal function
 ## returns a Lib::XML représenting an XML file
 sub _get_xml_object {
     my $self = shift;
@@ -176,13 +174,6 @@ sub _parse_saml_metadata {
     my $self = shift;
     my %options = @_;
 
-    #$self->{logger}->log(level => LOG_TRACE, message => join(',',%options));
-
-#unless ($options{'filter_entity_type'}) {
-#$self->{logger}->log(level => LOG_ERROR, message => "paramètre entity_type manquant");
-#return undef;
-#}
-
     my $root = $options{'metadata_as_xml'};
 
     my @extracted_array;
@@ -202,14 +193,9 @@ sub _parse_saml_metadata {
           if ($options{'filter_entity_id'}
             && ($options{'filter_entity_id'} ne $extracted_data->{'entityid'}));
 
-#$self->{logger}->log(level => LOG_TRACE, message => "EntityId: %s - Cherche %s", $extracted_data->{'entityid'}, $options{'filter_entity_id'});
-
         $extracted_data->{'xml_md'} =
           IdPAccountManager::Tools::escape_xml($EntityDescriptor->toString());
 
-#$self->{logger}->log(level => LOG_TRACE, message => "EntityId: %s", $extracted_data->{'entityid'});
-#$self->{logger}->log(level => LOG_TRACE, message => "Entity dump: %s", $EntityDescriptor->toString());
-
         foreach my $child ($EntityDescriptor->childNodes()) {
 
             ## Ignoringnodes of type XML::LibXML::Text or XML::LibXML::Comment
@@ -224,7 +210,7 @@ sub _parse_saml_metadata {
                 {
 
                     ## On ne prend en compte que les endpoints prévus
-#next unless ($sso->getAttribute('Binding') && defined $supported_saml_bindings{$sso->getAttribute('Binding')});
+                    #next unless ($sso->getAttribute('Binding') && defined $supported_saml_bindings{$sso->getAttribute('Binding')});
 
                     ## On extrait les infos sur les endpoints
                     push @{ $extracted_data->{'idp_endpoints'} },
@@ -301,7 +287,6 @@ sub _parse_saml_metadata {
 
             } elsif ($child->nodeName =~ /Extensions$/) {
 
-#$self->{logger}->log(level => LOG_TRACE, message => "Extensions for %s", $extracted_data->{'entityid'});
                 foreach my $registrationinfo (
                     $child->getElementsByLocalName('RegistrationInfo'))
                 {
@@ -408,7 +393,6 @@ sub _parse_saml_metadata {
         }
 
         ## Filter entities based  on type
-#$self->{logger}->log(level => LOG_TRACE, message => "Entity type : %s",  $extracted_data->{'type'});
         next
           if (defined $options{'filter_entity_type'}
             && ($options{'filter_entity_type'} ne $extracted_data->{'type'}));
@@ -426,7 +410,7 @@ sub _parse_saml_metadata {
     return \@extracted_array;
 }
 
-1;    # Magic true value required at end of module
+1;
 __END__
 
 =head1 NAME
diff --git a/lib/IdPAccountManager/ServiceProvider.pm b/lib/IdPAccountManager/ServiceProvider.pm
index 41eb2ed..37cf767 100644
--- a/lib/IdPAccountManager/ServiceProvider.pm
+++ b/lib/IdPAccountManager/ServiceProvider.pm
@@ -83,7 +83,7 @@ sub list_service_providers {
     return $service_providers;
 }
 
-1;    # Magic true value required at end of module
+1;
 __END__
 
 =head1 NAME
diff --git a/lib/IdPAccountManager/TestAccount.pm b/lib/IdPAccountManager/TestAccount.pm
index 50a1b8a..60f6850 100644
--- a/lib/IdPAccountManager/TestAccount.pm
+++ b/lib/IdPAccountManager/TestAccount.pm
@@ -27,7 +27,6 @@ sub new {
 
     my $self = {};
 
-    ## Bless Provider object
     bless $self, $pkg;
 
     ## Object may be created either with a hashref as argument or an IdPAccountManager::Data::Testaccount object
@@ -142,9 +141,7 @@ sub create_test_accounts_for_sp {
     return @test_accounts;
 }
 
-#before 'new' => sub { print "about to call new\n"; };
-
-1;    # Magic true value required at end of module
+1;
 __END__
 
 =head1 NAME
diff --git a/lib/IdPAccountManager/Tools.pm b/lib/IdPAccountManager/Tools.pm
index e911d46..c5c20b7 100644
--- a/lib/IdPAccountManager/Tools.pm
+++ b/lib/IdPAccountManager/Tools.pm
@@ -265,7 +265,7 @@ sub boolean2integer {
     return undef;
 }
 
-1;    # Magic true value required at end of module
+1;
 __END__
 
 =head1 NAME
diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm
index 894ab56..21a8396 100755
--- a/lib/IdPAccountManager/WebRequest.pm
+++ b/lib/IdPAccountManager/WebRequest.pm
@@ -43,23 +43,14 @@ sub new {
     $self->{'param_out'}{'actions'} = $args{actions};
     $self->{'param_out'}{'conf'}    = \%Conf::global;
 
-    ## Dumping input data
-#open TMP, ">/tmp/account_manager.in"; IdPAccountManager::Tools::dump_var($self->{'param_in'}, 0, \*TMP); close TMP;
-
     ## Clean input vars
     foreach my $key (keys %{ $self->{'param_in'} }) {
 
-#$self->{logger}->log(level => LOG_TRACE, message => "PARAM_ENTREE: %s=%s", $key, $self->{'param_in'}{$key});
-
         ## Removing all ^M (0D)
         $self->{'param_in'}{$key} =~ s/\r//g;
 
         $self->{'param_in'}{$key} =~ s/\s+$//;    ## Remove trailing spaces
         $self->{'param_in'}{$key} =~ s/^\s+//;    ## Remove leading spaces
-            #if ($self->{'param_in'}{$key} =~ /\0/) {
-            #  my @valeurs = split /\0/, $self->{'param_in'}{$key};
-         #  $self->{'param_in'}{$key} = $valeurs[0]; ## Only keep first value of multi-valued parameters
-         #}
 
         ## If action_xx param is set, then action=xx
         ## Usefull to have sementicless values in submit forms
@@ -131,8 +122,6 @@ sub execute {
 
     } while ($self->{'next_action'});
 
-    #return undef if (!defined $status);
-
     return 1;
 }
 
@@ -141,16 +130,9 @@ sub respond {
     my $self = shift;
     $self->{logger}->log(level => LOG_DEBUG, message => "");
 
-    ## Dump output data
-#open TMP, ">/tmp/account_registry.out"; IdPAccountManager::Tools::dump_var($self->{'param_out'}, 0, \*TMP); close TMP;
-
-    ## Enable dumping off all variables in web pages
-    #$self->{'param_out'}{'dump'} =  $self->{'param_out'};
-
     ## Automatic pass object entries to the output hash
     foreach my $key (keys %{$self}) {
 
-        #$self->{logger}->log(level => LOG_TRACE, message => "Passing $key");
         $self->{'param_out'}{$key} ||= $self->{$key}
           unless ($key eq 'param_out');
     }
@@ -158,13 +140,10 @@ sub respond {
     ## An action may redirect to an external URL
     if ($self->{'url_redirection'}) {
 
-#$self->{logger}->log(level => LOG_TRACE, message => "URL Redirect : $self->{'url_redirection'}");
         printf "Location: %s\n\n", $self->{'url_redirection'};
 
     } else {
 
-#$self->{'param_out'}{'cookie'} = CGI::Cookie->new(-name=>'as_user',-value=>$self->{'as_user'},-expires=>'-1M');
-
         ## Parse template
         my $tt2 = Template->new(
             {
@@ -312,7 +291,6 @@ sub req_select_sp {
         entityid => $self->{'param_in'}{'sp_entityid'});
 
     ## Prepare data
-#open TMP, ">/tmp/account_manager_metadata.dump"; IdPAccountManager::Tools::dump_var($federation_metadata->{'federation_metadata_as_hashref'}[0], 0, \*TMP); close TMP;
     my $sp_metadata_as_hashref =
       $federation_metadata->{'federation_metadata_as_hashref'}[0];
     my @contacts;
-- 
GitLab