Giter VIP home page Giter VIP logo

passport-unique-token's People

Contributors

dependabot[bot] avatar lughino avatar renovate-bot avatar semantic-release-bot avatar ypelud avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

passport-unique-token's Issues

UniqueTokenStrategy is not a constructor

I am getting a TypeError: UniqueTokenStrategy is not a constructor error when trying to use this package. My configuration is as follows:

const validationPassport = require('passport');
const UniqueTokenStrategy = require('passport-unique-token').Strategy;

const uniqueTokenStrategyOptions = {
  tokenQuery: 'sessionToken',
  tokenHeader: 'sessionToken',
  tokenField: 'sessionToken',
  tokenParams: 'sessionToken',
  failedOnMissing: true
};

validationPassport.use(new UniqueTokenStrategy(uniqueTokenStrategyOptions, function(token, done) {
  validationSessionModel.validateAdminSessionToken(token, validationSessionModel.validationSessionModel, function (err, info) {
    if (err) {
      logger.error("Authentication error with token " + token + ': ' + JSON.stringify(err));
      return done(err);
    }
    if (!token) {
      logger.warn("Session not found for token " + token);
      return done(null, false);
    }
    logger.info("Session found for token " + token);
    return done(null, info, { scope: 'all' });
  });
})
);

And the authentication is:

router.post('/create',
	authenticationHelper.validationPassport.authenticate('token'),
	validationAttemptController.create
);

Can you help me out?

Retrieve query fields directly from URL

I'm using this strategy for authenticating requests that possibly could not have the req.query filled. I was wondering if there a way to change this by retrieving the query fields directly parsing the URL instead of using req.query. I actually am stuck by this, in case I can make a PR.

Check token from header

Hi, thanks for your module.
I am going to use it in my project, but I found that it can't check token from header. Can you please add this feature?

Issue in the example for using a custom delegate function

There is a small issue on the example given:

app.put("/animals/dogs", authenticate, function (req, res) {
	   // User authenticated and can be found in req.user
});

function authenticate(req, res, next) {
    passport.authenticate("token", function (err, user, info) {
        if (err) {
            return next(err);
        }

        if (!user) {
            res.status(401).json({message: "Incorrect token credentials"});
        }

        req.user = user;
        next();
    });
}

the passport.authenticate returns a function that needs to be called. Should be:

app.put('/animals/dogs', authenticate, function (req, res) {
	   // User authenticated and can be found in req.user
});

function authenticate(req, res, next) {
    passport.authenticate('token', function (err, user, info) {
        if (err) {
            return next(err);
        }

        if (!user) {
            res.status(401).json({message: "Incorrect token credentials"});
        }

        req.user = user;
        next();
    })(req, res, next);
}

Otherwise it stops the application flow.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @types/supertest to v6
  • chore(deps): update dependency eslint-config-prettier to v9
  • chore(deps): update dependency eslint-plugin-prettier to v5
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency jest-junit to v16
  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency typescript to v5
  • chore(deps): update jest monorepo to v29 (major) (@types/jest, jest, ts-jest)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

circleci
.circleci/config.yml
  • circleci/node 14.17.6
  • circleci/node 16.13.1
npm
package.json
  • passport-strategy ^1.0.0
  • @commitlint/cli ^13.0.0
  • @commitlint/config-conventional ^13.0.0
  • @commitlint/prompt-cli ^13.0.0
  • @semantic-release/git ^9.0.0
  • @types/express ^4.17.13
  • @types/jest ^27.0.0
  • @types/node ^16.3.0
  • @types/passport-strategy ^0.2.35
  • @types/supertest ^2.0.11
  • @typescript-eslint/eslint-plugin ^4.28.2
  • @typescript-eslint/parser ^4.28.2
  • body-parser ^1.19.0
  • chai-passport-strategy ^1.0.1
  • commitizen ^4.2.4
  • cross-env ^7.0.3
  • cz-customizable ^6.3.0
  • eslint ^7.30.0
  • eslint-config-prettier ^8.3.0
  • eslint-plugin-import ^2.23.4
  • eslint-plugin-prettier ^4.0.0
  • express ^4.17.1
  • husky ^7.0.1
  • is-ci ^3.0.0
  • jest ^27.0.6
  • jest-junit ^12.2.0
  • lint-staged ^11.0.0
  • passport ^0.4.1
  • prettier ^2.3.2
  • semantic-release ^18.0.0
  • supertest ^6.1.3
  • ts-jest ^27.0.3
  • typescript ^4.3.5
  • node >= 12

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.