Skip to content

Commit 3c94414

Browse files
Merge branch 'IDAM-626-Bump-Client-app-dependencies-to-clear-dependabot-PRs' of https://github.com/nice-digital/identity-hostedpages into IDAM-626-Bump-Client-app-dependencies-to-clear-dependabot-PRs
2 parents 874dc53 + dd97437 commit 3c94414

File tree

14 files changed

+236
-30
lines changed

14 files changed

+236
-30
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "MFA Options",
3+
"code": "actions\\MFA Options\\code.js",
4+
"runtime": "node18-actions",
5+
"status": "deployed",
6+
"dependencies": [],
7+
"staged_action_secrets": {
8+
"mfa_exclusions_client_ids": ""
9+
},
10+
"secrets": [
11+
{
12+
"name": "mfa_exclusions_client_ids",
13+
"value": ""
14+
}
15+
],
16+
"supported_triggers": [
17+
{
18+
"id": "post-login",
19+
"version": "v3"
20+
}
21+
],
22+
"deployed": true
23+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* Handler that will be called during the execution of a PostLogin flow.
3+
*
4+
* --- AUTH0 ACTIONS TEMPLATE https://github.com/auth0/opensource-marketplace/blob/main/templates/mfa-require-enrollment-POST_LOGIN ---
5+
*
6+
* @param {Event} event - Details about the user and the context in which they are logging in.
7+
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
8+
*/
9+
10+
exports.onExecutePostLogin = async (event, api) => {
11+
const mfa_exclusions = event.secrets.mfa_exclusions_client_ids
12+
.replace(/\s+/g, '')
13+
.split(',');
14+
if (!mfa_exclusions.includes(event.client.client_id)) {
15+
if (
16+
event.connection.strategy !== 'waad' &&
17+
event.connection.strategy !== 'google-oauth2'
18+
) {
19+
const enrolledFactors = event.user.enrolledFactors.map((f) => ({
20+
type: f.type,
21+
}));
22+
if (enrolledFactors.length < 2) {
23+
api.authentication.enrollWith(
24+
{ type: 'otp' },
25+
{ additionalFactors: [{ type: 'recovery-code' }] }
26+
);
27+
} else {
28+
api.authentication.challengeWith(
29+
{ type: 'email' },
30+
{ additionalFactors: enrolledFactors }
31+
);
32+
}
33+
return;
34+
}
35+
}
36+
};
37+
38+
/**
39+
* Handler that will be invoked when this action is resuming after an external redirect. If your
40+
* onExecutePostLogin function does not perform a redirect, this function can be safely ignored.
41+
*
42+
* @param {Event} event - Details about the user and the context in which they are logging in.
43+
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
44+
*/
45+
// exports.onContinuePostLogin = async (event, api) => {
46+
// };

custom-pages/clients/Comments.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"allowed_origins": [],
1515
"client_id": "",
1616
"client_secret": "",
17-
"client_metadata": {
18-
"authorise_uri": ""
17+
"client_metadata": {
18+
"authorise_uri": ""
1919
},
2020
"jwt_configuration": {
2121
"alg": "RS256",
@@ -24,11 +24,7 @@
2424
},
2525
"token_endpoint_auth_method": "client_secret_post",
2626
"app_type": "regular_web",
27-
"grant_types": [
28-
"authorization_code",
29-
"refresh_token",
30-
"client_credentials"
31-
],
27+
"grant_types": ["authorization_code", "refresh_token", "client_credentials"],
3228
"web_origins": ["this will be deleted in the variable substitution"],
3329
"custom_login_page_on": false
3430
}

custom-pages/clients/ISS Monitoring.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"oidc_conformant": true,
66
"sso_disabled": false,
77
"cross_origin_auth": false,
8+
"initiate_login_uri": "",
89
"allowed_clients": [],
910
"allowed_logout_urls": ["this will be deleted in the variable substitution"],
1011
"callbacks": ["this will be deleted in the variable substitution"],
@@ -28,10 +29,6 @@
2829
},
2930
"token_endpoint_auth_method": "client_secret_post",
3031
"app_type": "regular_web",
31-
"grant_types": [
32-
"authorization_code",
33-
"refresh_token",
34-
"client_credentials"
35-
],
32+
"grant_types": ["authorization_code", "refresh_token", "client_credentials"],
3633
"custom_login_page_on": true
37-
}
34+
}

custom-pages/clients/InDev.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"oidc_conformant": true,
66
"sso_disabled": false,
77
"cross_origin_auth": false,
8+
"initiate_login_uri": "",
89
"allowed_clients": [],
910
"allowed_logout_urls": ["this will be deleted in the variable substitution"],
1011
"callbacks": ["this will be deleted in the variable substitution"],
@@ -32,10 +33,6 @@
3233
"client_aliases": [],
3334
"token_endpoint_auth_method": "client_secret_post",
3435
"app_type": "regular_web",
35-
"grant_types": [
36-
"authorization_code",
37-
"refresh_token",
38-
"client_credentials"
39-
],
36+
"grant_types": ["authorization_code", "refresh_token", "client_credentials"],
4037
"custom_login_page_on": true
41-
}
38+
}

custom-pages/clients/Publications.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"oidc_conformant": true,
66
"sso_disabled": false,
77
"cross_origin_auth": false,
8+
"initiate_login_uri": "",
89
"allowed_clients": [],
910
"allowed_logout_urls": ["this will be deleted in the variable substitution"],
1011
"callbacks": ["this will be deleted in the variable substitution"],
@@ -28,10 +29,6 @@
2829
},
2930
"token_endpoint_auth_method": "client_secret_post",
3031
"app_type": "regular_web",
31-
"grant_types": [
32-
"authorization_code",
33-
"refresh_token",
34-
"client_credentials"
35-
],
32+
"grant_types": ["authorization_code", "refresh_token", "client_credentials"],
3633
"custom_login_page_on": true
37-
}
34+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "email",
3+
"enabled": true
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "otp",
3+
"enabled": true
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "recovery-code",
3+
"enabled": true
4+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>2nd Factor Authentication</title>
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<style type="text/css">
8+
9+
html, body { padding: 0; margin: 0; }
10+
.test {}
11+
.table {
12+
display: table;
13+
position: absolute;
14+
height: 100%;
15+
width: 100%;
16+
background-color: {{ pageBackgroundColor | default: '#2b2b33' }};
17+
}
18+
19+
.cell {
20+
display: table-cell;
21+
vertical-align: middle;
22+
}
23+
24+
.content {
25+
padding: 25px 0px 25px 0px;
26+
margin-left: auto;
27+
margin-right: auto;
28+
width: 280px; /* login widget width */
29+
}
30+
31+
</style>
32+
</head>
33+
34+
<body>
35+
36+
<div class="table">
37+
<div class="cell">
38+
<div class="content">
39+
<!-- WIDGET -->
40+
<div class="js-mfa-container mfa-container" id="container"></div>
41+
</div>
42+
</div>
43+
</div>
44+
45+
<script src="//cdn.auth0.com/js/mfa-widget/mfa-widget-1.6.min.js"></script>
46+
47+
<script>
48+
(function() {
49+
return new Auth0MFAWidget({
50+
container: "container",
51+
52+
theme: {
53+
icon: "{{ iconUrl | default: 'https://indepth.nice.org.uk/logos/assets/yIOHC7Oexa/logo-landscape-800x281-800x281.png' }}",
54+
primaryColor: "{{ primaryColor | default: '#228096' }}"
55+
},
56+
57+
requesterErrors: [
58+
{% for error in errors %}
59+
{ message: "{{ error.message }}", errorCode: "{{ error.code }}" }
60+
{% endfor %}
61+
],
62+
63+
mfaServerUrl: "{{ mfaServerUrl }}",
64+
{% if ticket %}
65+
ticket: "{{ ticket }}",
66+
{% else %}
67+
requestToken: "{{ requestToken }}",
68+
{% endif %}
69+
postActionURL: "{{ postActionURL }}",
70+
71+
userData: {
72+
userId: "{{ userData.userId }}",
73+
email: "{{ userData.email }}",
74+
friendlyUserId: "{{ userData.friendlyUserId }}",
75+
tenant: "{{ userData.tenant }}",
76+
{% if userData.tenantFriendlyName %}
77+
tenantFriendlyName: "{{ userData.tenantFriendlyName }}"
78+
{% endif %}
79+
},
80+
globalTrackingId: "{{ globalTrackingId }}",
81+
{% if allowRememberBrowser %}allowRememberBrowser: {{ allowRememberBrowser }}, {% endif %}
82+
{% if stateCheckingMechanism %}stateCheckingMechanism: "{{ stateCheckingMechanism }}", {% endif %}
83+
});
84+
})();
85+
</script>
86+
</body>
87+
</html>

0 commit comments

Comments
 (0)