Skip to content

Commit

Permalink
Merge pull request #351 from april/master
Browse files Browse the repository at this point in the history
Convert the custom lock to using the new API
  • Loading branch information
april authored Sep 16, 2020
2 parents 6500eef + 8453d10 commit 2a35933
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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.

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.
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.

## Build tools

Expand Down
6 changes: 3 additions & 3 deletions config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"auth0_domain": "auth-dev.mozilla.auth0.com",
"cdn_domain": "cdn.sso.allizom.org",
"LDAP_connection_name": "Mozilla-LDAP-Dev",
"person_api_domain": "person.api.test.sso.allizom.org",
"iam_api_domain": "iam.api.test.sso.allizom.org",
"logout_url": "https://auth-dev.mozilla.auth0.com/v2/logout?returnTo=https://sso.allizom.org/signout.html",
"sso_dashboard_url": "https://sso.allizom.org",
"GTM_ID": "GTM-T2N2BRW",
"client_ID": "CIynn5wTPyYZQcA1FJx1Io9z4t7QWDaE",
"features": {
"autologin": "true",
"person_api_lookup": "true",
"iam_api_lookup": "true",
"maintenance_mode": "false"
},
"supportedLoginMethods": [ "github", "google-oauth2", "firefoxaccounts", "email" ],
"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",
"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",
"displayNames": {
"github": "GitHub",
"google-oauth2": "Google",
Expand Down
4 changes: 2 additions & 2 deletions config/local.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"auth0_domain": "auth-dev.mozilla.auth0.com",
"cdn_domain": "localhost:3000",
"LDAP_connection_name": "Mozilla-LDAP-Dev",
"person_api_domain": "person.api.dev.sso.allizom.org",
"iam_api_domain": "iam.api.dev.sso.allizom.org",
"logout_url": "https://auth-dev.mozilla.auth0.com/v2/logout?returnTo=https://sso.allizom.org/signout.html",
"sso_dashboard_url": "https://sso.allizom.org",
"GTM_ID": "GTM-T2N2BRW",
"client_ID": "CIynn5wTPyYZQcA1FJx1Io9z4t7QWDaE",
"features": {
"autologin": "true",
"person_api_lookup": "true",
"iam_api_lookup": "true",
"maintenance_mode": "false"
},
"supportedLoginMethods": [ "github", "google-oauth2", "firefoxaccounts", "email" ],
Expand Down
6 changes: 3 additions & 3 deletions config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"auth0_domain": "auth.mozilla.auth0.com",
"cdn_domain": "cdn.sso.mozilla.com",
"LDAP_connection_name": "Mozilla-LDAP",
"person_api_domain": "person.api.sso.mozilla.com",
"iam_api_domain": "iam.api.sso.mozilla.com",
"logout_url": "https://auth.mozilla.auth0.com/v2/logout?returnTo=https://sso.mozilla.com/signout.html",
"sso_dashboard_url": "https://sso.mozilla.com",
"GTM_ID": "GTM-T2N2BRW",
"features": {
"autologin": "true",
"person_api_lookup": "true",
"iam_api_lookup": "true",
"maintenance_mode": "false"
},
"supportedLoginMethods": [ "github", "google-oauth2", "firefoxaccounts", "email" ],
"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",
"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",
"displayNames": {
"github": "GitHub",
"google-oauth2": "Google",
Expand Down
10 changes: 5 additions & 5 deletions src/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
Auth0-domain: {{{ auth0_domain }}}
Client ID: {{{ client_ID }}}
LDAP connection name: {{{ LDAP_connection_name }}}
Person API domain: {{{ person_api_domain }}}
IAM API domain: {{{ iam_api_domain }}}
Google Tag Manager ID: {{{ GTM_ID }}}
Logout URL: {{{ logout_url }}}
SSO Dashboard URL: {{{ sso_dashboard_url }}}
CSP: {{{ csp }}}
CDN: {{{ cdn }}}
Features:
autologin: {{{ features.autologin }}}
person_api_lookup: {{{ features.person_api_lookup }}}
iam_api_lookup: {{{ features.iam_api_lookup }}}
supportedLoginMethods: {{{ supportedLoginMethods }}}
Display names:
github: {{{ displayNames.github }}}
Expand All @@ -48,7 +48,7 @@
<title>Mozilla Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Security-Policy" content="{{{ csp }}}">
<link rel="dns-prefetch" href="https://{{{ person_api_domain }}}">
<link rel="dns-prefetch" href="https://{{{ iam_api_domain }}}">
<link rel="stylesheet" href="{{{ cdn }}}/css/fonts.css" type="text/css" />
<link rel="stylesheet" href="{{{ cdn }}}/css/styles.css" type="text/css" />
<link rel="icon" href="{{{ cdn }}}/images/favicon.png" type="image/png" sizes="192x192" />
Expand Down Expand Up @@ -257,11 +257,11 @@ <h2 class="card__heading card__heading--iconless">Auto-login settings</h2>
"domain": "{{{ auth0_domain }}}",
"client_ID": "{{{ client_ID }}}",
"LDAP_connection_name": "{{{ LDAP_connection_name }}}",
"person_api_domain": "{{{ person_api_domain }}}",
"iam_api_domain": "{{{ iam_api_domain }}}",
"GTM_ID": "{{{ GTM_ID }}}",
"features" : {
"autologin": "{{{ features.autologin }}}",
"person_api_lookup": "{{{ features.person_api_lookup }}}",
"iam_api_lookup": "{{{ features.iam_api_lookup }}}",
"maintenance_mode": "{{{ features.maintenance_mode }}}"
},
"supportedLoginMethods": "{{{ supportedLoginMethods }}}",
Expand Down
4 changes: 2 additions & 2 deletions src/js/handlers/enter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = function enter( element ) {
var qualifiesForLDAPShortcut = /@(mozilla\.com|getpocket\.com|mozillafoundation\.org)$/.test( emailField.value );
var supportedByRP = form.loginMethods ? form.loginMethods['supportedByRP'] : null;
var onlyAcceptsLDAP = supportedByRP && supportedByRP.length === 1 && supportedByRP.indexOf( NLX.LDAP_connection_name ) === 0;
var ENDPOINT = 'https://' + NLX.person_api_domain + '/v2/user/metadata/';
var ENDPOINT = 'https://' + NLX.iam_api_domain + '/api/v1/ldap-lookup-email/';

if ( emailField.value === '' || emailField.validity.valid === false ) {
emailField.focus();
Expand All @@ -40,7 +40,7 @@ module.exports = function enter( element ) {
showLDAP( element, passwordField );
}
else {
if ( NLX.features.person_api_lookup ) {
if ( NLX.features.iam_api_lookup ) {

ui.setLockState( element, 'loading' );

Expand Down

0 comments on commit 2a35933

Please sign in to comment.