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
c10ccf73
Commit
c10ccf73
authored
6 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
use user authentication to filter SPs attached to the same organization as its IdP
parent
5d0eae68
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/AccountManager/App.pm
+25
-11
25 additions, 11 deletions
lib/AccountManager/App.pm
templates/web/edugain/select_sp.tt2.html
+10
-14
10 additions, 14 deletions
templates/web/edugain/select_sp.tt2.html
templates/web/renater/select_sp.tt2.html
+11
-14
11 additions, 14 deletions
templates/web/renater/select_sp.tt2.html
with
46 additions
and
39 deletions
lib/AccountManager/App.pm
+
25
−
11
View file @
c10ccf73
...
...
@@ -202,6 +202,8 @@ sub respond {
$theme_templates_dir
:
$default_templates_dir
;
$
Template::Stash::
PRIVATE
=
undef
;
my
$tt2
=
Template
->
new
({
ENCODING
=>
'
utf8
',
PRE_CHOMP
=>
CHOMP_ONE
,
...
...
@@ -255,7 +257,7 @@ sub req_select_sp {
my
@federations
=
split
(
/, */
,
$self
->
{
configuration
}
->
{
federations
}
->
{
list
});
my
%
federation
s
;
my
%
group
s
;
my
@self_entities
;
foreach
my
$federation
(
@federations
)
{
my
$file
=
$self
->
get_metadata_file
(
federation
=>
$federation
);
...
...
@@ -272,9 +274,15 @@ sub req_select_sp {
)
if
$EVAL_ERROR
;
my
$entities
=
$metadata
->
parse
(
type
=>
'
sp
');
$
federation
s
{
$federation
}
=
{
$
group
s
{
$federation
}
=
{
label
=>
$self
->
{
configuration
}
->
{
$federation
}
->
{
label
},
entities
=>
$entities
entities
=>
[
map
{
{
id
=>
$_
->
{
entityid
},
name
=>
$_
->
{
display_name
},
federation
=>
$federation
}
}
@$entities
]
};
# if user is authenticated, and its IdP is found in metadata,
...
...
@@ -283,13 +291,19 @@ sub req_select_sp {
my
$idps
=
$metadata
->
parse
(
id
=>
$ENV
{
HTTP_SHIB_IDENTITY_PROVIDER
});
my
$idp
=
$idps
->
[
0
];
if
(
$idp
)
{
$self
->
{
logger
}
->
debugf
(
"
idp %s found in federation %s metadata
",
$ENV
{
HTTP_SHIB_IDENTITY_PROVIDER
},
$federation
);
my
$organization
=
$idp
->
{
organization
};
$self
->
{
logger
}
->
debugf
(
"
idp %s found in federation %s metadata with organization %s
",
$ENV
{
HTTP_SHIB_IDENTITY_PROVIDER
},
$federation
,
$organization
);
push
@self_entities
,
map
{
{
id
=>
$_
->
{
entityid
},
name
=>
$_
->
{
display_name
},
federation
=>
$federation
}
}
grep
{
$_
->
{
organization
}
eq
$organization
}
@$entities
;
}
...
...
@@ -297,7 +311,7 @@ sub req_select_sp {
}
if
(
@self_entities
)
{
$
federation
s
{
self
}
=
{
$
group
s
{
_
self
}
=
{
label
=>
$self
->
{
lh
}
->
maketext
("
My organization
"),
entities
=>
\
@self_entities
,
};
...
...
@@ -306,8 +320,8 @@ sub req_select_sp {
$self
->
respond
(
template
=>
'
select_sp.tt2.html
',
data
=>
{
action
=>
'
select_sp
',
federations
=>
\
%federation
s
,
action
=>
'
select_sp
',
groups
=>
\
%group
s
,
}
);
}
...
...
This diff is collapsed.
Click to expand it.
templates/web/edugain/select_sp.tt2.html
+
10
−
14
View file @
c10ccf73
...
...
@@ -15,13 +15,13 @@
[% lh.maketext("You must be an administrator of that service to continue afterwards.") %]
</p>
[% FOREACH
federation IN federation
s.keys.sort() %]
[% FOREACH
group IN group
s.keys.sort() %]
<fieldset>
<label
for=
"[%
federation %]_entityid"
>
[% federations.$federation
.label %]
</label>
<select
id=
"[%
federation %]_entityid"
name=
"[% federation %]_entityid
"
>
<label
for=
"[%
group %]"
>
[% groups.$group
.label %]
</label>
<select
id=
"[%
group %]"
name=
"[% group %]
"
>
<option
value=
""
></option>
[% FOREACH entity IN
federations.$federation
.entities.sort('
display_
name') %]
<option
value=
"[% entity.
entityid
%]"
>
[% entity.
display_
name %]
</option>
[% FOREACH entity IN
groups.$group
.entities.sort('name') %]
<option
value=
"[% entity.
id %]"
data-federation=
"[% entity.federation
%]"
>
[% entity.name %]
</option>
[% END %]
</select>
</fieldset>
...
...
@@ -80,17 +80,13 @@ $( document ).ready(function() {
item
:
ui
.
item
.
option
});
// retrieve federation and entityid
var
id
=
this
.
element
.
attr
(
'
id
'
);
var
id_parts
=
id
.
split
(
'
_
'
);
var
federation
=
id_parts
[
0
];
var
entity
=
this
.
element
.
val
();
// reset other comboboxes
$
(
"
input[id!='
"
+
id
+
"
_combobox']
"
).
val
(
""
);
$
(
"
select[id!='
"
+
id
+
"
'] option:selected
"
).
prop
(
'
selected
'
,
false
);
// set federation
// retrieve federation and entityid
var
entity
=
this
.
element
.
val
();
var
federation
=
this
.
element
.
find
(
'
option:selected
'
).
attr
(
'
data-federation
'
);
$
(
"
#federation
"
).
val
(
federation
);
$
(
"
#entityid
"
).
val
(
entity
);
},
...
...
@@ -186,8 +182,8 @@ $( document ).ready(function() {
}
});
[
%
FOREACH
federation
IN
federation
s
.
keys
()
%
]
$
(
"
#[%
federation %]_entityid
"
).
combobox
();
[
%
FOREACH
group
IN
group
s
.
keys
()
%
]
$
(
"
#[%
group %]
"
).
combobox
();
[
%
END
%
]
$
.
validator
.
messages
.
required
=
"
[% lh.maketext(
"
This
information
is
required
"
) %]
"
;
...
...
This diff is collapsed.
Click to expand it.
templates/web/renater/select_sp.tt2.html
+
11
−
14
View file @
c10ccf73
...
...
@@ -15,13 +15,13 @@
[% lh.maketext("You must be an administrator of that service to continue afterwards.") %]
</p>
[% FOREACH
federation IN federation
s.keys.sort() %]
[% FOREACH
group IN group
s.keys.sort() %]
<fieldset>
<label
for=
"[%
federation %]_entityid"
>
[% federations.$federation
.label %]
</label>
<select
id=
"[%
federation %]_entityid"
name=
"[% federation %]_entityid
"
>
<label
for=
"[%
group %]"
>
[% groups.$group
.label %]
</label>
<select
id=
"[%
group %]"
name=
"[% group %]
"
>
<option
value=
""
></option>
[% FOREACH entity IN
federations.$federation
.entities.sort('
display_
name') %]
<option
value=
"[% entity.
entityid
%]"
>
[% entity.
display_
name %]
</option>
[% FOREACH entity IN
groups.$group
.entities.sort('name') %]
<option
value=
"[% entity.
id %]"
data-federation=
"[% entity.federation
%]"
>
[% entity.name %]
</option>
[% END %]
</select>
</fieldset>
...
...
@@ -80,17 +80,14 @@ $( document ).ready(function() {
item
:
ui
.
item
.
option
});
// retrieve federation and entityid
var
id
=
this
.
element
.
attr
(
'
id
'
);
var
id_parts
=
id
.
split
(
'
_
'
);
var
federation
=
id_parts
[
0
];
var
entity
=
this
.
element
.
val
();
// reset other comboboxes
var
id
=
this
.
element
.
attr
(
'
id
'
);
$
(
"
input[id!='
"
+
id
+
"
_combobox']
"
).
val
(
""
);
$
(
"
select[id!='
"
+
id
+
"
'] option:selected
"
).
prop
(
'
selected
'
,
false
);
// set federation
// retrieve federation and entityid
var
entity
=
this
.
element
.
val
();
var
federation
=
this
.
element
.
find
(
'
option:selected
'
).
attr
(
'
data-federation
'
);
$
(
"
#federation
"
).
val
(
federation
);
$
(
"
#entityid
"
).
val
(
entity
);
},
...
...
@@ -186,8 +183,8 @@ $( document ).ready(function() {
}
});
[
%
FOREACH
federation
IN
federation
s
.
keys
()
%
]
$
(
"
#[%
federation %]_entityid
"
).
combobox
();
[
%
FOREACH
group
IN
group
s
.
keys
()
%
]
$
(
"
#[%
group %]
"
).
combobox
();
[
%
END
%
]
$
.
validator
.
messages
.
required
=
"
[% lh.maketext(
"
This
information
is
required
"
) %]
"
;
...
...
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