From 9b0751882f0746fd7a059c5f08d75faf6a637fe4 Mon Sep 17 00:00:00 2001 From: DOSarrest Date: Tue, 21 Aug 2018 12:19:24 -0700 Subject: [PATCH 1/2] Adding custom passport strategy example Adding documentation to cover support for custom passport strategies --- pages/en/lb3/Configuring-providers.json.md | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/pages/en/lb3/Configuring-providers.json.md b/pages/en/lb3/Configuring-providers.json.md index b832ab43a..79b92a3c8 100644 --- a/pages/en/lb3/Configuring-providers.json.md +++ b/pages/en/lb3/Configuring-providers.json.md @@ -27,6 +27,10 @@ var passportConfigurator = new PassportConfigurator(app); var config = {}; try { config = require('../providers.json'); + // If using custom passport module + config['custom-example'].verifyMethod = function(req, token, details, verified) { + verified(null, details); + } } catch (err) { console.trace(err); process.exit(1); // fatal @@ -48,6 +52,23 @@ Below is the providers.template.json file provided with [loopback-example-passp "authPath": "/auth/local", "successRedirect": "/auth/account" }, + "custom-example": { + "authScheme": "custom", + "provider": "custom-example", + "module": "loopback-passport-custom-strategy-example", + "authPath": "/auth/example", + "example": { + "id": "123", + "username": "example", + "email": "example@email.com", + "emailVerified": true + }, + "authOptions": { + "successRedirect": "/auth/success", + "failureRedirect": "/auth/failure" + }, + "passReqToVerify": true + }, "facebook-login": { "provider": "facebook", "module": "passport-facebook", @@ -333,3 +354,36 @@ Used by Google and Facebook. + +### Custom + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyTypeDescriptionExampleDefault
authOptionsObjectOptions passed to custom strategy authenticate method +

"authOptions": {"successRedirect": "/auth/success", "failureRedirect": "/auth/failure"}

+
passReqToVerifyBooleanConfigures if the HTTP request object should be passed to verify method +

true

+
false
From 70c5b44601a30eaa65dd7428938d33a7e2d47e8e Mon Sep 17 00:00:00 2001 From: DOSarrest Date: Tue, 21 Aug 2018 12:26:54 -0700 Subject: [PATCH 2/2] Added custom authScheme --- pages/en/lb3/Third-party-login-using-Passport.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/en/lb3/Third-party-login-using-Passport.md b/pages/en/lb3/Third-party-login-using-Passport.md index 4ced32c46..8c5b4ebbc 100644 --- a/pages/en/lb3/Third-party-login-using-Passport.md +++ b/pages/en/lb3/Third-party-login-using-Passport.md @@ -78,7 +78,7 @@ The following table describes the properties of the UserIdentity model. authScheme String - auth scheme, such as oAuth, oAuth 2.0, OpenID, OpenID Connect + auth scheme, such as oAuth, oAuth 2.0, OpenID, OpenID Connect, Custom externalId