Auth::CAS manager part (#1183)

This commit is contained in:
Xavier Guimard 2017-04-12 19:49:26 +00:00
parent 9a0a56b5fd
commit 97e124e997
4 changed files with 26 additions and 28 deletions

View File

@ -451,14 +451,14 @@ sub _casMetaDataNodes {
my ( $self, $type, $req, @path ) = @_; my ( $self, $type, $req, @path ) = @_;
my $refKey = my $refKey =
( $type eq 'App' ? 'casAppMetaDataOptions' : 'casSrvMetaDataOptions' ); ( $type eq 'App' ? 'casAppMetaDataOptions' : 'casSrvMetaDataOptions' );
return $self->complexNodesRoot( $req, $refKey, "oidc${type}MetaDataNode" ) return $self->complexNodesRoot( $req, $refKey, "cas${type}MetaDataNode" )
unless (@path); unless (@path);
my $partner = shift @path; my $partner = shift @path;
my $query = shift @path; my $query = shift @path;
unless ($query) { unless ($query) {
return $self->sendError( $req, return $self->sendError( $req,
"Bad request: oidc${type}MetaDataNode query must ask for a key", "Bad request: cas${type}MetaDataNode query must ask for a key",
400 ); 400 );
} }
@ -495,12 +495,12 @@ sub _casMetaDataNodes {
sub casSrvMetaDataNodes { sub casSrvMetaDataNodes {
my ( $self, $req, @path ) = @_; my ( $self, $req, @path ) = @_;
return $self->_oidcMetaDataNodes( 'Srv', $req, @path ); return $self->_casMetaDataNodes( 'Srv', $req, @path );
} }
sub casAppMetaDataNodes { sub casAppMetaDataNodes {
my ( $self, $req, @path ) = @_; my ( $self, $req, @path ) = @_;
return $self->_oidcMetaDataNodes( 'App', $req, @path ); return $self->_casMetaDataNodes( 'App', $req, @path );
} }
# 32 - Other special nodes # 32 - Other special nodes

View File

@ -632,15 +632,14 @@ sub attributes {
'mail' => 'mail', 'mail' => 'mail',
'uid' => 'uid' 'uid' => 'uid'
}, },
'keyMsgFail' => '__badVariableName__', 'type' => 'keyTextContainer'
'keyTest' => qr/^!?[a-zA-Z][a-zA-Z0-9_-]*$/,
'msgFail' => '__badValue__',
'test' => qr/^[a-zA-Z][a-zA-Z0-9_:\-]*$/,
'type' => 'keyTextContainer'
}, },
'casAppMetaDataNodes' => { 'casAppMetaDataNodes' => {
'type' => 'casAppMetaDataNodeContainer' 'type' => 'casAppMetaDataNodeContainer'
}, },
'casAppMetaDataOptions' => {
'type' => 'subContainer'
},
'casAttr' => { 'casAttr' => {
'type' => 'text' 'type' => 'text'
}, },
@ -657,11 +656,7 @@ sub attributes {
'mail' => 'mail', 'mail' => 'mail',
'uid' => 'uid' 'uid' => 'uid'
}, },
'keyMsgFail' => '__badVariableName__', 'type' => 'keyTextContainer'
'keyTest' => qr/^!?[a-zA-Z][a-zA-Z0-9_-]*$/,
'msgFail' => '__badValue__',
'test' => qr/^[a-zA-Z][a-zA-Z0-9_:\-]*$/,
'type' => 'keyTextContainer'
}, },
'casSrvMetaDataNodes' => { 'casSrvMetaDataNodes' => {
'type' => 'casSrvMetaDataNodeContainer' 'type' => 'casSrvMetaDataNodeContainer'

View File

@ -2060,10 +2060,6 @@ m{^(?:ldapi://[^/]*/?|\w[\w\-\.]*(?::\d{1,5})?|ldap(?:s|\+tls)?://\w[\w\-\.]*(?:
}, },
casSrvMetaDataExportedVars => { casSrvMetaDataExportedVars => {
type => 'keyTextContainer', type => 'keyTextContainer',
keyTest => qr/^!?[a-zA-Z][a-zA-Z0-9_-]*$/,
keyMsgFail => '__badVariableName__',
test => qr/^[a-zA-Z][a-zA-Z0-9_:\-]*$/,
msgFail => '__badValue__',
default => { cn => 'cn', mail => 'mail', uid => 'uid', }, default => { cn => 'cn', mail => 'mail', uid => 'uid', },
documentation => 'CAS exported variables', documentation => 'CAS exported variables',
}, },
@ -2081,12 +2077,9 @@ m{^(?:ldapi://[^/]*/?|\w[\w\-\.]*(?::\d{1,5})?|ldap(?:s|\+tls)?://\w[\w\-\.]*(?:
msgFail => '__badUrl__', msgFail => '__badUrl__',
}, },
casAppMetaDataOptions => { type => 'subContainer', },
casAppMetaDataExportedVars => { casAppMetaDataExportedVars => {
type => 'keyTextContainer', type => 'keyTextContainer',
keyTest => qr/^!?[a-zA-Z][a-zA-Z0-9_-]*$/,
keyMsgFail => '__badVariableName__',
test => qr/^[a-zA-Z][a-zA-Z0-9_:\-]*$/,
msgFail => '__badValue__',
default => { cn => 'cn', mail => 'mail', uid => 'uid', }, default => { cn => 'cn', mail => 'mail', uid => 'uid', },
documentation => 'CAS exported variables', documentation => 'CAS exported variables',
}, },

View File

@ -453,17 +453,27 @@ sub _scanNodes {
$self->_scanNodes($subNodes); $self->_scanNodes($subNodes);
} }
} }
elsif ( $target =~ elsif ( $target =~ /^cas(?:Srv|App)MetaDataOptions/ ) {
/^(?:$casSrvMetaDataNodeKeys|$casAppMetaDataNodeKeys)/o ) my $optKey = $&;
{ hdebug " $base sub key: $target";
$self->set( $optKey, [ $oldName, $key ], if ( $target =~
$target, $leaf->{data} ); /^(?:$casSrvMetaDataNodeKeys|$casAppMetaDataNodeKeys)/o )
{
$self->set( $optKey, [ $oldName, $key ],
$target, $leaf->{data} );
}
else {
push @{ $self->errors },
{ message => "Unknown CAS metadata option $target" };
return 0;
}
} }
else { else {
push @{ $self->errors }, push @{ $self->errors },
{ message => "Unknown OIDC metadata option $target" }; { message => "Unknown CAS option $target" };
return 0; return 0;
} }
next;
} }
else { else {
push @{ $self->errors }, push @{ $self->errors },