Skip to content

Commit

Permalink
Upgrade to use new version of released passport-openidconnect.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Judson committed Mar 28, 2018
1 parent 03ee130 commit 26a58aa
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
5 changes: 3 additions & 2 deletions lib/passport-auth0-openidconnect/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function Strategy(options, verify) {
});

options = xtend({}, options, {
issuer: options.domain,
authorizationURL: 'https://' + options.domain + '/authorize',
tokenURL: 'https://' + options.domain + '/oauth/token',
userInfoURL: 'https://' + options.domain + '/userinfo'
Expand All @@ -40,7 +41,7 @@ function Strategy(options, verify) {
OpenIDConnectStrategy.call(this, options, verify);

this.name = 'auth0-oidc';

}

/**
Expand All @@ -51,4 +52,4 @@ util.inherits(Strategy, OpenIDConnectStrategy);
/**
* Expose `Strategy`.
*/
module.exports = Strategy;
module.exports = Strategy;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"should": "^7.1.1"
},
"dependencies": {
"passport-openidconnect": "https://github.com/siacomuzzi/passport-openidconnect/tarball/state_store",
"passport-openidconnect": "0.0.2",
"pkginfo": "^0.3.1",
"request": "^2.65.0",
"xtend": "^4.0.0"
Expand Down
39 changes: 20 additions & 19 deletions test/strategy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('constructor with bad params', function () {
});

it('should fail if no clientSecret is passed as option',function(){
(function(){
(function(){
new Auth0OidcStrategy(
{domain:'foo',clientID:'bar'},
function(accessToken, idToken, profile, done){}
Expand All @@ -43,22 +43,23 @@ describe('constructor with bad params', function () {
describe('constructor with right params and pre-configured endpoints', function () {
var strategy, configuration;

before(function () {
before(function(done) {
strategy = new Auth0OidcStrategy({
domain: 'jj.auth0.com',
clientID: 'testid',
clientSecret: 'testsecret',
callbackURL: '/callback',
authorizationURL: 'https://jj.auth0.com/authorize',
tokenURL: 'https://jj.auth0.com/oauth/token',
userInfoURL: 'https://jj.auth0.com/userinfo'
},
function(accessToken, idToken, profile, done) {}
);

strategy._configurers.should.have.length(1);
strategy._configurers[0](null, function (err, config) {
configuration = config;
domain: 'jj.auth0.com',
clientID: 'testid',
clientSecret: 'testsecret',
callbackURL: '/callback',
authorizationURL: 'https://jj.auth0.com/authorize',
tokenURL: 'https://jj.auth0.com/oauth/token',
userInfoURL: 'https://jj.auth0.com/userinfo'
},
function(accessToken, idToken, profile, done) {});

strategy._setup(null, function(err, params) {
if (err) { return done(err); }
configuration = params;

done();
});
});

Expand All @@ -69,11 +70,11 @@ describe('constructor with right params and pre-configured endpoints', function
it('oidc authorizationURL should be properly set', function () {
configuration.authorizationURL.should.eql('https://jj.auth0.com/authorize');
});

it('oidc tokenURL should be properly set', function () {
configuration.tokenURL.should.eql('https://jj.auth0.com/oauth/token');
});

it('oidc userInfoURL should be properly set', function () {
configuration.userInfoURL.should.eql('https://jj.auth0.com/userinfo');
});
Expand All @@ -94,4 +95,4 @@ describe('constructor with right params and pre-configured endpoints', function
strategy._skipUserProfile.should.be.false();
});

});
});

0 comments on commit 26a58aa

Please sign in to comment.