UserDBWebID seems to be finished
This commit is contained in:
parent
8b56492342
commit
61e68ae5d8
|
@ -1458,7 +1458,7 @@ sub testStruct {
|
|||
exportedVars => {
|
||||
keyTest => qr/^!?[a-zA-Z][\w-]*$/,
|
||||
keyMsgFail => 'Bad variable name',
|
||||
test => qr/^[a-zA-Z][\w-]*$/,
|
||||
test => qr/^[a-zA-Z][\w:\-]*$/,
|
||||
msgFail => 'Bad attribute name',
|
||||
},
|
||||
failedLoginNumber => $integer,
|
||||
|
|
|
@ -80,8 +80,8 @@ sub extractFormInfo {
|
|||
# 3. Verify that certificate is WebID compliant
|
||||
# NB: WebID URI is used as user field
|
||||
eval {
|
||||
$self->{webid} = Web::ID->new( certificate => $ENV{SSL_CLIENT_CERT} )
|
||||
and $self->{user} = $self->{webid}->uri->as_string;
|
||||
$self->{_webid} = Web::ID->new( certificate => $ENV{SSL_CLIENT_CERT} )
|
||||
and $self->{user} = $self->{_webid}->uri->as_string;
|
||||
};
|
||||
return PE_BADCERTIFICATE if ( $@ or not( $self->{user} ) );
|
||||
|
||||
|
@ -89,7 +89,7 @@ sub extractFormInfo {
|
|||
return PE_BADPARTNER unless ( $self->{user} =~ $reWebIDWhitelist );
|
||||
|
||||
# 5. Verify FOAF document
|
||||
return PE_BADCREDENTIALS unless ( $self->{webid}->valid() );
|
||||
return PE_BADCREDENTIALS unless ( $self->{_webid}->valid() );
|
||||
|
||||
# 6. OK, access granted
|
||||
return PE_OK;
|
||||
|
|
|
@ -40,7 +40,24 @@ sub getUser {
|
|||
sub setSessionInfo {
|
||||
my $self = shift;
|
||||
|
||||
# TODO
|
||||
unless ( $self->{_webid} ) {
|
||||
$self->lmLog( 'No webid object found', 'error' );
|
||||
return PE_ERROR;
|
||||
}
|
||||
|
||||
while ( my ( $k, $v ) = each %{ $self->{exportedVars} } ) {
|
||||
my $attr = $k;
|
||||
my $req;
|
||||
$attr =~ s/^!// and $req = 1;
|
||||
eval { $self->{sessionInfo}->{$attr} = $self->{_webid}->get($v) };
|
||||
$self->lmLog( "Unable to get $v from FOAF document: $@", 'error' )
|
||||
if ($@);
|
||||
if ( $req and not $self->{sessionInfo}->{$attr} ) {
|
||||
$self->_sub( 'userNotice',
|
||||
"Required attribute $v is missing (user: $self->{user})" );
|
||||
return PE_MISSINGREQATTR;
|
||||
}
|
||||
}
|
||||
PE_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user