Skip to content

Commit 2a35933

Browse files
authored
Merge pull request #351 from april/master
Convert the custom lock to using the new API
2 parents 6500eef + 8453d10 commit 2a35933

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
The `auth0-custom-lock` repo contains the code behind the Mozilla New Login Experience (NLX) which is the single sign on (SSO) web interface that users log into to access Mozilla properties.
1010

11-
The original customized Auth0 lock, which can be found in [`mozilla-iam/auth0-deploy`](https://github.com/mozilla-iam/auth0-deploy/tree/2a09a74e4deb869f063ee8895916d74027eb65ad/pages) from [2016 to 2017](https://github.com/mozilla-iam/auth0-deploy/compare/3ba9e054e89fafcf48b2874a6b2fdffdc64c59a0...2a09a74e4deb869f063ee8895916d74027eb65ad), was succeeded by NLX, also tracked in `mozilla-iam/auth0-deploy` until NLX was moved to this repo in 2018.
11+
The original customized Auth0 lock, which can be found in [`mozilla-iam/auth0-deploy`](https://github.com/mozilla-iam/auth0-deploy/tree/2a09a74e4deb869f063ee8895916d74027eb65ad/pages) from [2016 to 2017](https://github.com/mozilla-iam/auth0-deploy/compare/3ba9e054e89fafcf48b2874a6b2fdffdc64c59a0...2a09a74e4deb869f063ee8895916d74027eb65ad), was succeeded by NLX, also tracked in `mozilla-iam/auth0-deploy` until NLX was moved to this repo in 2018. This repository currently relies on the [IAM API](https://github.com/mozilla-iam/iam-api) to check whether or not a user is in LDAP.
1212

1313
## Build tools
1414

config/development.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
"auth0_domain": "auth-dev.mozilla.auth0.com",
44
"cdn_domain": "cdn.sso.allizom.org",
55
"LDAP_connection_name": "Mozilla-LDAP-Dev",
6-
"person_api_domain": "person.api.test.sso.allizom.org",
6+
"iam_api_domain": "iam.api.test.sso.allizom.org",
77
"logout_url": "https://auth-dev.mozilla.auth0.com/v2/logout?returnTo=https://sso.allizom.org/signout.html",
88
"sso_dashboard_url": "https://sso.allizom.org",
99
"GTM_ID": "GTM-T2N2BRW",
1010
"client_ID": "CIynn5wTPyYZQcA1FJx1Io9z4t7QWDaE",
1111
"features": {
1212
"autologin": "true",
13-
"person_api_lookup": "true",
13+
"iam_api_lookup": "true",
1414
"maintenance_mode": "false"
1515
},
1616
"supportedLoginMethods": [ "github", "google-oauth2", "firefoxaccounts", "email" ],
17-
"csp": "default-src 'none'; connect-src 'self' https://person.api.test.sso.allizom.org; script-src 'self' https://cdn.sso.allizom.org https://www.googletagmanager.com https://www.google-analytics.com; style-src 'self' https://cdn.sso.allizom.org; font-src 'self' https://cdn.sso.allizom.org; img-src 'self' https://cdn.sso.allizom.org https://www.google-analytics.com",
17+
"csp": "default-src 'none'; connect-src 'self' https://iam.api.test.sso.allizom.org; script-src 'self' https://cdn.sso.allizom.org https://www.googletagmanager.com https://www.google-analytics.com; style-src 'self' https://cdn.sso.allizom.org; font-src 'self' https://cdn.sso.allizom.org; img-src 'self' https://cdn.sso.allizom.org https://www.google-analytics.com",
1818
"displayNames": {
1919
"github": "GitHub",
2020
"google-oauth2": "Google",

config/local.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"auth0_domain": "auth-dev.mozilla.auth0.com",
44
"cdn_domain": "localhost:3000",
55
"LDAP_connection_name": "Mozilla-LDAP-Dev",
6-
"person_api_domain": "person.api.dev.sso.allizom.org",
6+
"iam_api_domain": "iam.api.dev.sso.allizom.org",
77
"logout_url": "https://auth-dev.mozilla.auth0.com/v2/logout?returnTo=https://sso.allizom.org/signout.html",
88
"sso_dashboard_url": "https://sso.allizom.org",
99
"GTM_ID": "GTM-T2N2BRW",
1010
"client_ID": "CIynn5wTPyYZQcA1FJx1Io9z4t7QWDaE",
1111
"features": {
1212
"autologin": "true",
13-
"person_api_lookup": "true",
13+
"iam_api_lookup": "true",
1414
"maintenance_mode": "false"
1515
},
1616
"supportedLoginMethods": [ "github", "google-oauth2", "firefoxaccounts", "email" ],

config/production.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
"auth0_domain": "auth.mozilla.auth0.com",
44
"cdn_domain": "cdn.sso.mozilla.com",
55
"LDAP_connection_name": "Mozilla-LDAP",
6-
"person_api_domain": "person.api.sso.mozilla.com",
6+
"iam_api_domain": "iam.api.sso.mozilla.com",
77
"logout_url": "https://auth.mozilla.auth0.com/v2/logout?returnTo=https://sso.mozilla.com/signout.html",
88
"sso_dashboard_url": "https://sso.mozilla.com",
99
"GTM_ID": "GTM-T2N2BRW",
1010
"features": {
1111
"autologin": "true",
12-
"person_api_lookup": "true",
12+
"iam_api_lookup": "true",
1313
"maintenance_mode": "false"
1414
},
1515
"supportedLoginMethods": [ "github", "google-oauth2", "firefoxaccounts", "email" ],
16-
"csp": "default-src 'none'; connect-src 'self' https://person.api.sso.mozilla.com; script-src 'self' https://cdn.sso.mozilla.com https://www.googletagmanager.com https://www.google-analytics.com; style-src 'self' https://cdn.sso.mozilla.com; font-src 'self' https://cdn.sso.mozilla.com; img-src 'self' https://cdn.sso.mozilla.com https://www.google-analytics.com",
16+
"csp": "default-src 'none'; connect-src 'self' https://iam.api.sso.mozilla.com; script-src 'self' https://cdn.sso.mozilla.com https://www.googletagmanager.com https://www.google-analytics.com; style-src 'self' https://cdn.sso.mozilla.com; font-src 'self' https://cdn.sso.mozilla.com; img-src 'self' https://cdn.sso.mozilla.com https://www.google-analytics.com",
1717
"displayNames": {
1818
"github": "GitHub",
1919
"google-oauth2": "Google",

src/html/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
Auth0-domain: {{{ auth0_domain }}}
2424
Client ID: {{{ client_ID }}}
2525
LDAP connection name: {{{ LDAP_connection_name }}}
26-
Person API domain: {{{ person_api_domain }}}
26+
IAM API domain: {{{ iam_api_domain }}}
2727
Google Tag Manager ID: {{{ GTM_ID }}}
2828
Logout URL: {{{ logout_url }}}
2929
SSO Dashboard URL: {{{ sso_dashboard_url }}}
3030
CSP: {{{ csp }}}
3131
CDN: {{{ cdn }}}
3232
Features:
3333
autologin: {{{ features.autologin }}}
34-
person_api_lookup: {{{ features.person_api_lookup }}}
34+
iam_api_lookup: {{{ features.iam_api_lookup }}}
3535
supportedLoginMethods: {{{ supportedLoginMethods }}}
3636
Display names:
3737
github: {{{ displayNames.github }}}
@@ -48,7 +48,7 @@
4848
<title>Mozilla Login</title>
4949
<meta name="viewport" content="width=device-width, initial-scale=1">
5050
<meta http-equiv="Content-Security-Policy" content="{{{ csp }}}">
51-
<link rel="dns-prefetch" href="https://{{{ person_api_domain }}}">
51+
<link rel="dns-prefetch" href="https://{{{ iam_api_domain }}}">
5252
<link rel="stylesheet" href="{{{ cdn }}}/css/fonts.css" type="text/css" />
5353
<link rel="stylesheet" href="{{{ cdn }}}/css/styles.css" type="text/css" />
5454
<link rel="icon" href="{{{ cdn }}}/images/favicon.png" type="image/png" sizes="192x192" />
@@ -257,11 +257,11 @@ <h2 class="card__heading card__heading--iconless">Auto-login settings</h2>
257257
"domain": "{{{ auth0_domain }}}",
258258
"client_ID": "{{{ client_ID }}}",
259259
"LDAP_connection_name": "{{{ LDAP_connection_name }}}",
260-
"person_api_domain": "{{{ person_api_domain }}}",
260+
"iam_api_domain": "{{{ iam_api_domain }}}",
261261
"GTM_ID": "{{{ GTM_ID }}}",
262262
"features" : {
263263
"autologin": "{{{ features.autologin }}}",
264-
"person_api_lookup": "{{{ features.person_api_lookup }}}",
264+
"iam_api_lookup": "{{{ features.iam_api_lookup }}}",
265265
"maintenance_mode": "{{{ features.maintenance_mode }}}"
266266
},
267267
"supportedLoginMethods": "{{{ supportedLoginMethods }}}",

src/js/handlers/enter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = function enter( element ) {
2929
var qualifiesForLDAPShortcut = /@(mozilla\.com|getpocket\.com|mozillafoundation\.org)$/.test( emailField.value );
3030
var supportedByRP = form.loginMethods ? form.loginMethods['supportedByRP'] : null;
3131
var onlyAcceptsLDAP = supportedByRP && supportedByRP.length === 1 && supportedByRP.indexOf( NLX.LDAP_connection_name ) === 0;
32-
var ENDPOINT = 'https://' + NLX.person_api_domain + '/v2/user/metadata/';
32+
var ENDPOINT = 'https://' + NLX.iam_api_domain + '/api/v1/ldap-lookup-email/';
3333

3434
if ( emailField.value === '' || emailField.validity.valid === false ) {
3535
emailField.focus();
@@ -40,7 +40,7 @@ module.exports = function enter( element ) {
4040
showLDAP( element, passwordField );
4141
}
4242
else {
43-
if ( NLX.features.person_api_lookup ) {
43+
if ( NLX.features.iam_api_lookup ) {
4444

4545
ui.setLockState( element, 'loading' );
4646

0 commit comments

Comments
 (0)