Giter Site home page Giter Site logo

Examples with passport about overnight HOT 4 CLOSED

EvanBurbidge avatar EvanBurbidge commented on August 14, 2024
Examples with passport

from overnight.

Comments (4)

seanpmaxwell avatar seanpmaxwell commented on August 14, 2024 1

If you need to use multiple middleware's you can pass them as an array:

@Get('/protected')
@Middleware([checkToken, checkMethod])
method...

from overnight.

seanpmaxwell avatar seanpmaxwell commented on August 14, 2024

I think this is what you are looking for: https://github.com/seanpmaxwell/overnight/blob/master/sample-project/src/controllers/JwtPracticeController.ts. There are quite a few examples in the sample project. As far as Mongo integration goes. It wouldn't really change the way you interact with mongo. What I would do is create a separate DAO (data-access-object) class, put my mongo queries in there, return a promise, then call those methods in your controller.

Also it's not the same approach as passport. Passport (what I thought) was kinda of a wrapper for your API logic and all it does is say which logic to execute and can channel all your logic back to a single async call when finished. But I haven't used passport extensively. @overnight/jwt is to sign a token, an protect and API with middleware.

from overnight.

EvanBurbidge avatar EvanBurbidge commented on August 14, 2024

@seanpmaxwell could be worth some experimentation with passportjs also could be cool to have a look at multiple authentication middlewares on a single route e.g.

@Get('/protected')
@Middleware(checkToken)
@Middleware(checkScope)
method...

from overnight.

EvanBurbidge avatar EvanBurbidge commented on August 14, 2024

Awesome! Thanks for the insights! looking forward to getting stuck into this! :)

from overnight.

Related Issues (20)

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.