From e3ce6ce278e7e9b23573ea3e6ec01c920a31aff2 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse <guillaume.rousse@renater.fr> Date: Fri, 3 Nov 2017 17:00:55 +0100 Subject: [PATCH] only pass needed variables to templates --- lib/IdPAccountManager/WebRequest.pm | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm index bd0495f..08677e8 100755 --- a/lib/IdPAccountManager/WebRequest.pm +++ b/lib/IdPAccountManager/WebRequest.pm @@ -85,10 +85,20 @@ sub execute { # initialize output parameters $self->{out} = { - url_cgi => $ENV{SCRIPT_NAME}, - env => \%ENV, - actions => \%actions, - conf => $self->{configuration}, + env => { + REMOTE_HOST => $ENV{REMOTE_HOST}, + REMOTE_ADDR => $ENV{REMOTE_ADDR}, + SCRIPT_NAME => $ENV{SCRIPT_NAME} + }, + conf => { + accounts_validity_period => $self->{configuration}->{accounts_validity_period}, + app_name => $self->{configuration}->{app_name}, + app_url => $self->{configuration}->{app_url}, + idp_scope => $self->{configuration}->{idp_scope}, + idp_displayname => $self->{configuration}->{idp_displayname}, + support_email => $self->{configuration}->{support_email}, + version => $self->{configuration}->{version}, + } }; # process input parameters @@ -152,13 +162,6 @@ sub respond { my ($self) = @_; $self->{logger}->log(level => LOG_DEBUG, message => ""); - ## Automatic pass object entries to the output hash - foreach my $key (keys %{$self}) { - - $self->{out}{$key} ||= $self->{$key} - unless ($key eq 'out'); - } - ## Parse template my $tt2 = Template->new( { -- GitLab