SAML Complex XML Attributes
Summary
We need a way to get complex XML Attributes the XML Dump is as follow.
Default attribute return from lasso:
{
'content' => '12345678-1234-1234-1234-123456789012',
'xmlns:saml' => 'urn:oasis:names:tc:SAML:2.0:assertion',
'xmlns:ns1' => 'http://www.w3.org/2001/XMLSchema-instance',
'ns1:type' => 'xs:string'
}
And Complex XML gives this back
{
'IdentityInfo' => {
'Username' => 'xyz',
'Identity' => '12345678-1234-1234-1234-123456789012',
'IdentityType' => 'urn:fin.be.ch:nameid:1.0:other-type',
'IdentityTypeExtended' => 'urn:oasis:names:tc:SAML:1.0:am:password'
},
'xmlns:saml' => 'urn:oasis:names:tc:SAML:2.0:assertion'
}
Design proposition
Currently solved this way:
foreach (@attr_values) {
my $xs = XML::Simple->new();
my $data = $xs->XMLin( $_->dump() );
my $content = $data->{content};
if ($content) {
$value .= $content . $self->conf->{multiValuesSeparator}
if $content;
} else {
$content = $data->{IdentityInfo}->{Username};
$value .= $content . $self->conf->{multiValuesSeparator}
if $content;
}
}
I think it would be a good way to solve it as a $attr_name extend with multiValuesSeparator and if they are there something like this should happen
Example for my IdentityInfo
$attr_name = "http://xyz.xyz.kt.ch/speciallogin/special/identityInfo;IdentityInfo;Username;"
All Separated with ; will be in $value1 = IdentityInfo and $value2 = Username
$content = $data->{$value1}->{$value2};
I'm not a experienced Perl developer so this was the way i can get the data whe need.