Code Monkey home page Code Monkey logo

Comments (3)

desislavaa avatar desislavaa commented on August 21, 2024 1

That was exactly my question, thank you for the quick response!

We thought about a wrapper function of New, let's say NewWithAuthorizer, where the user can pass an implementation of an Authorizer interface or something like that, but that would work only for our particular use case (however, if you like the idea, we'll be glad to contribute it).

If we pass user-provided middlewares instead, a problem would be their order, so the already present approach with adding them manually looks more suitable.
Adding them at the end is also possible at the moment, since New returns a router.
If we think of anything that could possibly solve that, we'll be happy to share it.

Thanks again!

from brokerapi.

cf-gitbot avatar cf-gitbot commented on August 21, 2024

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/168801074

The labels on this github issue will be updated when the story is started.

from brokerapi.

kirederik avatar kirederik commented on August 21, 2024

Hi @desislavaa,

Just to guarantee that we understand your question:

You want to implement a custom auth middleware and reuse all the other broker middlewares (as defined here). That means that in your code you would have a function similar to brokerapi.New, just changing the auth middleware to your custom implementation. Your question is whether or not this is a good idea/recommended?

If so, yes. Feel free to reuse the broker middlewares. That's actually why we have AttachRoutes as a public method.

We would also be curious to hear if you have any ideas on how to make it easier for users of the brokerapi to provide custom middlewares.

Let us know if you need further help.

Thanks!

from brokerapi.

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.