From f4b17c7c8a9be1e969800aadbb6a9eab40ef536b Mon Sep 17 00:00:00 2001 From: Christophe Maudoux Date: Sun, 23 Sep 2018 11:07:58 +0200 Subject: [PATCH] Cleaning unuseful code & append comments (#1431) --- .../lib/Lemonldap/NG/Portal/Main/Display.pm | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm index 2f133a404..7b100d92e 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm @@ -518,6 +518,8 @@ sub mkOidcConsent { if ( defined( $self->conf->{oidcRPMetaDataOptions} ) and ref( $self->conf->{oidcRPMetaDataOptions} ) ) { + + # Set default RP displayname foreach my $oidc ( keys %{ $self->conf->{oidcRPMetaDataOptions} } ) { $self->conf->{oidcRPMetaDataOptions}->{$oidc} ->{oidcRPMetaDataOptionsDisplayName} ||= $oidc; @@ -525,10 +527,10 @@ sub mkOidcConsent { } # Loading existing oidcConsents - $self->logger->debug("Loading OIDC Consents ..."); - my $_consents; + $self->logger->debug("Searching OIDC Consents..."); + my $_oidcConsents; if ( exists $session->{_oidcConsents} ) { - $_consents = eval { + $_oidcConsents = eval { from_json( $session->{_oidcConsents}, { allow_nonref => 1 } ); }; if ($@) { @@ -538,14 +540,9 @@ sub mkOidcConsent { } else { $self->logger->debug("No OIDC Consent found"); - - #$_oidcConsents = []; } - my $consents = {}; -##################### - - foreach (@$_consents) { + foreach (@$_oidcConsents) { if ( defined $_->{rp} ) { my $rp = $_->{rp}; $self->logger->debug("RP { $rp } Consent found"); @@ -557,18 +554,7 @@ sub mkOidcConsent { } } - #foreach ( keys %$session ) { - #if ( $_ =~ /_oidc_consent_time_(.+)$/ ) { - #$consents->{$1}->{time} = $session->{ "_oidc_consent_time_" . $1 }; - #$consents->{$1}->{scope} = - #$session->{ "_oidc_consent_scope_" . $1 }; - #$consents->{$1}->{displayName} = - #$self->conf->{oidcRPMetaDataOptions}->{$1} - #->{oidcRPMetaDataOptionsDisplayName}; - #} - #} -##################### - + # Display existing oidcConsents return $self->loadTemplate( 'oidcConsents', params => {