Error using Lemonldap::NG::Common::Crypt

This commit is contained in:
Xavier Guimard 2010-09-01 09:16:02 +00:00
parent e5bbac08de
commit 7770f58ab2
2 changed files with 9 additions and 10 deletions

View File

@ -8,9 +8,8 @@ package Lemonldap::NG::Portal::AuthOpenID;
use strict;
use Lemonldap::NG::Portal::Simple;
use Net::OpenID::Consumer;
use LWP::UserAgent;
use Cache::FileCache;
require Cache::FileCache;
our $VERSION = '0.1';
@ -18,9 +17,9 @@ our $VERSION = '0.1';
# @return Lemonldap::NG::Portal constant
sub authInit {
my $self = shift;
unless ( $self->{openIdSecret} ) {
$self->abort( 'Bad configuration', 'openIdSecret field is required' );
}
eval { require Net::OpenID::Consumer };
$self->abort( 'Unable to load Net::OpenID::Consumer', $@ ) if ($@);
$self->{openIdSecret} ||= $self->{cipher}->encrypt(0);
PE_OK;
}
@ -34,7 +33,7 @@ sub extractFormInfo {
# TODO : LWP options to use a proxy for example
$self->{csr} = Net::OpenID::Consumer->new(
ua => $ua,
cache => Cache::FileCache->new,
cache => $self->{refLocalStorage} || Cache::FileCache->new,
args => $self,
consumer_secret => $self->{openIdSecret},
required_root => $self->{portal},
@ -123,8 +122,8 @@ sub setAuthSessionInfo {
$self->{sessionInfo}->{'_user'} = $self->{user};
# authenticationLevel 4 for external authentication
$self->{sessionInfo}->{authenticationLevel} = 4;
# Since OpenID doesn't share authentication level, falling to 1
$self->{sessionInfo}->{authenticationLevel} = 1;
PE_OK;
}

View File

@ -17,7 +17,7 @@ sub issuerDBInit {
my $self = shift;
eval { require Net::OpenID::Server };
$self->abort( 'Unable to load Net::OpenID::Server', $@ ) if ($@);
$self->{openIdSecret} ||= $self->{conf}->crypt(0);
$self->{openIdSecret} ||= $self->{cipher}->encrypt(0);
return PE_OK;
}
@ -154,7 +154,7 @@ sub _openIDResponse {
if ( $self->{_openIdTrustRequired} ) {
# TODO
$self->info( "<h2>Site demandé " . $data->{trust_root} . "</h2>" );
$self->info( "<h2>Site demand&eacute; " . $data->{trust_root} . "</h2>" );
$self->lmLog( 'OpenID confirmation', 'debug' );
$self->storeOpenIDprm();
return PE_CONFIRM;