Store CAS app in ENV (#1161)

This commit is contained in:
Clément OUDOT 2018-06-23 10:18:55 +02:00
parent 151088559f
commit 808922a388

View File

@ -18,6 +18,8 @@ extends 'Lemonldap::NG::Portal::Main::Issuer',
# INITIALIZATION
use constant beforeAuth => 'storeEnv';
sub init {
my ($self) = @_;
@ -42,6 +44,23 @@ sub init {
# RUNNING METHODS
sub storeEnv {
my ( $self, $req ) = @_;
my $service = $self->p->getHiddenFormValue( $req, 'service' )
|| $req->param('service');
if ( $service and $service =~ m#^(https?://[^/]+)(/.*)?$# ) {
my ( $host, $uri ) = ( $1, $2 );
my $app = $self->casAppList->{$host};
if ($app) {
$req->env->{llng_cas_app} = $app;
}
}
return PE_OK;
}
# Main method (launched only for authenticated users, see Main/Issuer)
sub run {
my ( $self, $req, $target ) = @_;