diff --git a/lib/IdPAccountManager/SAMLMetadata.pm b/lib/IdPAccountManager/SAMLMetadata.pm index 1025ba1530310787256b1a9552e8f41bcae3054d..6426bc0db348743ab739811e25c38a3d98362271 100644 --- a/lib/IdPAccountManager/SAMLMetadata.pm +++ b/lib/IdPAccountManager/SAMLMetadata.pm @@ -98,14 +98,14 @@ sub parse { binding => $sso->getAttribute('Binding'), location => $sso->getAttribute('Location'), index => $sso->getAttribute('index'), - isdefault => IdPAccountManager::Tools::boolean2integer( + isdefault => _boolean2integer( $sso->getAttribute('isDefault') ) }; } - foreach my $requestedattribute ( + foreach my $attribute ( $child->getElementsByLocalName('RequestedAttribute')) { @@ -114,15 +114,14 @@ sub parse { { 'friendly_name' => IdPAccountManager::Tools::encode_utf8( - $requestedattribute->getAttribute('FriendlyName') + $attribute->getAttribute('FriendlyName') ), 'name' => IdPAccountManager::Tools::encode_utf8( - $requestedattribute->getAttribute('Name') + $attribute->getAttribute('Name') ), - 'is_required' => - IdPAccountManager::Tools::boolean2integer( - $requestedattribute->getAttribute('isRequired') - ) + 'is_required' => _boolean2integer( + $attribute->getAttribute('isRequired') + ) }; } @@ -251,6 +250,13 @@ sub print { print $fd $root->toString(); } +sub _boolean2integer { + return + $_[0] eq 'true' ? 1 : + $_[0] eq 'false' ? 0 : + undef; +} + 1; __END__ diff --git a/lib/IdPAccountManager/Tools.pm b/lib/IdPAccountManager/Tools.pm index 7d1dcf662ed72e03b32e730f57d62d0056ad70aa..4af9e280102764b3252f210d2d7ce048fcc23a4f 100644 --- a/lib/IdPAccountManager/Tools.pm +++ b/lib/IdPAccountManager/Tools.pm @@ -211,19 +211,6 @@ sub escape_quotes { return $string; } -## returns an integer (0 or 1), given an input string ('true' or 'false') -sub boolean2integer { - my ($boolean) = @_; - - if ($boolean eq 'true') { - return 1; - } elsif ($boolean eq 'false') { - return 0; - } - - return undef; -} - 1; __END__