Commit 0ee20f3d authored by Yadd's avatar Yadd

Attributes management

parent 69f799ee
......@@ -524,6 +524,7 @@ clean: common_clean handler_clean portal_clean manager_clean
@rm -f $$(find */ -name '*bak' -delete)
@rm -rf $(EXAMPLEROOT) example/ doc/devel
@rm -vf *gz *zip
@rm -rf lemonldap-ng-$(VERSION)
@echo "Cleaned"
common_clean:
......
......@@ -7,7 +7,8 @@ use strict;
my $IGNORE = join(
'|', qw(
csr urldc cfgNum p (?:s|rS)essionInfo dn user mustRedirect password dbi\w+
reVHosts stack timezone vident _\w+ lmConf
reVHosts stack timezone vident _\w+ lmConf table (?:st|db)h res id
refLocalStorage
)
);
......@@ -52,8 +53,11 @@ foreach my $module (qw(common handler manager portal)) {
open F, 'lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm';
my $managedAttr;
my $buf;
while (<F>) {
$managedAttr->{$1}++ if (/'\w+:\/(\w+)/);
$buf = '' if($buf =~ /,$/);
$buf.=$_;
$managedAttr->{$1}++ if ($buf =~ /=>\s*'\w+:\/(\w+)/s);
}
my $unmanagedAttr;
foreach my $module (qw(common handler manager portal)) {
......
......@@ -58,8 +58,8 @@ sub extractFormInfo {
# Remote error
unless ( $csr->is_server_response() ) {
$self->{msg} = 'No OpenID valid message found' . $csr->err();
$self->lmLog( $self->{msg}, 'info' );
$self->{_msg} = 'No OpenID valid message found' . $csr->err();
$self->lmLog( $self->{_msg}, 'info' );
return PE_BADCREDENTIALS;
}
......@@ -72,8 +72,8 @@ sub extractFormInfo {
# Check if user has refused to share his authentication
elsif ( $csr->user_cancel() ) {
$self->{msg} = "OpenID request cancelled by user";
$self->lmLog( $self->{msg}, 'info' );
$self->{_msg} = "OpenID request cancelled by user";
$self->lmLog( $self->{_msg}, 'info' );
return PE_FIRSTACCESS;
}
......@@ -88,8 +88,8 @@ sub extractFormInfo {
# Other errors
else {
$self->{msg} = 'OpenID error: ' . $csr->err;
$self->lmLog( $self->{msg}, 'warn' );
$self->{_msg} = 'OpenID error: ' . $csr->err;
$self->lmLog( $self->{_msg}, 'warn' );
return PE_ERROR;
}
}
......@@ -100,8 +100,8 @@ sub extractFormInfo {
# Check if url is valid
unless ($claimed_identity) {
$self->{msg} = "OpenID error : " . $self->{csr}->err();
$self->lmLog( $self->{msg}, 'warn' );
$self->{_msg} = "OpenID error : " . $self->{csr}->err();
$self->lmLog( $self->{_msg}, 'warn' );
return PE_BADCREDENTIALS;
}
......
......@@ -35,7 +35,7 @@ sub extractFormInfo {
my $self = shift;
# Build Net::Twitter object
$self->{twitter} = Net::Twitter->new(
$self->{_twitter} = Net::Twitter->new(
traits => [qw/API::REST OAuth/],
consumer_key => $self->{twitterKey},
consumer_secret => $self->{twitterSecret},
......@@ -50,7 +50,7 @@ sub extractFormInfo {
# 1.1 Try to get token to dialog with Twitter
eval {
$url =
$self->{twitter}->get_authorization_url(
$self->{_twitter}->get_authorization_url(
callback => "$self->{portal}?twitterback=1&url="
. $self->get_url() );
};
......@@ -68,12 +68,12 @@ sub extractFormInfo {
push @{ $self->{cookie} },
$self->cookie(
-name => '_twitTok',
-value => $self->{twitter}->request_token,
-value => $self->{_twitter}->request_token,
-expires => '+3m'
),
$self->cookie(
-name => '_twitSec',
-value => $self->{twitter}->request_token_secret,
-value => $self->{_twitter}->request_token_secret,
-expires => '+3m'
);
......@@ -95,7 +95,7 @@ sub extractFormInfo {
$self->{sessionInfo}->{_access_token},
$self->{sessionInfo}->{_access_token_secret}
)
= $self->{twitter}->request_access_token(
= $self->{_twitter}->request_access_token(
token => $self->cookie('_twitTok'),
token_secret => $self->cookie('_twitSec'),
verifier => $verifier
......@@ -103,7 +103,7 @@ sub extractFormInfo {
# 2.2 Ask for user_timeline : I've not found an other way to access to user
# datas !
my $status = eval { $self->{twitter}->user_timeline( { count => 1 } ) };
my $status = eval { $self->{_twitter}->user_timeline( { count => 1 } ) };
# 2.3 Check if user has accepted authentication
if ($@) {
......@@ -115,8 +115,8 @@ sub extractFormInfo {
}
# 2.4 Set $self->{user} to twitter.com/<username>
$self->{twitterUser} = $status->[0]->{user};
$self->{user} = 'twitter.com/' . $status->{twitterUser}->{screen_name};
$self->{_twitterUser} = $status->[0]->{user};
$self->{user} = 'twitter.com/' . $status->{_twitterUser}->{screen_name};
$self->lmLog( "Good Twitter authentication for $self->{user}", 'debug' );
# Force redirection to avoid displaying OAuth datas
......@@ -137,7 +137,7 @@ sub setAuthSessionInfo {
# TODO: set a parameter to choose this
foreach (qw(screen_name location lang name url)) {
$self->{sessionInfo}->{$_} = $self->{twitterUser}->{$_};
$self->{sessionInfo}->{$_} = $self->{_twitterUser}->{$_};
}
$self->{sessionInfo}->{authenticationLevel} = $self->{twitterAuthnLevel};
......
......@@ -58,7 +58,7 @@ sub proxyQuery {
. $soap->error( 'fr', $res->{error} )->result() );
return PE_BADCREDENTIALS;
}
$self->{remoteId} = $res->{cookies}->{ $self->{remoteCookieName} }
$self->{_remoteId} = $res->{cookies}->{ $self->{remoteCookieName} }
or $self->abort("No cookie named $self->{remoteCookieName}");
$self->{_proxyQueryDone}++;
PE_OK;
......@@ -73,7 +73,7 @@ sub setSessionInfo {
my $soap =
SOAP::Lite->proxy( $self->{soapSessionService} )
->uri('urn:Lemonldap::NG::Common::CGI::SOAPService');
my $r = $soap->getAttributes( $self->{remoteId} );
my $r = $soap->getAttributes( $self->{_remoteId} );
if ( $r->fault ) {
$self->abort( "Unable to query authentication service",
$r->fault->{faultstring} );
......
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