Giter Club home page Giter Club logo

Comments (3)

profcturner avatar profcturner commented on June 16, 2024

Normally middleware would be the answer or @login_required decorators. The problem with the latter, in a CAS authenticated application, is that people are logged in, they just have an incomplete and orphaned user, so it's not enough to check for that, I think.

from wam.

profcturner avatar profcturner commented on June 16, 2024

Note that from: https://docs.djangoproject.com/en/2.1/ref/contrib/auth/#django.contrib.auth.backends.RemoteUserBackend

It seems possible to prevent Django from auto creating users. This may be useful because the User is created, but not the matching Staff or ExternalExaminer object.

RemoteUserBackend.create_unknown_user
True or False. Determines whether or not a user object is created if not already in the database Defaults to True.

It might be best to simply stop this behaviour for now, but some kind of self service initial registration would probably be better still.

Perhaps we need to create a new overridden version of RemoteUserBackend and hijack this function:

RemoteUserBackend.authenticate(request, remote_user)
The username passed as remote_user is considered trusted. This method simply returns the user object with the given username, creating a new user object if create_unknown_user is True.

Returns None if create_unknown_user is False and a User object with the given username is not found in the database.

request is an HttpRequest and may be None if it wasn’t provided to authenticate() (which passes it on to the backend).

But, we might have to ask the user if they are Staff or an ExternalExaminer, and there are (mild) security issues with allowing them to choose their initial package, and in the case of Staff, groups, so they would still be left orphaned, so to speak, or awaiting final touches.

from wam.

profcturner avatar profcturner commented on June 16, 2024

All views should now be appropriately decorated and guarded to redirect to login, or show forbidden status, so hopefully no random exceptions.

from wam.

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.