This repository has been archived by the owner on Jan 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1392307 - use auth0 profile only to authenticte the user
Translate the auth0 profile to the existing user identity (email/.., mozilla-ldap/.., or a new github/<nick>). Continue to use the existing authorizers to add scopes based on those identities. We can improve on this when richer profiles are available from auth0.
- Loading branch information
Showing
4 changed files
with
110 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
require('mocha'); | ||
import assume from 'assume'; | ||
import helper from './helper'; | ||
import Handler from '../lib/handlers/mozilla-auth0'; | ||
|
||
suite('handlers/mozilla-auth0', function() { | ||
suite('userFromProfile', function() { | ||
let handler = new Handler({ | ||
name: 'mozilla-auth0', | ||
cfg: { | ||
handlers: { | ||
'mozilla-auth0': { | ||
domain:'login-test.taskcluster.net', | ||
apiAudience: 'login-test.taskcluster.net', | ||
clientId: 'abcd', | ||
clientSecret: 'defg', | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
test('user for ldap profile', function() { | ||
let user = handler.userFromProfile({ | ||
email: 'foo@mozilla.com', | ||
email_verified: true, | ||
identities: [{provider: 'ad', connection: 'Mozilla-LDAP'}], | ||
}); | ||
assume(user.identity).to.equal('mozilla-ldap/foo@mozilla.com'); | ||
}); | ||
|
||
test('user for email profile', function() { | ||
let user = handler.userFromProfile({ | ||
email: 'foo@bar.com', | ||
email_verified: true, | ||
identities: [{provider: 'email', connection: 'email'}], | ||
}); | ||
assume(user.identity).to.equal('email/foo@bar.com'); | ||
}); | ||
|
||
test('user for google profile', function() { | ||
let user = handler.userFromProfile({ | ||
email: 'foo@bar.com', | ||
email_verified: true, | ||
identities: [{ | ||
provider: 'google-oauth2', | ||
connection: 'google-oauth2'}], | ||
}); | ||
assume(user.identity).to.equal('email/foo@bar.com'); | ||
}); | ||
|
||
test('user for github profile', function() { | ||
let user = handler.userFromProfile({ | ||
nickname: 'octocat', | ||
identities: [{provider: 'github', connection: 'github'}], | ||
}); | ||
assume(user.identity).to.equal('github/octocat'); | ||
}); | ||
}); | ||
}); |