From be462491fcfc3f198b26bddde9bdd2163d55de3c Mon Sep 17 00:00:00 2001 From: Joel Rodrigues Date: Fri, 21 Oct 2016 10:58:19 +0100 Subject: [PATCH 1/2] Corrct bug on ACS and SP on prem --- lib/passport-sharepoint/strategy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/passport-sharepoint/strategy.js b/lib/passport-sharepoint/strategy.js index ea878b3..f7090bf 100644 --- a/lib/passport-sharepoint/strategy.js +++ b/lib/passport-sharepoint/strategy.js @@ -109,7 +109,7 @@ Strategy.prototype.authenticate = function(req, options) { var spappId = this._appId+"@"+splitApptxSender[1]; var appctx = JSON.parse(token.appctx); var tokenServiceUri = url.parse(appctx.SecurityTokenServiceUri); - var tokenURL = tokenServiceUri.protocol+'//'+tokenServiceUri.host+'/'+splitApptxSender[1]+tokenServiceUri.path; + var tokenURL = tokenServiceUri.href; // tokenServiceUri.protocol + '//' + tokenServiceUri.host + '/' + splitApptxSender[1] + tokenServiceUri.path; this._oauth2 = new OAuth2(spappId, this._appSecret, '', authorizationURL, tokenURL); this._oauth2.getOAuthAccessToken( From b3455b1c17ab4f70ecbb2259311f30ffaed59be5 Mon Sep 17 00:00:00 2001 From: Joel Rodrigues Date: Fri, 21 Oct 2016 11:48:50 +0100 Subject: [PATCH 2/2] Update readme --- README.md | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2ac8b7a..80f126d 100644 --- a/README.md +++ b/README.md @@ -58,18 +58,11 @@ authenticate requests. For example, as route middleware in an [Express](http://expressjs.com/) application: - app.get('/auth/sharepoint', - passport.authenticate('sharepoint'), - function(req, res){ - // The request will be redirected to SharePoint for authentication, so - // this function will not be called. - }); - - app.get('/auth/sharepoint/callback', + app.post('/auth/sharepoint', passport.authenticate('sharepoint', { failureRedirect: '/login' }), - function(req, res) { - // Successful authentication, redirect home. - res.redirect('/'); + function (req, res) { + // Successful authentication, redirect home. + res.redirect('/'); }); ## Credits