Installations
npm install exegesis-passport
Developer
exegesis-js
Developer Guide
Module System
CommonJS
Min. Node Version
>=6.0.0
Typescript Support
Yes
Node Version
10.16.3
NPM Version
6.11.1
Statistics
3 Stars
157 Commits
3 Watching
44 Branches
2 Contributors
Updated on 13 Dec 2021
Languages
TypeScript (97.17%)
JavaScript (2.83%)
Total Downloads
Cumulative downloads
Total Downloads
29,393
Last day
-36.8%
12
Compared to previous day
Last week
-26%
74
Compared to previous week
Last month
52.6%
261
Compared to previous month
Last year
2%
1,746
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
exegesis-passport
This package lets you use passport to authenticate requests in Exegesis.
1import passport from "passport"; 2import * as exegesisExpress from "exegesis-express"; 3import exegesisPassport from "exegesis-passport"; 4import { BasicStrategy } from "passport-http"; 5 6passport.use( 7 "basic", 8 new BasicStrategy((username, password, done) => { 9 if (password === "secret") { 10 done(null, { user: username }); 11 } else { 12 done(null, false); 13 } 14 }) 15); 16 17async function createServer() { 18 const app = express(); 19 20 app.use(passport.initialize()); 21 22 app.use( 23 await exegesisExpress.middleware( 24 path.resolve(__dirname, "./openapi.yaml"), 25 { 26 // Other options go here... 27 authenticators: { 28 // Authenticate the "basicAuth" security scheme using passport's 'basic' strategy. 29 basicAuth: exegesisPassport("basic"), 30 // Uses Passport's build-in 'session' strategy. 31 sessionToken: exegesisPassport("session", { 32 isPresent: (context) => !!context.req.session, 33 }), 34 }, 35 } 36 ) 37 ); 38 39 const server = http.createServer(app); 40 server.listen(3000); 41}
API
exegesisPassport(passport, strategyName[, options])
Returns an Exegesis authenticator that will authenticate against the given strategyName. This will not set the user in the session.
options.converter
is a function(user, pluginContext)
which takes in the user
authenticated by passport and returns a {user, roles, scopes}
object for
Exegesis.
options.isPresent
is a function(pluginContext, authInfo)
which returns true
if the given security credentials are present, and false otherwise. Passport does
not distinguish between an authentication attempt which did provide credentials
and an authentication attempt which provided incorrect credentials, but
Exegesis does. If this option is missing, then exgesis-passport will attempt
to work out of the field is present, but in most cases this will end up with
exegesis-passport treating missing credentials the same as bad credentials.
If options.passportOptions
if provided, this will be passed to the passport
strategy when it is run.
exegesisPassport(strategy[, options])
You can pass a Passport strategy directly to Exegesis to use the strategy without even having Passport installed:
1const basicStrategy = new BasicStrategy((username, password, done) => { 2 if (password === "secret") { 3 done(null, { user: username }); 4 } else { 5 done(null, false); 6 } 7}); 8 9exegesisOptions.authenticators = { 10 basicAuth: exegesisPassport(basicStrategy), 11};
options
are the same as for exegesisPassport(passport, strategyName[, options])
.
Passport
Want to learn more about passport? API docs here.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/github-ci.yaml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-ci.yaml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/exegesis-js/exegesis-passport/github-ci.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-ci.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/exegesis-js/exegesis-passport/github-ci.yaml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/github-ci.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/exegesis-js/exegesis-passport/github-ci.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-ci.yaml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/exegesis-js/exegesis-passport/github-ci.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/github-ci.yaml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/exegesis-js/exegesis-passport/github-ci.yaml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/github-ci.yaml:17
- Warn: npmCommand not pinned by hash: .github/workflows/github-ci.yaml:34
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 0 out of 2 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 22 are checked with a SAST tool
Score
3.1
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More