Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Access Check - Account manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN Access Check - Account manager
Commits
372350a0
Commit
372350a0
authored
7 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
shorter variable names
parent
41ea869a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/IdPAccountManager/SAMLMetadata.pm
+28
-28
28 additions, 28 deletions
lib/IdPAccountManager/SAMLMetadata.pm
with
28 additions
and
28 deletions
lib/IdPAccountManager/SAMLMetadata.pm
+
28
−
28
View file @
372350a0
...
@@ -39,23 +39,23 @@ sub new {
...
@@ -39,23 +39,23 @@ sub new {
sub
parse
{
sub
parse
{
my
(
$self
,
%args
)
=
@_
;
my
(
$self
,
%args
)
=
@_
;
my
@
extracted_
array
;
my
@array
;
foreach
my
$EntityDescriptor
(
foreach
my
$EntityDescriptor
(
@
{
$self
->
{
doc
}
->
getElementsByLocalName
('
EntityDescriptor
')
})
@
{
$self
->
{
doc
}
->
getElementsByLocalName
('
EntityDescriptor
')
})
{
{
my
$
extracted_
data
=
{};
my
$data
=
{};
if
(
$EntityDescriptor
->
hasAttributes
())
{
if
(
$EntityDescriptor
->
hasAttributes
())
{
foreach
my
$attr
(
$EntityDescriptor
->
getAttribute
('
entityID
'))
{
foreach
my
$attr
(
$EntityDescriptor
->
getAttribute
('
entityID
'))
{
$
extracted_
data
->
{
entityid
}
=
$attr
;
$data
->
{
entityid
}
=
$attr
;
}
}
}
}
next
if
(
$args
{
entity_id
}
next
if
(
$args
{
entity_id
}
&&
(
$args
{
entity_id
}
ne
$
extracted_
data
->
{
entityid
}));
&&
(
$args
{
entity_id
}
ne
$data
->
{
entityid
}));
$
extracted_
data
->
{
xml_md
}
=
$data
->
{
xml_md
}
=
IdPAccountManager::Tools::
escape_xml
(
$EntityDescriptor
->
toString
());
IdPAccountManager::Tools::
escape_xml
(
$EntityDescriptor
->
toString
());
foreach
my
$child
(
$EntityDescriptor
->
childNodes
())
{
foreach
my
$child
(
$EntityDescriptor
->
childNodes
())
{
...
@@ -65,7 +65,7 @@ sub parse {
...
@@ -65,7 +65,7 @@ sub parse {
if
(
$child
->
nodeName
=~
/IDPSSODescriptor$/
)
{
if
(
$child
->
nodeName
=~
/IDPSSODescriptor$/
)
{
$
extracted_
data
->
{
type
}
=
'
idp
';
$data
->
{
type
}
=
'
idp
';
foreach
my
$sso
(
foreach
my
$sso
(
$child
->
getElementsByLocalName
('
SingleSignOnService
'))
$child
->
getElementsByLocalName
('
SingleSignOnService
'))
...
@@ -75,7 +75,7 @@ sub parse {
...
@@ -75,7 +75,7 @@ sub parse {
#next unless ($sso->getAttribute('Binding') && defined $supported_saml_bindings{$sso->getAttribute('Binding')});
#next unless ($sso->getAttribute('Binding') && defined $supported_saml_bindings{$sso->getAttribute('Binding')});
## On extrait les infos sur les endpoints
## On extrait les infos sur les endpoints
push
@
{
$
extracted_
data
->
{
idp_endpoints
}
},
{
push
@
{
$data
->
{
idp_endpoints
}
},
{
type
=>
'
SingleSignOnService
',
type
=>
'
SingleSignOnService
',
binding
=>
$sso
->
getAttribute
('
Binding
'),
binding
=>
$sso
->
getAttribute
('
Binding
'),
location
=>
$sso
->
getAttribute
('
Location
'),
location
=>
$sso
->
getAttribute
('
Location
'),
...
@@ -85,12 +85,12 @@ sub parse {
...
@@ -85,12 +85,12 @@ sub parse {
## Getting domains declared for scoped attributes
## Getting domains declared for scoped attributes
foreach
my
$scope
(
$child
->
getElementsByLocalName
('
Scope
'))
{
foreach
my
$scope
(
$child
->
getElementsByLocalName
('
Scope
'))
{
push
@
{
$
extracted_
data
->
{
domain
}
},
$scope
->
textContent
();
push
@
{
$data
->
{
domain
}
},
$scope
->
textContent
();
}
}
}
elsif
(
$child
->
nodeName
=~
/SPSSODescriptor$/
)
{
}
elsif
(
$child
->
nodeName
=~
/SPSSODescriptor$/
)
{
$
extracted_
data
->
{
type
}
=
'
sp
';
$data
->
{
type
}
=
'
sp
';
## We check the Binding of the ACS that should match "urn:oasis:names:tc:SAML:1.0:profiles:browser-post"
## We check the Binding of the ACS that should match "urn:oasis:names:tc:SAML:1.0:profiles:browser-post"
## We also check the index to select the ACS that has the lower index
## We also check the index to select the ACS that has the lower index
...
@@ -100,7 +100,7 @@ sub parse {
...
@@ -100,7 +100,7 @@ sub parse {
{
{
## Extracting endpoints information
## Extracting endpoints information
push
@
{
$
extracted_
data
->
{
sp_endpoints
}
},
{
push
@
{
$data
->
{
sp_endpoints
}
},
{
type
=>
'
AssertionConsumerService
',
type
=>
'
AssertionConsumerService
',
binding
=>
$sso
->
getAttribute
('
Binding
'),
binding
=>
$sso
->
getAttribute
('
Binding
'),
location
=>
$sso
->
getAttribute
('
Location
'),
location
=>
$sso
->
getAttribute
('
Location
'),
...
@@ -117,7 +117,7 @@ sub parse {
...
@@ -117,7 +117,7 @@ sub parse {
{
{
## Requested attributes information
## Requested attributes information
push
@
{
$
extracted_
data
->
{
requested_attribute
}
},
push
@
{
$data
->
{
requested_attribute
}
},
{
{
'
friendly_name
'
=>
'
friendly_name
'
=>
IdPAccountManager::Tools::
encode_utf8
(
IdPAccountManager::Tools::
encode_utf8
(
...
@@ -139,10 +139,10 @@ sub parse {
...
@@ -139,10 +139,10 @@ sub parse {
$child
->
getElementsByLocalName
('
RegistrationInfo
'))
$child
->
getElementsByLocalName
('
RegistrationInfo
'))
{
{
$
extracted_
data
->
{
registration_info
}
$data
->
{
registration_info
}
{
registration_authority
}
=
{
registration_authority
}
=
$registrationinfo
->
getAttribute
('
registrationAuthority
');
$registrationinfo
->
getAttribute
('
registrationAuthority
');
$
extracted_
data
->
{
registration_info
}
$data
->
{
registration_info
}
{
registration_instant
}
=
{
registration_instant
}
=
$registrationinfo
->
getAttribute
('
registrationInstant
');
$registrationinfo
->
getAttribute
('
registrationInstant
');
foreach
my
$registrationpolicy
(
foreach
my
$registrationpolicy
(
...
@@ -151,7 +151,7 @@ sub parse {
...
@@ -151,7 +151,7 @@ sub parse {
)
)
{
{
if
(
$registrationpolicy
->
getAttribute
('
lang
')
eq
'
en
')
{
if
(
$registrationpolicy
->
getAttribute
('
lang
')
eq
'
en
')
{
$
extracted_
data
->
{
registration_info
}
$data
->
{
registration_info
}
{
registration_policy
}
=
{
registration_policy
}
=
IdPAccountManager::Tools::
encode_utf8
(
IdPAccountManager::Tools::
encode_utf8
(
$registrationpolicy
->
textContent
());
$registrationpolicy
->
textContent
());
...
@@ -167,7 +167,7 @@ sub parse {
...
@@ -167,7 +167,7 @@ sub parse {
IdPAccountManager::Tools::
encode_utf8
(
IdPAccountManager::Tools::
encode_utf8
(
$contact_child
->
textContent
());
$contact_child
->
textContent
());
}
}
push
@
{
$
extracted_
data
->
{
contacts
}
},
\
%contact_details
;
push
@
{
$data
->
{
contacts
}
},
\
%contact_details
;
}
}
}
}
...
@@ -175,7 +175,7 @@ sub parse {
...
@@ -175,7 +175,7 @@ sub parse {
my
$displayname
(
$child
->
getElementsByLocalName
('
DisplayName
'))
my
$displayname
(
$child
->
getElementsByLocalName
('
DisplayName
'))
{
{
$
extracted_
data
->
{
display_name
}
$data
->
{
display_name
}
{
$displayname
->
getAttribute
('
xml:lang
')
}
=
{
$displayname
->
getAttribute
('
xml:lang
')
}
=
IdPAccountManager::Tools::
encode_utf8
(
IdPAccountManager::Tools::
encode_utf8
(
$displayname
->
textContent
());
$displayname
->
textContent
());
...
@@ -183,10 +183,10 @@ sub parse {
...
@@ -183,10 +183,10 @@ sub parse {
## Set a default displayName in case no English version is provided
## Set a default displayName in case no English version is provided
## However there is no way to determine the native displayName
## However there is no way to determine the native displayName
## We take the first one as default
## We take the first one as default
if
(
!
$
extracted_
data
->
{
default_display_name
}
if
(
!
$data
->
{
default_display_name
}
||
$displayname
->
getAttribute
('
xml:lang
'))
||
$displayname
->
getAttribute
('
xml:lang
'))
{
{
$
extracted_
data
->
{
default_display_name
}
=
$data
->
{
default_display_name
}
=
IdPAccountManager::Tools::
encode_utf8
(
IdPAccountManager::Tools::
encode_utf8
(
$displayname
->
textContent
());
$displayname
->
textContent
());
}
}
...
@@ -197,7 +197,7 @@ sub parse {
...
@@ -197,7 +197,7 @@ sub parse {
my
$description
(
$child
->
getElementsByLocalName
('
Description
'))
my
$description
(
$child
->
getElementsByLocalName
('
Description
'))
{
{
$
extracted_
data
->
{
description
}
$data
->
{
description
}
{
$description
->
getAttribute
('
xml:lang
')
}
=
{
$description
->
getAttribute
('
xml:lang
')
}
=
IdPAccountManager::Tools::
encode_utf8
(
IdPAccountManager::Tools::
encode_utf8
(
$description
->
textContent
());
$description
->
textContent
());
...
@@ -215,20 +215,20 @@ sub parse {
...
@@ -215,20 +215,20 @@ sub parse {
IdPAccountManager::Tools::
encode_utf8
(
IdPAccountManager::Tools::
encode_utf8
(
$contact_child
->
textContent
());
$contact_child
->
textContent
());
}
}
push
@
{
$
extracted_
data
->
{
contacts
}
},
\
%contact_details
;
push
@
{
$data
->
{
contacts
}
},
\
%contact_details
;
}
}
foreach
my
$sso
(
foreach
my
$sso
(
$child
->
getElementsByLocalName
('
OrganizationDisplayName
'))
$child
->
getElementsByLocalName
('
OrganizationDisplayName
'))
{
{
$
extracted_
data
->
{
organization
}
=
$data
->
{
organization
}
=
IdPAccountManager::Tools::
encode_utf8
(
$sso
->
textContent
());
IdPAccountManager::Tools::
encode_utf8
(
$sso
->
textContent
());
}
}
## Getting X.509 certificates
## Getting X.509 certificates
foreach
my
$cert
(
$child
->
getElementsByLocalName
('
X509Certificate
'))
foreach
my
$cert
(
$child
->
getElementsByLocalName
('
X509Certificate
'))
{
{
$
extracted_
data
->
{
certificate
}
=
$data
->
{
certificate
}
=
IdPAccountManager::Tools::
encode_utf8
(
$cert
->
textContent
());
IdPAccountManager::Tools::
encode_utf8
(
$cert
->
textContent
());
}
}
}
}
...
@@ -236,17 +236,17 @@ sub parse {
...
@@ -236,17 +236,17 @@ sub parse {
## Filter entities based on type
## Filter entities based on type
next
next
if
(
defined
$args
{
filter_entity_type
}
if
(
defined
$args
{
filter_entity_type
}
&&
(
$args
{
filter_entity_type
}
ne
$
extracted_
data
->
{
type
}));
&&
(
$args
{
filter_entity_type
}
ne
$data
->
{
type
}));
## Merge domains in a single string
## Merge domains in a single string
my
$domains
=
join
('
,
',
@
{
$
extracted_
data
->
{
domain
}
})
my
$domains
=
join
('
,
',
@
{
$data
->
{
domain
}
})
if
(
$
extracted_
data
->
{
domain
});
if
(
$data
->
{
domain
});
$
extracted_
data
->
{
domain
}
=
$domains
;
$data
->
{
domain
}
=
$domains
;
push
@
extracted_array
,
$extracted_
data
;
push
@
array
,
$
data
;
}
}
return
\
@
extracted_
array
;
return
\
@array
;
}
}
## Dumps the SAML metadata content
## Dumps the SAML metadata content
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment