Skip to main content

Django authentication backend allowing admins to login as another user.

Project description

Django authentication back-end that allows one to login as someone else (an existing Django user allowed to login) without having to know their password.

Great for customer support and testing scenarios!

https://readthedocs.org/projects/django-act-as-auth/badge/?version=latest

Quickstart

Install djactasauth:

pip install djactasauth

Add it to your auth backends in settings:

import djactasauth
AUTHENTICATION_BACKENDS = (
    ...,
    'djactasauth.backends.OnlySuperuserCanActAsBackend',
    ...,
)

Configure the custom login view to take advantage of all the features in your urls.py:

from django.conf.urls import patterns, url
from djactasauth.views import PrefillLoginView
from testapp.views import whoami


urlpatterns = patterns(
    '',
    url(r'^login/$', PrefillLoginView.as_view(), {}, 'login'),
)

Then you can log in with username your_superuser_name/customer and password yourpassword.

The full documentation including release notes on read the docs. .. quickstart end

Contributing

As an open source project, we welcome contributions.

The code lives on github.

Reporting issues/improvements

Please open an issue on github or provide a pull request whether for code or for the documentation.

For non-trivial changes, we kindly ask you to open an issue, as it might be rejected. However, if the diff of a pull request better illustrates the point, feel free to make it a pull request anyway.

Pull Requests

  • for code changes

    • it must have tests covering the change. You might be asked to cover missing scenarios

    • the latest flake8 will be run and shouldn’t produce any warning

    • if the change is significant enough, documentation has to be provided

  • if you are not there already, add yourself to the Authors file

To trigger packaging, run make release on the master branch.

Setting up all Python versions

sudo apt-get -y install software-properties-common
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
for version in 3.9 3.10 3.11 3.12 3.13; do
  py=python$version
  if ! which ${py}; then
    sudo apt-get -y install ${py} ${py}-dev
  fi
done
sudo add-apt-repository --remove ppa:deadsnakes/ppa
sudo apt-get update

Code of Conduct

As it is a Django extension, it follows Django’s own Code of Conduct. As there is no mailing list yet, please just email one of the main authors (see setup.py file)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djactasauth-0.6.0.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djactasauth-0.6.0-py2.py3-none-any.whl (6.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file djactasauth-0.6.0.tar.gz.

File metadata

  • Download URL: djactasauth-0.6.0.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for djactasauth-0.6.0.tar.gz
Algorithm Hash digest
SHA256 af4268fa32e7587e1b8bb063b4e0899d6c7ff9b2749283e1f9ee8be681445c79
MD5 4817613c49cf95fd5dc18471ffc39a17
BLAKE2b-256 2ad43a647574d155a9eb62212dd66a996d23afd43831f2dcf20d13b2b0292f61

See more details on using hashes here.

File details

Details for the file djactasauth-0.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: djactasauth-0.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for djactasauth-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c8a5bf974286852af5f0901581aca3d95aadf5c923f8b808a526378bd761b10b
MD5 83d95eacd7fa627196914b5eaaf8a392
BLAKE2b-256 3bba4a36f06841d3862f697fb4ba4a38a885ea0d7b8c0a792ccdb81b1392b979

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page