Skip to main content
PyPI Documentation Source https://img.shields.io/badge/code%20style-black-000000.svg

This project has tools for managing trusted user agents. For example, you might allow the user to indicate whether they are using a public or private computer and implement different policies for each. Or you might be using a two-factor authentication scheme, allowing the users to bypass the second factor on machines that they designate as trusted. This uses Django’s signed cookie facility and operates independently of sessions.

Short list of features:

  • request.agent.is_trusted tells you whether the request came from a trusted agent.

  • APIs to trust or revoke the agent that made a given request.

  • Global, per-user, and per-agent settings can set the duration of agent trust as well as an inactivity timeout.

  • Supports session-scoped agent trust for consistency of authorization policies.

  • Revoke all of a user’s previously trusted agents at any time.

The mechanisms by which a user is allowed to designate trusted agents is left entirely to clients of this library. For an application of this API using one-time passwords, see django-otp-agents, part of the django-otp suite.

Development

This project is built and managed with hatch. If you don’t have hatch, I recommend installing it with pipx: pipx install hatch.

pyproject.toml defines several useful scripts for development and testing. The default environment includes all dev and test dependencies for quickly running tests. The test environment defines the test matrix for running the full validation suite. Everything is executed in the context of the Django project in test/test_project.

As a quick primer, hatch scripts can be run with hatch run [<env>:]<script>. To run linters and tests in the default environment, just run hatch run check. This should run tests with your default Python version and the latest Django. Other scripts include:

  • manage: Run a management command via the test project. This can be used to generate migrations.

  • lint: Run all linters.

  • fix: Run tools that can automatically fix many linting errors.

  • test: Run all tests.

  • check: Run linters and tests.

  • warn: Run tests with all warnings enabled. This is especially useful for seeing deprecation warnings in new versions of Django.

  • cov: Run tests and print a code coverage report.

To run the full test matrix, run hatch run test:run. You will need multiple specific Python versions installed for this.

You can clean up the hatch environments with hatch env prune, for example to force dependency updates.

Metadata

Release files for django-agent-trust 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-agent-trust 1.1.0
File Size Uploaded
django_agent_trust-1.1.0.tar.gz 20.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-agent-trust 1.1.0
File Interpreter ABI Platform
django_agent_trust-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.6 kB

Release files / django_agent_trust-1.1.0.tar.gz

Download URL django_agent_trust-1.1.0.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a920ff9492aab4a4edc6d83d948f82e7429f48ab1a7949b76dce510555536cb5
BLAKE2b-256 checksum
How to use checksums
c0d257b6cbf52f60cc8b0ec6075a9604c3d6860933c7b6e5f6dd5c5136651591
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.24.0

Release files / django_agent_trust-1.1.0-py3-none-any.whl

Download URL django_agent_trust-1.1.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6226b6f5c9d03f22102fdd412b122f5b5062dd2473f7c642c7f742d309137ba4
BLAKE2b-256 checksum
How to use checksums
33e38edd7e44ccd461ed8f7cd6a5cb89a1fbc55ec4bc781de1e9919240cc09a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.24.0

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page