Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit a4b60cb

Browse files
author
Dominik František Bučík
authored
Merge pull request #43 from pajavyskocil/fixBugs
Fix bugs
2 parents b36870f + 74660e4 commit a4b60cb

File tree

8 files changed

+110
-26
lines changed

8 files changed

+110
-26
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
5+
[Added]
6+
- Added new atribute in PerunIdentity process filter with list of Services identifier's for which we don't want to show page with information, that the user will be redirected to other page
7+
58
[Changed]
69
- Changed design of ListOfSps
10+
- Changed the texts and visual form of pages: perun_identity_choose_vo_and_group.php and unauthorized_access_go_to_registration.php
11+
12+
[Fixed]
13+
- Fixed resend SPMetadata from request to unauthorized-access-go-to-registration page
14+
- Fixed url encoding in PerunGroups
715

816
## [v2.0.0]
917
[Added]

dictionaries/perun.definition.json

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"choose-vo-and-group-tpl_header": {
3-
"en": "Access forbidden",
4-
"cs": "Přístup odepřen"
2+
"choose-vo-and-group-tpl_header-part1": {
3+
"en": "Access to the service ",
4+
"cs": "Přístup ke službě "
55
},
6-
"choose-vo-and-group-tpl_text": {
7-
"en": "You don't meet the prerequisites for accessing the service: ",
8-
"cs": "Nesplňujete prerekvizity pro přístup ke službě: "
6+
"choose-vo-and-group-tpl_header-part2": {
7+
"en": " has been forbidden",
8+
"cs": " byl zamítnut"
99
},
1010
"choose-vo-and-group-tpl_message": {
1111
"en": "To access the service it is necessary to have a valid membership in one of the following groups. Please proceed with selection of organization and group for registration.",
12-
"cs": "Pro získání přístupu k dané službě je nutné se zaregistrovat do jedné z následujících skupin. Pokračujte výběrem příslušné organizace a skupiny."
12+
"cs": "Pro získání přístupu k dané službě je nutné být členem jedné z následujících skupin. Pokračujte výběrem příslušné organizace a skupiny."
1313
},
1414
"choose-vo-and-group-tpl_select-vo": {
1515
"en": "Select virtual organization for registration: ",
@@ -20,8 +20,20 @@
2020
"cs": "Vyberte skupinu pro registraci: "
2121
},
2222
"choose-vo-and-group-tpl_continue": {
23-
"en": "Continue",
24-
"cs": "Pokračovat"
23+
"en": "Continue to the registration page for selected group",
24+
"cs": "Pokračovat na registrační stránku do vybrané skupiny"
25+
},
26+
"go-to-registration_header1" : {
27+
"en": "Your activity is necessary to access the ",
28+
"cs": "Pro přístup ke službě "
29+
},
30+
"go-to-registration_header2" : {
31+
"en": " service",
32+
"cs": " je vyžadována Vaše aktivita"
33+
},
34+
"go-to-registration_continue" : {
35+
"en": "Continue to a page with additional information",
36+
"cs": "Pokračovat na stránku s doplňujícími informacemi"
2537
},
2638
"disco-tpl_previous-selection": {
2739
"en": "your previous selection",

lib/Auth/Process/PerunGroups.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ public function process(&$request)
7272
if (isset($request["SPMetadata"]["groupNameAARC"]) || $this->groupNameAARC) {
7373
# https://aarc-project.eu/wp-content/uploads/2017/11/AARC-JRA1.4A-201710.pdf
7474
# Group name is URL encoded by RFC 3986 (http://www.ietf.org/rfc/rfc3986.txt)
75-
# Example: urn:geant:einfra.cesnet.cz:perun.cesnet.cz:group:einfra%3A<groupName>%3A<subGroupName>#perun.cesnet.cz
75+
# Example: urn:geant:einfra.cesnet.cz:perun.cesnet.cz:group:einfra:<groupName>:<subGroupName>#perun.cesnet.cz
7676
if (empty($this->groupNameAuthority) || empty($this->groupNamePrefix)) {
7777
throw new SimpleSAML_Error_Exception("perun:PerunGroups: missing mandatory configuration options 'groupNameAuthority' or 'groupNamePrefix'.");
7878
}
7979

80-
$groupName = $this->groupNamePrefix . rawurlencode($group->getUniqueName()) . '#' . $this->groupNameAuthority;
80+
$groupName = $this->groupNamePrefix . implode(":", array_map("rawurlencode", explode(":", $group->getUniqueName()))) . '#' . $this->groupNameAuthority;
8181
} else {
8282
$groupName = $this->mapGroupName($request, $group->getUniqueName());
8383
}

lib/Auth/Process/PerunIdentity.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class sspmod_perun_Auth_Process_PerunIdentity extends SimpleSAML_Auth_Processing
3939
const PERUN_FACILITY_DYNAMIC_REGISTRATION_ATTR= 'facilityDynamicRegistrationAttr';
4040
const PERUN_FACILITY_REGISTER_URL_ATTR = 'facilityRegisterUrlAttr';
4141
const PERUN_FACILITY_ALLOW_REGISTRATION_TO_GROUPS = 'facilityAllowRegistrationToGroups';
42+
const LIST_OF_SPS_WITHOUT_INFO_ABOUT_REDIRECTION = 'listOfSpsWithoutInfoAboutRedirection';
4243

4344

4445
private $uidsAttr;
@@ -47,6 +48,7 @@ class sspmod_perun_Auth_Process_PerunIdentity extends SimpleSAML_Auth_Processing
4748
private $defaultRegisterUrl;
4849
private $voShortName;
4950
private $facilityVoShortNames = array();
51+
private $listOfSpsWithoutInfoAboutRedirection = array();
5052
private $spEntityId;
5153
private $interface;
5254
private $checkGroupMembership = false;
@@ -112,7 +114,9 @@ public function __construct($config, $reserved)
112114
if (!isset($config[self::FORCE_REGISTRATION_TO_GROUPS])) {
113115
$config[self::FORCE_REGISTRATION_TO_GROUPS] = false;
114116
}
115-
117+
if (isset($config[self::LIST_OF_SPS_WITHOUT_INFO_ABOUT_REDIRECTION]) && is_array($config[self::LIST_OF_SPS_WITHOUT_INFO_ABOUT_REDIRECTION])) {
118+
$this->listOfSpsWithoutInfoAboutRedirection = $config[self::LIST_OF_SPS_WITHOUT_INFO_ABOUT_REDIRECTION];
119+
}
116120
$this->uidsAttr = $config[self::UIDS_ATTR];
117121
$this->registerUrlBase = (string) $config[self::REGISTER_URL_BASE];
118122
$this->defaultRegisterUrl = (string) $config[self::REGISTER_URL];
@@ -264,8 +268,19 @@ protected function registerDirectly($request, $callback, $registerUrL, $vo = nul
264268
$params[self::TARGET_EXTENDED] = $callback;
265269

266270
$id = SimpleSAML_Auth_State::saveState($request, 'perun:PerunIdentity');
271+
272+
if (in_array($this->spEntityId, $this->listOfSpsWithoutInfoAboutRedirection)) {
273+
\SimpleSAML\Utils\HTTP::redirectTrustedURL($registerUrL, $params);
274+
}
275+
267276
$url = SimpleSAML\Module::getModuleURL('perun/unauthorized_access_go_to_registration.php');
268-
\SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id, 'SPMetadata' => $_REQUEST['SPMetadata'], 'registerUrL' => $registerUrL, 'params' => $params));
277+
\SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array(
278+
'StateId' => $id,
279+
'SPMetadata' => $request['SPMetadata'],
280+
'registerUrL' => $registerUrL,
281+
'params' => $params
282+
)
283+
);
269284

270285
}
271286

templates/choose-vo-and-group-tpl.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . SimpleSAML\Module::getModuleUrl('perun/res/css/perun_identity_choose_vo_and_group.css') . '" />';
1313

14-
$this->data['header'] = $this->t('{perun:perun:choose-vo-and-group-tpl_header}');
1514
$vos = $this->data['vos'];
1615
$groups = $this->data['groups'];
1716
$registerUrlBase = $this->data['registerUrlBase'];
@@ -28,6 +27,8 @@
2827
$informationURL = $spMetadata['InformationURL']['en'];
2928
}
3029

30+
$this->data['header'] = "";
31+
3132
$this->includeAtTemplateBase('includes/header.php');
3233

3334
if (isset($_POST['selectedGroup'])) {
@@ -48,8 +49,20 @@
4849
\SimpleSAML\Utils\HTTP::redirectTrustedURL($registerUrlBase, $params);
4950
}
5051

51-
echo '<p>' . $this->t('{perun:perun:choose-vo-and-group-tpl_text}') . '<a href="' . $informationURL . '">' .$serviceName . '</a> </p>';
52-
echo '<p>' . $this->t('{perun:perun:choose-vo-and-group-tpl_message}') . '</p>'
52+
$header = $this->t('{perun:perun:choose-vo-and-group-tpl_header-part1}');
53+
if (!empty($serviceName) && !empty($informationURL)) {
54+
$header .= '<a href="' . $informationURL . '">' . $serviceName . '</a>';
55+
} elseif (!empty($serviceName)) {
56+
$header .= $serviceName;
57+
}
58+
$header .= $this->t('{perun:perun:choose-vo-and-group-tpl_header-part2}');
59+
60+
echo '<div id="head">';
61+
echo '<h1>' . $header. '</h1>';
62+
echo '</div>';
63+
64+
echo '<div class="msg">' . $this->t('{perun:perun:choose-vo-and-group-tpl_message}'). '</div>';
65+
5366
?>
5467

