Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Commit 63cb956

Browse files
Merge pull request #18 from silinternational/develop
Password expiration splash screen
2 parents fe9e9f0 + c7e7d65 commit 63cb956

File tree

14 files changed

+281
-30
lines changed

14 files changed

+281
-30
lines changed

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,34 @@ content of that announcement. HTML is supported.
7373
4. Click **Login with idp1** (NOTE: login page should NOT have material design)
7474
5. Login as idp1 administrator, e.g., username=admin & password=a
7575
6. Click **Logout**
76-
7. Click **Authentication** tab
77-
8. Click **Test configured authentication sources**
78-
9. Click **hub-discovery**
79-
10. Click **Login with idp2** (NOTE: login page should have material design)
80-
11. Login as idp2 administrator, e.g., username=admin & password=b
76+
7. Goto [http://ssp-hub.local](http://ssp-hub.local)
77+
8. Click **Authentication** tab
78+
9. Click **Test configured authentication sources**
79+
10. Click **hub-discovery**
80+
11. Click **Login with idp2** (NOTE: login page should have material design)
81+
12. Login as an idp2 user, e.g., username=distant_future & password=a
82+
13. Click **Logout**
83+
84+
### Expiry
85+
86+
#### About to expire
87+
1. Goto [http://ssp-hub.local](http://ssp-hub.local)
88+
2. Click **Authentication** tab
89+
3. Click **Test configured authentication sources**
90+
4. Click **hub-discovery**
91+
5. Click **Login with idp2**
92+
6. Login as an an "about to expire" user, e.g., username=near_future & password=b
93+
7. Click **Maybe later**
94+
8. Click **Logout**
95+
96+
#### Expired
97+
1. Goto [http://ssp-hub.local](http://ssp-hub.local)
98+
2. Click **Authentication** tab
99+
3. Click **Test configured authentication sources**
100+
4. Click **hub-discovery**
101+
5. Click **Login with idp2**
102+
6. Login as an an "expired" user, e.g., username=already_past & password=c
103+
81104

82105
## i18n support
83106
Translations are categorized by page in definition files located in the `dictionaries` directory.

development/idp2/authsources.php

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
11
<?php
22
$config = [
3-
'admin' => [
4-
'core:AdminPassword',
3+
'example-userpass' => [
4+
'exampleauth:UserPass',
5+
'distant_future:a' => [
6+
'eduPersonPrincipalName' => ['[email protected]'],
7+
'eduPersonTargetID' => ['11111111-1111-1111-1111-111111111111'],
8+
'sn' => ['Future'],
9+
'givenName' => ['Distant'],
10+
'mail' => ['[email protected]'],
11+
'employeeNumber' => ['11111'],
12+
'cn' => ['DISTANT_FUTURE'],
13+
'schacExpiryDate' => [
14+
gmdate('YmdHis\Z', strtotime('+6 months')), // Distant future
15+
],
16+
],
17+
'near_future:b' => [
18+
'eduPersonPrincipalName' => ['[email protected]'],
19+
'eduPersonTargetID' => ['22222222-2222-2222-2222-222222222222'],
20+
'sn' => ['Future'],
21+
'givenName' => ['Near'],
22+
'mail' => ['[email protected]'],
23+
'employeeNumber' => ['22222'],
24+
'cn' => ['NEAR_FUTURE'],
25+
'schacExpiryDate' => [
26+
gmdate('YmdHis\Z', strtotime('+1 day')), // Very soon
27+
],
28+
],
29+
'already_past:c' => [
30+
'eduPersonPrincipalName' => ['[email protected]'],
31+
'eduPersonTargetID' => ['33333333-3333-3333-3333-333333333333'],
32+
'sn' => ['Past'],
33+
'givenName' => ['Already'],
34+
'mail' => ['[email protected]'],
35+
'employeeNumber' => ['33333'],
36+
'cn' => ['ALREADY_PAST'],
37+
'schacExpiryDate' => [
38+
gmdate('YmdHis\Z', strtotime('-1 day')), // In the past
39+
],
40+
],
541
],
6-
];
42+
];

development/idp2/enable

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
used to enable simplesaml modules.
Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
<?php
2+
use Sil\PhpEnv\Env;
3+
use Sil\Psr3Adapters\Psr3SamlLogger;
4+
25
$metadata['http://ssp-hub-idp2.local:8086'] = [
36
'host' => '__DEFAULT__',
47
'privatekey' => 'ssp-hub-idp2.pem',
58
'certificate' => 'ssp-hub-idp2.crt',
6-
'auth' => 'admin',
7-
];
9+
'auth' => 'example-userpass',
10+
'authproc' => [
11+
10 => [
12+
'class' => 'expirychecker:ExpiryDate',
13+
'accountNameAttr' => 'cn',
14+
'expiryDateAttr' => 'schacExpiryDate',
15+
'changePwdUrl' => Env::get('CHANGE_PWD_URL'),
16+
'warnDaysBefore' => 14,
17+
'dateFormat' => 'Y-m-d',
18+
'loggerClass' => Psr3SamlLogger::class,
19+
]
20+
]
21+
];
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
{
3+
"title": {
4+
"en": "Expiring password",
5+
"es": "Contraseña vencida",
6+
"fr": "Mot de passe expiré",
7+
"ko": "만료 된 암호"
8+
},
9+
"header": {
10+
"en": "Password expiring soon",
11+
"es": "Contraseña caducada pronto",
12+
"fr": "Mot de passe expirant bientôt",
13+
"ko": "곧 만료되는 암호"
14+
},
15+
"expiring_in_a_day": {
16+
"en": "Your password will expire in one day.",
17+
"es": "Su contraseña caducará en un día.",
18+
"fr": "Votre mot de passe expirera en un jour.",
19+
"ko": "암호는 하루 만료됩니다."
20+
},
21+
"expiring_soon": {
22+
"en": "Your password will expire in {daysLeft} days.",
23+
"es": "Su contraseña caducará en {daysLeft} días.",
24+
"fr": "Votre mot de passe expirera dans les jours {daysLeft}.",
25+
"ko": "비밀번호는 {daysLeft} 일 후에 만료됩니다."
26+
},
27+
"change_now": {
28+
"en": "Would you like to go ahead and change it now?",
29+
"es": "¿Te gustaría seguir adelante y cambiarlo ahora?",
30+
"fr": "Voulez-vous aller de l'avant et le changer maintenant?",
31+
"ko": "지금 가서 바꾸시겠습니까?"
32+
},
33+
"button_change": {
34+
"en": "Yes",
35+
"es": "",
36+
"fr": "Oui",
37+
"ko": ""
38+
},
39+
"button_continue": {
40+
"en": "Maybe later",
41+
"es": "Quizas despues",
42+
"fr": "Peut-être plus tard",
43+
"ko": "나중에"
44+
}
45+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
{
3+
"title": {
4+
"en": "Expired password",
5+
"es": "Contraseña caducada",
6+
"fr": "Mot de passe expiré",
7+
"ko": "만료 된 암호"
8+
},
9+
"header": {
10+
"en": "Password expired",
11+
"es": "La contraseña expiró",
12+
"fr": "Mot de passe expiré",
13+
"ko": "암호가 만료되었습니다."
14+
},
15+
"expired": {
16+
"en": "Your password has expired and must be changed before continuing.",
17+
"es": "Su contraseña ha caducado y debe cambiarse antes de continuar.",
18+
"fr": "Votre mot de passe a expiré et doit être modifié avant de continuer.",
19+
"ko": "비밀번호가 만료되었으므로 계속하기 전에 비밀번호를 변경해야합니다."
20+
},
21+
"button_change": {
22+
"en": "Change",
23+
"es": "Cambiar",
24+
"fr": "Changer",
25+
"ko": "바꾸다"
26+
}
27+
}

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ services:
77
- ./development/hub/authsources.php:/data/vendor/simplesamlphp/simplesamlphp/config/authsources.php
88
- ./development/hub/saml20-idp-remote.php:/data/vendor/simplesamlphp/simplesamlphp/metadata/saml20-idp-remote.php
99
- ./development/hub/saml20-idp-hosted.php:/data/vendor/simplesamlphp/simplesamlphp/metadata/saml20-idp-hosted.php
10+
- ./www/default-logo.png:/data/vendor/simplesamlphp/simplesamlphp/www/logo.png
1011
- ./:/data/vendor/simplesamlphp/simplesamlphp/modules/material
1112
ports:
1213
- '80:80'
@@ -42,9 +43,11 @@ services:
4243
image: silintl/ssp-base:develop
4344
volumes:
4445
- ./development/idp2/cert:/data/vendor/simplesamlphp/simplesamlphp/cert
46+
- ./development/idp2/enable:/data/vendor/simplesamlphp/simplesamlphp/modules/exampleauth/enable
4547
- ./development/idp2/authsources.php:/data/vendor/simplesamlphp/simplesamlphp/config/authsources.php
4648
- ./development/idp2/saml20-idp-hosted.php:/data/vendor/simplesamlphp/simplesamlphp/metadata/saml20-idp-hosted.php
4749
- ./development/idp2/saml20-sp-remote.php:/data/vendor/simplesamlphp/simplesamlphp/metadata/saml20-sp-remote.php
50+
- ./www/default-logo.png:/data/vendor/simplesamlphp/simplesamlphp/www/logo.png
4851
- ./:/data/vendor/simplesamlphp/simplesamlphp/modules/material
4952
ports:
5053
- '8086:80'
@@ -58,3 +61,4 @@ services:
5861
SECRET_SALT: "edI4GGkYfkzD6/OXFvHBHb9Meu9hdKXQpNFg4q/GGfY="
5962
IDP_NAME: "Idp 2"
6063
ANALYTICS_ID: "UA-XXXX-Y"
64+
CHANGE_PWD_URL: "http://example.org"

themes/material/common-announcement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
$announcement = htmlentities($this->data['announcement'] ?? null);
2+
$announcement = htmlentities($this->data['announcement']);
33

44
if (! empty($announcement)) {
55
?>

themes/material/common-head-elements.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@
3333
<link rel="stylesheet" href="/module.php/material/styles.2.2.0.css">
3434

3535
<script async src="/module.php/material/material.1.2.1.min.js"></script>
36+
37+
<link rel="shortcut icon" href="/logo.png" />

themes/material/core/loginuserpass.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<?php include __DIR__ . '/../common-head-elements.php' ?>
77

88
<?php
9-
$siteKey = htmlentities($this->data['recaptcha.siteKey'] ?? null);
9+
$siteKey = htmlentities($this->data['recaptcha.siteKey']);
1010
if (! empty($siteKey)) {
1111
?>
1212
<script src='https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoad&render=explicit'
@@ -38,11 +38,11 @@ function onRecaptchaLoad() {
3838
<?php include __DIR__ . '/../common-announcement.php' ?>
3939

4040

41-
<form method="POST" action="<?= htmlentities($_SERVER['PHP_SELF']) ?>">
41+
<form method="POST">
4242
<input type="hidden" name="AuthState"
43-
value="<?= htmlentities($this->data['stateparams']['AuthState'] ?? null) ?>" />
43+
value="<?= htmlentities($this->data['stateparams']['AuthState']) ?>" />
4444
<?php
45-
$csrfToken = htmlentities($this->data['csrfToken'] ?? null);
45+
$csrfToken = htmlentities($this->data['csrfToken']);
4646
?>
4747
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>" />
4848

@@ -67,7 +67,7 @@ function onRecaptchaLoad() {
6767
<?= $this->t('{material:login:label_username}') ?>
6868
</label>
6969
<?php
70-
$username = htmlentities($this->data['username'] ?? null);
70+
$username = htmlentities($this->data['username']);
7171
?>
7272
<input type="text" name="username" class="mdl-textfield__input"
7373
value="<?= $username ?>"
@@ -87,7 +87,7 @@ function onRecaptchaLoad() {
8787
$errorCode = htmlentities($this->data['errorcode']);
8888
if ($errorCode == 'WRONGUSERPASS') {
8989
$errorMessageKey = $this->data['errorparams'][1] ?? '{material:login:error_wronguserpass}';
90-
$errorMessageTokens = $this->data['errorparams'][2] ?? null;
90+
$errorMessageTokens = $this->data['errorparams'][2];
9191

9292
$message = htmlentities($this->t($errorMessageKey, $errorMessageTokens));
9393
?>
@@ -108,7 +108,7 @@ function onRecaptchaLoad() {
108108

109109
<div class="mdl-card__actions" layout-children="row">
110110
<?php
111-
$forgotPasswordUrl = htmlentities($this->data['forgotPasswordUrl'] ?? null);
111+
$forgotPasswordUrl = htmlentities($this->data['forgotPasswordUrl']);
112112
if (! empty($forgotPasswordUrl)) {
113113
?>
114114
<a href="<?= $forgotPasswordUrl ?>" target="_blank"

0 commit comments

Comments
 (0)