Commit de969f19 authored by Yadd's avatar Yadd

CAS in progress (#595)

parent 747cd860
......@@ -432,7 +432,7 @@ sub _validate2 {
my $service = $req->param('service');
my $ticket = $req->param('ticket');
my $pgtUrl = $req->param('pgtUrl');
my $renew = $req->param('renew');
my $renew = $req->param('renew') // 'false';
# PGTIOU
my $casProxyGrantingTicketIOU;
......@@ -621,16 +621,20 @@ sub _validate2 {
# Get username
my $username =
$localSession->data->{ $self->{casAttr} || $self->{whatToTrace} };
$localSession->data->{ $self->conf->{casAttr}
|| $self->conf->{whatToTrace} };
$self->lmLog( "Get username $username", 'debug' );
# Get attributes [CAS 3.0]
my $attributes = {};
if ( defined $self->{casAttributes} ) {
foreach my $casAttribute ( keys %{ $self->{casAttributes} } ) {
if ( defined $self->conf->{casAttributes}
and %{ $self->conf->{casAttributes} } )
{
foreach my $casAttribute ( keys %{ $self->conf->{casAttributes} } ) {
my $localSessionValue =
$localSession->data->{ $self->{casAttributes}->{$casAttribute} };
$localSession->data->{ $self->conf->{casAttributes}
->{$casAttribute} };
$attributes->{$casAttribute} = $localSessionValue
if defined $localSessionValue;
}
......@@ -638,7 +642,7 @@ sub _validate2 {
# Return success message
$self->deleteCasSession($casServiceSession);
return $self->returnCasServiceValidateSuccess( $username,
return $self->returnCasServiceValidateSuccess( $req, $username,
$casProxyGrantingTicketIOU, $proxies, $attributes );
}
......
......@@ -102,7 +102,7 @@ sub returnCasServiceValidateSuccess {
$self->lmLog( "Return CAS service validate success with username $username",
'debug' );
my $s = "<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas
my $s = "<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
\t<cas:authenticationSuccess>
\t\t<cas:user>$username</cas:user>\n";
if ( defined $attributes ) {
......@@ -110,7 +110,7 @@ sub returnCasServiceValidateSuccess {
foreach my $attribute ( keys %$attributes ) {
foreach my $value (
split(
$self->{multiValuesSeparator},
$self->conf->{multiValuesSeparator},
$attributes->{$attribute}
)
)
......
......@@ -106,7 +106,7 @@ done_testing( count() );
# Redefine LWP methods for tests
sub mygethttps2 {
my ( $host, $port, $path, $ssl_data ) = @_;
ok( $path =~ m#^(/[^\?]+)(?:\?(.*))?$#, "Path to push to IdP: $path");
ok( $path =~ m#^(/[^\?]+)(?:\?(.*))?$#, "Path to push to IdP: $path" );
$path = $1;
my $query = $2;
ok( $res = $issuer->_get( $path, query => $query ), 'Execute request' );
......@@ -138,6 +138,7 @@ sub issuer {
casAttr => 'uid',
casAttributes => { cn => 'cn', uid => 'uid', },
casAccessControlPolicy => 'none',
multiValuesSeparator => ';',
}
}
);
......@@ -155,6 +156,7 @@ sub sp {
issuerDBCASActivation => 0,
CASurl => 'http://auth.idp.com/cas',
CASCAFile => 't/caFile.pem',
multiValuesSeparator => ';',
},
}
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment