{"_id":"@akoenig/sso","_rev":"7-87ae72baaeb96424f72d340415a77d27","name":"@akoenig/sso","description":"Opinionated wrapper around Passport.js. It supports logins via Facebook and local users.","dist-tags":{"latest":"1.2.2"},"versions":{"1.0.0":{"name":"@akoenig/sso","version":"1.0.0","dependencies":{"express-session":"^1.15.2","passport":"^0.3.2","passport-facebook":"^2.1.1"},"gitHead":"bfa04fda5a805a15be42725c1723d2e80efd06a1","description":"Opinionated wrapper around Passport.js in combincation with the Facebook strategy for an easy-to-use integration into an Express.js application","_id":"@akoenig/sso@1.0.0","scripts":{},"_shasum":"cc4ebba792a3a4dad5635ae25675884619ea512e","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"akoenig","email":"akoenig@posteo.de"},"dist":{"shasum":"cc4ebba792a3a4dad5635ae25675884619ea512e","tarball":"https://registry.npmjs.org/@akoenig/sso/-/sso-1.0.0.tgz","integrity":"sha512-+d2Tp9IFHNNU/EkFK0j++VHNjHJlIk0NA8TlBbyMvVoxuCQgm7h/WbQSm0Ci9ieJCsVT2s8BT+HbT5hShVDSIA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDi2QfZecaXLyCvt98o7yLtLa5nDKOcdd4czTPbF2EjOgIhAOTlZgXEnxrX+yBldaWNMZ9QxjVdFBg1Wphley8SnbDM"}]},"maintainers":[{"name":"akoenig","email":"akoenig@posteo.de"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sso-1.0.0.tgz_1494492211014_0.6209002959076315"}},"1.1.0":{"name":"@akoenig/sso","version":"1.1.0","dependencies":{"body-parser":"^1.17.2","cookie-parser":"^1.4.3","express-session":"^1.15.2","passport":"^0.3.2","passport-facebook":"^2.1.1","passport-local":"^1.0.0"},"devDependencies":{"express":"^4.15.3"},"gitHead":"68e70f62f458a2c67deac29d346ada1642c17409","description":"Opinionated wrapper around Passport.js. It supports logins via Facebook and local users.","_id":"@akoenig/sso@1.1.0","_npmVersion":"5.0.0","_nodeVersion":"7.10.0","_npmUser":{"name":"akoenig","email":"akoenig@posteo.de"},"dist":{"integrity":"sha512-GCH7sngaNec5e7xtLGolC7fVK3+ys6gLoC4fSsAdQk6pv3V1tlLH/Czhxk492YUhpnYIzq4+TK55xM/KoJvSMg==","shasum":"1517cb9699dc95160874f6d994376c9d5adf218a","tarball":"https://registry.npmjs.org/@akoenig/sso/-/sso-1.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC95hUdAuIdh44TSwIjhtT2GwIEwCxOYyeI/cDQhAax3QIhANIIzMe2WyUK3qLKYt0kkZNmxL9FCexb2kwkOFv2slnD"}]},"maintainers":[{"name":"akoenig","email":"akoenig@posteo.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sso-1.1.0.tgz_1495951604487_0.5551254728343338"}},"1.2.0":{"name":"@akoenig/sso","version":"1.2.0","dependencies":{"body-parser":"^1.17.2","cookie-parser":"^1.4.3","express-session":"^1.15.2","passport":"^0.3.2","passport-facebook":"^2.1.1","passport-local":"^1.0.0"},"devDependencies":{"express":"^4.15.3"},"gitHead":"60fed9d70e09cbe4b3479e25e8033bf87425f0fb","description":"Opinionated wrapper around Passport.js. It supports logins via Facebook and local users.","_id":"@akoenig/sso@1.2.0","_npmVersion":"5.0.3","_nodeVersion":"8.1.2","_npmUser":{"name":"akoenig","email":"akoenig@posteo.de"},"dist":{"integrity":"sha512-cfxnAZRGpHplUxXro25WwumCqKza+jt6PQkxoueXOXzjxV0JJtT+7N6aBDAPpdZolODXYrGJsD5Pn0EhKPV5TA==","shasum":"42bafe088b734c2c022146e446cb67eb07234e6b","tarball":"https://registry.npmjs.org/@akoenig/sso/-/sso-1.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDuKoghHqZnpwV6mkrboBU7GKucCdBUZ6rJImUMNhdqaAiEAkvbb0jsHYSoZRGt1iphm4WHvGjuyn3pmm/sf76qEnm4="}]},"maintainers":[{"name":"akoenig","email":"akoenig@posteo.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sso-1.2.0.tgz_1497617372408_0.07127242488786578"}},"1.2.1":{"name":"@akoenig/sso","version":"1.2.1","dependencies":{"body-parser":"^1.17.2","cookie-parser":"^1.4.3","express-session":"^1.15.2","passport":"^0.3.2","passport-facebook":"^2.1.1","passport-local":"^1.0.0"},"devDependencies":{"express":"^4.15.3"},"gitHead":"921512ac0e9f49c2dce8aa844462833a00425971","description":"Opinionated wrapper around Passport.js. It supports logins via Facebook and local users.","_id":"@akoenig/sso@1.2.1","_npmVersion":"5.0.3","_nodeVersion":"8.1.2","_npmUser":{"name":"akoenig","email":"akoenig@posteo.de"},"dist":{"integrity":"sha512-AsxqCoMW634OmqFPEoWHf5CSn00oQi+nVGhe3f8RLYuJvDpx2XPP+XhWb67TVD1p/TqFfbXgNSs6IT6FhoqIsQ==","shasum":"4414914297dc79188a80bdae8750ed9eb2bedf90","tarball":"https://registry.npmjs.org/@akoenig/sso/-/sso-1.2.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEQY8xcIMQUZpQCdD6n4hqOVaisByX2Juq9Tcv5TY6JvAiEAovpNtmyyrYlrLtWfkjMwgBAXUugCmYTmyX3+tGfeLI0="}]},"maintainers":[{"name":"akoenig","email":"akoenig@posteo.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sso-1.2.1.tgz_1498227533978_0.7094998965039849"}},"1.2.2":{"name":"@akoenig/sso","version":"1.2.2","dependencies":{"body-parser":"^1.17.2","cookie-parser":"^1.4.3","express-session":"^1.15.2","passport":"^0.3.2","passport-facebook":"^2.1.1","passport-local":"^1.0.0"},"devDependencies":{"express":"^4.15.3"},"gitHead":"d1018626ed2be765f986d218236c4ef33fe4a1a9","description":"Opinionated wrapper around Passport.js. It supports logins via Facebook and local users.","_id":"@akoenig/sso@1.2.2","_npmVersion":"5.0.3","_nodeVersion":"8.1.2","_npmUser":{"name":"akoenig","email":"akoenig@posteo.de"},"dist":{"integrity":"sha512-AVvsxdCYiKxdkVUT+foQX1/rAD0miipXC0/Tb4ahr5bU+yWkygYARQa0VylGouVOiFekyUNM11s9QX7pFH/cxQ==","shasum":"01ea7df2750f4e6fadd8fea16080494c8ae47b08","tarball":"https://registry.npmjs.org/@akoenig/sso/-/sso-1.2.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDfrHd+MoydmmPRGax/nJTPbT0978/K2oofIozHQls4nAiBEdtosymg/L0qFrIR9u1vD7LNOMM9lT6lu8c9FcTZYkw=="}]},"maintainers":[{"name":"akoenig","email":"akoenig@posteo.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sso-1.2.2.tgz_1498227886946_0.9921079999767244"}}},"readme":"# @akoenig/sso\n\nOpinionated wrapper around Passport.js. It supports logins via Facebook and local users.\n\n## Installation\n\n```sh\nnpm install --save @akoenig/sso\n```\n\n## Usage\n\n### Facebook\n\nThe following describes the configuration for performing a Facebook SSO\n\n```js\nconst app = express();\n\nconst restricted = sso(app, {\n    facebook: {\n        clientID: \"<the-facebook-app-client-id>\",\n        clientSecret: \"<the-facebook-app-client-secret>\",\n        callbackURL: \"http://localhost:8080/auth/facebook/callback\",\n        successRedirect: \"/\",\n        failureRedirect: \"/login\",\n        authenticated: async (profile) => {\n            // Insert or Update in database\n        }\n    }\n});\n```\n\nThis results in a new handler which can be accessed via `GET /auth/facebook`. The user gets redirected to Facebook and has to perform the authentication process there. Afterwards the user will be send back to `callbackUrl` by Facebook.\n\n### Local\n\nThe following describes the configuration for performing a local SSO (own users in a database):\n\n```js\nconst restricted = sso(app, {\n    local: {\n        verify: (username, password, callback) => {\n            const user = YOUR_DATABASE.findUserByUsername(username);\n\n            if (!user || user.password !== password) {\n                return callback(null, false);\n            }\n\n            callback(null, user);\n        },\n        successRedirect: \"/\",\n        failureRedirect: \"/login\",\n    },\n});\n```\n\nThis registers the following route handler: `POST /auth/local`. You can perform a request against that route with the help of a form:\n\n```html\n<form action=\"/auth/local\" method=\"post\">\n    <input type=\"text\" name=\"username\">\n    <input type=\"password\" name=\"password\">\n\n    <input type=\"submit\" value=\"Login\">\n</form>\n```\n\nEach time the user submits that form, the provided `verify` function gets executed. You have to verify the user within that function by gathering the user from your database. The parameters `username` and `password` are filled with the values from the form.\n","maintainers":[{"name":"akoenig","email":"akoenig@posteo.de"}],"time":{"modified":"2022-06-12T14:27:13.090Z","created":"2017-05-11T08:43:31.838Z","1.0.0":"2017-05-11T08:43:31.838Z","1.1.0":"2017-05-28T06:06:45.563Z","1.2.0":"2017-06-16T12:49:33.296Z","1.2.1":"2017-06-23T14:18:54.882Z","1.2.2":"2017-06-23T14:24:48.290Z"},"readmeFilename":"readme.md"}