lemonldap-ng/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CDA.pm

39 lines
846 B
Perl
Raw Normal View History

2016-04-03 10:44:58 +02:00
package Lemonldap::NG::Portal::Plugins::CDA;
use strict;
use Mouse;
2016-06-09 20:40:20 +02:00
our $VERSION = '2.0.0';
2016-06-02 23:20:36 +02:00
extends 'Lemonldap::NG::Common::Module';
2016-04-03 10:44:58 +02:00
2016-06-09 20:40:20 +02:00
# INTERFACE
2016-04-03 10:44:58 +02:00
sub afterDatas {
return 'changeUrldc';
}
2016-06-09 20:40:20 +02:00
# RUNNING METHOD
2016-04-03 10:44:58 +02:00
sub changeUrldc {
my ( $self, $req ) = @_;
2016-05-23 18:55:18 +02:00
my $urldc = $req->{urldc};
2016-04-03 10:44:58 +02:00
if ( $req->id
and $urldc !~ m#^https?://[^/]*$self->{conf}->{domain}(:\d+)?/#oi
2016-04-03 18:27:13 +02:00
and $self->p->isTrustedUrl($urldc) )
2016-04-03 10:44:58 +02:00
{
my $ssl = $urldc =~ /^https/;
$self->lmLog( 'CDA request', 'debug' );
2016-05-23 18:55:18 +02:00
$req->{urldc} .= ( $urldc =~ /\?/ ? '&' : '?' )
2016-04-03 10:44:58 +02:00
. (
( $self->conf->{securedCookie} < 2 or $ssl )
? $self->conf->{cookieName} . "=" . $req->id
: $self->conf->{cookieName} . "http="
. $req->{sessionInfo}->{_httpSession}
);
}
PE_OK;
}
1;