5568
<div class="list-group">

templates/unauthorized-access-go-to-registration-tpl.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
*/
99

1010

11-
$this->data['header'] = $this->t('{perun:perun:choose-vo-and-group-tpl_header}');
11+
$this->data['header'] = "";
12+
$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . SimpleSAML\Module::getModuleUrl('perun/res/css/perun_identity_go_to_registration.css') . '" />';
13+
1214
$spMetadata = $this->data['SPMetadata'];
1315
$serviceName = '';
1416
$informationURL = '';
@@ -27,20 +29,22 @@
2729

2830
$this->includeAtTemplateBase('includes/header.php');
2931

32+
$header = $this->t('{perun:perun:go-to-registration_header1}');
33+
if (!empty($serviceName) && !empty($informationURL)) {
34+
$header .= '<a href="' . $informationURL . '">' . $serviceName . '</a>';
35+
} elseif (!empty($serviceName)) {
36+
$header .= $serviceName;
37+
}
38+
$header .= $this->t('{perun:perun:go-to-registration_header2}');
3039

31-
echo '<p>' . $this->t('{perun:perun:choose-vo-and-group-tpl_text}') . '<a href="' . $informationURL . '">' .$serviceName . '</a> </p>';
32-
echo '<p>' . $this->t('{perun:perun:choose-vo-and-group-tpl_message}') . '</p>'
40+
echo '<div id="head">';
41+
echo '<h1>' . $header . '</h1>';
42+
echo '</div>';
3343
?>
34-
35-
36-
37-
3844
<form method="post">
3945
</hr>
4046
</br>
41-
<h4> <?php echo $this->t('{perun:perun:unauthorized-access_redirect_to_registration}')?> </h4>
42-
43-
<input type="submit" name="continueToRegistration" value="<?php echo $this->t('{perun:perun:continue}')?>" class="btn btn-lg btn-primary btn-block">
47+
<input type="submit" name="continueToRegistration" value="<?php echo $this->t('{perun:perun:go-to-registration_continue}')?>" class="btn btn-lg btn-primary btn-block">
4448
<div class="form-group">
4549
</div>
4650
</form>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
#head a, #head a:link, #head a:visited{
2+
color: #005b99 !important;
3+
}
4+
5+
#head a:hover {
6+
border-bottom: 1px #005b99 solid !important;
7+
}
8+
9+
#content, #languagebar {
10+
max-width: 960px !important;
11+
}
12+
13+
.msg {
14+
padding-top: 30px;
15+
padding-bottom: 20px;
16+
}
17+
118
select {
219
margin-bottom: 20px;
320
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#head a, #head a:link, #head a:visited{
2+
color: #005b99 !important;
3+
}
4+
5+
#head a:hover {
6+
border-bottom: 1px #005b99 solid !important;
7+
}
8+
9+
#content, #languagebar {
10+
max-width: 960px !important;
11+
}
12+
13+
.msg {
14+
padding-top: 30px;
15+
}

0 commit comments

Comments
 (0)