diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/CAS.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/CAS.pm index 6eac15f7f..cd548bcdf 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/CAS.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/CAS.pm @@ -16,10 +16,6 @@ our $VERSION = '2.0.0'; extends 'Lemonldap::NG::Portal::Main::Issuer', 'Lemonldap::NG::Portal::Lib::CAS'; -# INTERFACE - -sub beforeAuth { 'exportRequestParameters' } - # INITIALIZATION sub init { @@ -84,7 +80,11 @@ sub run { my $casServiceTicket; # Renew - if ( $renew and $renew eq 'true' ) { + if ( $renew + and $renew eq 'true' + and time - $req->sessionInfo->{_utime} > + $self->conf->{portalForceAuthnInterval} ) + { # Authentication must be replayed $self->logger->debug("Authentication renew requested"); @@ -707,17 +707,4 @@ sub _validate2 { $casProxyGrantingTicketIOU, $proxies, $attributes ); } -# Store request parameters in %ENV -sub exportRequestParameters { - my ( $self, $req ) = @_; - - foreach my $param (qw/service renew gateway/) { - if ( $req->param($param) ) { - $req->env->{ "llng_cas_" . $param } = $req->param($param); - } - } - - return PE_OK; -} - 1; diff --git a/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-with-choice.t b/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-with-choice.t index 1e7effafb..956b06b8a 100644 --- a/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-with-choice.t +++ b/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-with-choice.t @@ -132,6 +132,7 @@ SKIP: { # Back to SP switch ('sp'); + # Follow redirection to CAS app ok( $res = $sp->_get( @@ -216,11 +217,12 @@ SKIP: { 'Follow redirection' ); - ($query) = expectRedirection($res,qr#http://auth.sp.com/?\?(ticket=.*)$#); + ($query) = + expectRedirection( $res, qr#http://auth.sp.com/?\?(ticket=.*)$# ); # Follow redirection to CAS app switch ('sp'); - ok($res=$sp->_get('/',query => $query),'Follow redirection'); + ok( $res = $sp->_get( '/', query => $query ), 'Follow redirection' ); expectCookie($res); @@ -313,18 +315,19 @@ sub issuer { demo => 'Demo;Demo;Demo', sql => 'DBI;DBI;DBI', }, - dbiAuthChain => 'dbi:SQLite:dbname=t/userdb.db', - dbiAuthUser => '', - dbiAuthPassword => '', - dbiAuthTable => 'users', - dbiAuthLoginCol => 'user', - dbiAuthPasswordCol => 'password', - dbiAuthPasswordHash => '', - issuerDBCASActivation => 1, - casAttr => 'uid', - casAttributes => { cn => 'cn', uid => 'uid', }, - casAccessControlPolicy => 'none', - multiValuesSeparator => ';', + dbiAuthChain => 'dbi:SQLite:dbname=t/userdb.db', + dbiAuthUser => '', + dbiAuthPassword => '', + dbiAuthTable => 'users', + dbiAuthLoginCol => 'user', + dbiAuthPasswordCol => 'password', + dbiAuthPasswordHash => '', + issuerDBCASActivation => 1, + casAttr => 'uid', + casAttributes => { cn => 'cn', uid => 'uid', }, + casAccessControlPolicy => 'none', + multiValuesSeparator => ';', + portalForceAuthnInterval => -1, } } );