Commit 0e2ab107 authored by Thomas Chemineau's avatar Thomas Chemineau
Browse files

move nodes into structure of manager, so that saml nodes are directly under the root node

parent 4c5d2861
......@@ -48,34 +48,31 @@ sub setDebug {
# @param string key The key into the manager struct
sub buildIDPStruct {
my ( $h, $k ) = @_;
if ($k =~ /saml\/samlIDPMetaData/i && ref($h))
{
my @_tmp = split(/\//, $k);
if (scalar @_tmp ge 3)
{
my $k2 = $_tmp[2];
%{$h->{saml}->{samlIDPMetaData}} = (
%{$h->{saml}->{samlIDPMetaData}},
$k2 => {
return $h
unless (ref($h));
my @keys = split(/\//, $k);
return $h
unless (scalar @keys ge 2);
%{$h->{samlIDPMetaData}} = (
%{$h->{samlIDPMetaData}},
$keys[1] => {
_nodes => [
qw(samlIDPMetaDataXML
samlIDPMetaDataExportedAttributes)
],
samlIDPMetaDataXML =>
'samlmetadata:/samlIDPMetaData/' . $k2
'samlmetadata:/samlIDPMetaData/' . $keys[1]
. '/samlIDPMetaDataXML:samlIDPMetaDataXML:textarea',
samlIDPMetaDataExportedAttributes =>
'text:/samlIDPMetaData/' . $k2
'text:/samlIDPMetaData/' . $keys[1]
. '/samlIDPMetaDataExportedAttributes'
. ':samlIDPMetaDataExportedAttributes:text',
}
);
@{$h->{saml}->{samlIDPMetaData}->{_nodes}} = (
@{$h->{saml}->{samlIDPMetaData}->{_nodes}},
'n:' . $_tmp[2]
@{$h->{samlIDPMetaData}->{_nodes}} = (
@{$h->{samlIDPMetaData}->{_nodes}},
'n:' . $keys[1]
);
}
}
return $h;
}
......
......@@ -268,7 +268,7 @@ function samlAssertion(id) {
}
function samlIDP(id){
currentId=id;
if($('#li_'+myB64('saml/samlIDPMetaData')).find('span').size()==1){
if($('#li_'+myB64('/samlIDPMetaData')).find('span').size()==1){
$('#delsamlidpb').hide();
}else{
$('#delsamlidpb').show();
......@@ -403,8 +403,8 @@ function delSamlIDP(id){
function newSamlIDP(){
var value = prompt(text4newSamlIDP,'authentic');
if(!value){return false;}
var idpId='li_'+myB64('/saml/samlIDPMetaData/'+value);
simpleTreeCollection[0].newAjaxNodeIn($('#li_c2FtbC9zYW1sSURQTWV0YURhdGE1'),idpId,value,scriptname+'?type=new&node=saml/samlIDPMetaData/'+value,function(d,s){
var idpId='li_'+myB64('/samlIDPMetaData/'+value);
simpleTreeCollection[0].newAjaxNodeIn($('#li_c2FtbC9zYW1sSURQTWV0YURhdGE1'),idpId,value,scriptname+'?type=new&node=samlIDPMetaData/'+value,function(d,s){
$('>span',s).attr('name',value).attr('help','default').attr('id','text_'+idpId).attr('onclick','samlIDP(\''+idpId+'\')');
samlIDP(idpId);
});
......
......@@ -193,11 +193,12 @@ sub confNode {
my $text = $target;
$text =~ s/^.*\///;
my $id = "$target";
my $data = $metadata->toXML();
$res .= $self->li($id)
. $self->span(
id => $id,
text => $text,
data => $metadata->toXML(),
data => $data,
js => $js,
help => $help
) . "</li>";
......@@ -301,7 +302,7 @@ sub corresp {
return $h unless ($key);
if ( my $k2 = $self->param('key') ) {
# SAML identity providers
if ($key =~ /^saml\/samlIDPMetaData/i) {
if ($key =~ /^samlIDPMetaData/i) {
$h = Lemonldap::NG::Common::Conf::SAML::Metadata::buildIDPStruct($h, $key);
# Virtual hosts
} else {
......
......@@ -44,7 +44,7 @@ sub cstruct {
sub struct {
my $self = shift;
return {
_nodes => [qw(n:generalParameters n:variables n:virtualHosts n:saml)],
_nodes => [qw(n:generalParameters n:variables n:virtualHosts n:samlServiceMetaData n:samlIDPMetaData)],
_help => 'default',
######################
......@@ -243,10 +243,6 @@ sub struct {
########
# SAML #
########
saml => {
_nodes => [qw(samlServicePrivateKey n:samlServiceMetaData n:samlIDPMetaData)],
_help => 'saml',
samlIDPMetaData => {
_nodes => ['nhash:/samlIDPMetaData:samlIDPMetaData:samlIDP'],
_help => 'default',
......@@ -256,6 +252,7 @@ sub struct {
samlServiceMetaData => {
_nodes => [
qw(samlEntityID
samlServicePrivateKey
n:samlOrganization
n:samlSPSSODescriptor
n:samlIDPSSODescriptor)
......@@ -264,6 +261,8 @@ sub struct {
# GLOBAL INFORMATIONS
samlEntityID => 'text:/samlEntityID',
samlServicePrivateKey =>
'textarea:/samlServicePrivateKey:samlServicePrivateKey:textarea',
samlOrganization => {
_nodes => [
qw(samlOrganizationDisplayName
......@@ -421,9 +420,6 @@ sub struct {
},
},
},
samlServicePrivateKey =>
'textarea:/samlServicePrivateKey:samlServicePrivateKey:textarea',
},
};
}
......@@ -663,6 +659,9 @@ sub testStruct {
########
# SAML #
########
samlIDPMetaData => $testNotDefined,
samlIDPMetaDataXML => $testNotDefined,
samlIDPMetaDataExportedAttributes => $testNotDefined,
samlServicePrivateKey => $testNotDefined,
samlEntityID => $testNotDefined,
samlOrganizationDisplayName => $testNotDefined,
......@@ -746,6 +745,9 @@ sub defaultConf {
########
# SAML #
########
samlIDPMetaData => '',
samlIDPMetaDataXML => '',
samlIDPMetaDataExportedAttributes => '',
samlServicePrivateKey => '',
samlEntityID => 'http://auth.example.com/saml/metadata',
samlOrganizationDisplayName => 'Example',
......
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