UserDBWebID seems to be finished
This commit is contained in:
parent
8b56492342
commit
61e68ae5d8
|
@ -1458,7 +1458,7 @@ sub testStruct {
|
||||||
exportedVars => {
|
exportedVars => {
|
||||||
keyTest => qr/^!?[a-zA-Z][\w-]*$/,
|
keyTest => qr/^!?[a-zA-Z][\w-]*$/,
|
||||||
keyMsgFail => 'Bad variable name',
|
keyMsgFail => 'Bad variable name',
|
||||||
test => qr/^[a-zA-Z][\w-]*$/,
|
test => qr/^[a-zA-Z][\w:\-]*$/,
|
||||||
msgFail => 'Bad attribute name',
|
msgFail => 'Bad attribute name',
|
||||||
},
|
},
|
||||||
failedLoginNumber => $integer,
|
failedLoginNumber => $integer,
|
||||||
|
|
|
@ -80,8 +80,8 @@ sub extractFormInfo {
|
||||||
# 3. Verify that certificate is WebID compliant
|
# 3. Verify that certificate is WebID compliant
|
||||||
# NB: WebID URI is used as user field
|
# NB: WebID URI is used as user field
|
||||||
eval {
|
eval {
|
||||||
$self->{webid} = Web::ID->new( certificate => $ENV{SSL_CLIENT_CERT} )
|
$self->{_webid} = Web::ID->new( certificate => $ENV{SSL_CLIENT_CERT} )
|
||||||
and $self->{user} = $self->{webid}->uri->as_string;
|
and $self->{user} = $self->{_webid}->uri->as_string;
|
||||||
};
|
};
|
||||||
return PE_BADCERTIFICATE if ( $@ or not( $self->{user} ) );
|
return PE_BADCERTIFICATE if ( $@ or not( $self->{user} ) );
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ sub extractFormInfo {
|
||||||
return PE_BADPARTNER unless ( $self->{user} =~ $reWebIDWhitelist );
|
return PE_BADPARTNER unless ( $self->{user} =~ $reWebIDWhitelist );
|
||||||
|
|
||||||
# 5. Verify FOAF document
|
# 5. Verify FOAF document
|
||||||
return PE_BADCREDENTIALS unless ( $self->{webid}->valid() );
|
return PE_BADCREDENTIALS unless ( $self->{_webid}->valid() );
|
||||||
|
|
||||||
# 6. OK, access granted
|
# 6. OK, access granted
|
||||||
return PE_OK;
|
return PE_OK;
|
||||||
|
|
|
@ -40,7 +40,24 @@ sub getUser {
|
||||||
sub setSessionInfo {
|
sub setSessionInfo {
|
||||||
my $self = shift;
|
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;
|
PE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user