How to use the koa-passport.KoaPassport function in koa-passport

To help you get started, we’ve selected a few koa-passport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yrong / koa-neo4j / src / auth.js View on Github external
constructor(neo4jConnection, {secret, passwordMatches, tokenExpirationInterval,
        userCypherQueryFile, rolesCypherQueryFile} = {}) {
        this.neo4jConnection = neo4jConnection;
        this.passport = new KoaPassport();

        this.secret = secret;
        this.passwordMatches = passwordMatches;
        this.tokenExpirationInterval = tokenExpirationInterval || '1h';
        this.userQuery = userCypherQueryFile;
        this.rolesQuery = rolesCypherQueryFile;

        this.passport.use(
            new LocalStrategy((username, password, done) => this.getUser(username, password)
                .then(user => done(null, user))
                .catch(done))
        );

        // koa-passport uses generators which will be deprecated in koa v3,
        // below block should be refactored accordingly
        // The author of koa-passport has not considered the use cases of done(err),