2017-01-05 16:19:57 +01:00
|
|
|
package Lemonldap::NG::Portal::UserDB::OpenID;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Mouse;
|
|
|
|
use Lemonldap::NG::Portal::Main::Constants qw(
|
|
|
|
PE_MISSINGREQATTR
|
|
|
|
PE_OK
|
|
|
|
);
|
|
|
|
|
|
|
|
our $VERSION = '2.0.0';
|
|
|
|
|
|
|
|
extends 'Lemonldap::NG::Common::Module',
|
|
|
|
'Lemonldap::NG::Portal::Lib::OpenIDConnect';
|
|
|
|
|
|
|
|
# INITIALIZATION
|
|
|
|
|
|
|
|
sub init {
|
|
|
|
my ($self) = @_;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
# RUNNING METHODS
|
|
|
|
|
|
|
|
sub getUser {
|
|
|
|
PE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub setSessionInfo {
|
|
|
|
my ( $self, $req ) = @_;
|
|
|
|
my %vars = (
|
|
|
|
%{ $self->conf->{exportedVars} },
|
|
|
|
%{ $self->conf->{openIdExportedVars} }
|
|
|
|
);
|
|
|
|
while ( my ( $k, $v ) = each %vars ) {
|
|
|
|
my $attr = $k;
|
|
|
|
my $required = ( $attr =~ s/^!// );
|
|
|
|
if ( $v =~ Lemonldap::NG::Common::Regexp::OPENIDSREGATTR() ) {
|
|
|
|
my $p = $req->param("openid.sreg.$v");
|
|
|
|
if ( $required and not defined $p ) {
|
2017-02-15 07:41:50 +01:00
|
|
|
$self->userLogger->warn(
|
|
|
|
"Required parameter $attr is not provided by OpenID server, aborted"
|
2017-01-05 16:19:57 +01:00
|
|
|
);
|
|
|
|
return PE_MISSINGREQATTR;
|
|
|
|
}
|
2017-03-03 13:17:15 +01:00
|
|
|
$req->{sessionInfo}->{$attr} = $p;
|
2017-01-05 16:19:57 +01:00
|
|
|
}
|
|
|
|
else {
|
2017-02-15 07:41:50 +01:00
|
|
|
$self->userLogger->warn(
|
|
|
|
"Ignoring attribute $v which is not a valid OpenID SREG attribute"
|
2017-01-05 16:19:57 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Does nothing
|
|
|
|
sub setGroups {
|
|
|
|
PE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|