Code Monkey home page Code Monkey logo

django-basicauth's People

Contributors

c-bata avatar hirokiky avatar rbarrois avatar rhoboro avatar rhymes avatar therefromhere 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  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  avatar

django-basicauth's Issues

How to use django-basicauth with CBV?

Hi,

could you please provide an example how to use django-basicauth with class-based-views?

I just want to have one CBV decorated. I would like to avoid a middleware.

Thank you

Add a Django middleware version

Hi,

I'm interested in getting a middleware version of this feature; are you interesting in my contributing it?

If so, do you have any speicifc expectations on incoming pull requests?

Thanks!

apply basic auth to all endpoints except for one (or excluded pattern)

Hi.
Thanks for this package. I am using it to apply a basic auth restriction to staging deploys for a couple of my websites.

I host my sites on AWS behind an Elastic Load Balancer (ELB). When you set up an ELB, you give it a 'health check' URL. The Load Balancer periodically requests this URL and checks the responses status is 200 OK to ensure the server is 'healthy'. If it gets anything other than a 200 OK, it marks the server as unhealthy. The load balancer doesn't have the option to pass auth credentials.

What this means is I want to set up my staging deploys with basic auth applied to every endpoint except for one which isn't protected so that the load balancer can ping that endpoint and get a 200 OK rather than a 401 Unauthorized. Every other route should be behind basic auth. For obvious reasons, it is cumbersome to decorate every view other than one with @basic_auth_required so they way I've done this is by subclassing BasicAuthMiddleware so that I can turn on basic auth for everything but then whitelist one endpoint using a regex. I've taken inspiration from the old django-moat package which is no longer maintained but did have this feature.
example: https://github.com/DemocracyClub/EveryElection/blob/master/every_election/apps/core/middleware.py

2 questions:

  1. Is there a better way of doing this that I am missing?
  2. If not, would you accept a PR to add this feature to the package?

Cheers

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.