From 3d5709cd0a2008eb4b875445e2e9abd66231f48c Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Wed, 8 Dec 2010 10:42:53 +0000 Subject: [PATCH] Slave in progress --- .../lib/Lemonldap/NG/Manager/_Struct.pm | 23 +++++++++++-------- .../lib/Lemonldap/NG/Manager/_i18n.pm | 4 ++++ .../lib/Lemonldap/NG/Portal/AuthSlave.pm | 1 - .../lib/Lemonldap/NG/Portal/UserDBSlave.pm | 4 +++- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm index 2d2fccffa..1784776c9 100644 --- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm +++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm @@ -280,7 +280,7 @@ sub struct { _nodes => [ 'applicationlist:/applicationList:menuCatAndApp:applicationListCategory' ], - _js => 'applicationListCategoryRoot', + _js => 'applicationListCategoryRoot', _help => 'menuCatAndApp', }, }, @@ -575,9 +575,10 @@ sub struct { # Slave slaveParams => { - _nodes => [qw(slaveAuthnLevel)], - _help => 'authSlave', + _nodes => [qw(slaveAuthnLevel slaveUserAttr)], + _help => 'authSlave', slaveAuthnLevel => 'int:/slaveAuthnLevel', + slaveUserAttr => 'int:/slaveUserAttr', }, # Choice @@ -618,14 +619,14 @@ sub struct { issuerDBCASPath => 'text:/issuerDBCASPath', issuerDBCASRule => 'text:/issuerDBCASRule:issuerdbCAS:boolOrPerlExpr', - issuerDBCASOptions => { + issuerDBCASOptions => { _nodes => [qw(casAttr casStorage cn:casStorageOptions)], casAttr => 'text:/casAttr', casStorage => 'text:/casStorage', casStorageOptions => { _nodes => ['hash:/casStorageOptions:issuerDBCAS:btext'], - _js => 'hashRoot', + _js => 'hashRoot', _help => 'issuerdbCAS', }, }, @@ -637,7 +638,7 @@ sub struct { _help => 'issuerdbOpenID', issuerDBOpenIDActivation => 'bool:/issuerDBOpenIDActivation', - issuerDBOpenIDPath => 'text:/issuerDBOpenIDPath', + issuerDBOpenIDPath => 'text:/issuerDBOpenIDPath', issuerDBOpenIDRule => 'text:/issuerDBOpenIDRule:issuerdbOpenID:boolOrPerlExpr', issuerDBOpenIDOptions => { @@ -708,7 +709,7 @@ sub struct { globalStorageOptions => { _nodes => ['hash:/globalStorageOptions:sessionsdb:btext'], - _js => 'hashRoot', + _js => 'hashRoot', _help => 'sessionsdb', }, }, @@ -778,7 +779,7 @@ sub struct { userControl => 'text:/userControl', portalForceAuthn => 'bool:/portalForceAuthn', key => 'text:/key', - trustedDomains => 'text:/trustedDomains', + trustedDomains => 'text:/trustedDomains', }, redirection => { @@ -1115,7 +1116,7 @@ sub struct { samlStorageOptions => { _nodes => ['hash:/samlStorageOptions:samlServiceAdvanced:btext'], - _js => 'hashRoot', + _js => 'hashRoot', _help => 'samlServiceAdvanced', }, samlCommonDomainCookie => { @@ -1655,6 +1656,10 @@ sub testStruct { # Slave slaveAuthnLevel => $integer, + slaveUserAttr => { + test => qr/^[_a-zA-Z]\w*$/, + msgFail => 'Bad attribute name', + }, # Choice authChoiceParams => $testNotDefined, diff --git a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm index 054972b84..192f50546 100644 --- a/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm +++ b/modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm @@ -257,6 +257,8 @@ sub en { singleIP => 'One IP only by user', singleSession => 'One session only by user', singleUserByIP => 'One user by IP address', + slaveAuthnLevel => 'Authentication level', + slaveParams => 'Slave parameters', SMTPServer => 'SMTP server', soap => 'SOAP', Soap => 'Activation', @@ -641,6 +643,8 @@ sub fr { singleIP => 'Une seule IP par utilisateur', singleSession => 'Une seule session par utilisateur', singleUserByIP => 'Une seule adresse IP par utilisateur', + slaveAuthnLevel => 'Niveau d\'authentification', + slaveParams => 'Paramètres Slave', SMTPServer => 'Serveur SMTP', soap => 'SOAP', Soap => 'Activation', diff --git a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthSlave.pm b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthSlave.pm index 6f203927e..639233150 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthSlave.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthSlave.pm @@ -18,7 +18,6 @@ our @ISA = qw(Lemonldap::NG::Portal::AuthNull); sub setAuthSessionInfo { my $self = shift; - $self->{sessionInfo}->{'_user'} = 'anonymous'; $self->{sessionInfo}->{authenticationLevel} = $self->{slaveAuthnLevel}; PE_OK; diff --git a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBSlave.pm b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBSlave.pm index 54fd0544a..e386652ef 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBSlave.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBSlave.pm @@ -17,12 +17,14 @@ our @ISA = qw(Lemonldap::NG::Portal::UserDBNull); # @return Lemonldap::NG::Portal constant sub setSessionInfo { my $self = shift; - my $c = 0; + my $c = 0; while ( my ( $k, $v ) = each %{ $self->{exportedVars} } ) { $v = 'HTTP_' . uc($v); $v =~ s/\-/_/g; $self->{sessionInfo}->{$k} = $ENV{$v} and $c++; } + $self->{sessionInfo}->{'_user'} ||= + $self->{sessionInfo}->{ $self->{slaveUserAttr} }; return ( $c ? PE_OK : PE_USERNOTFOUND ); }