django-management-auth


Namedjango-management-auth JSON
Version 0.0.0 PyPI version JSON
download
home_page
SummaryLogin to a Django application from a management command
upload_time2023-11-10 16:41:39
maintainer
docs_urlNone
authorJake Howard
requires_python>=3.8
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django management auth

![CI](https://github.com/RealOrangeOne/django-management-auth/workflows/CI/badge.svg)
![PyPI](https://img.shields.io/pypi/v/django-management-auth.svg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-management-auth.svg)
![PyPI - License](https://img.shields.io/pypi/l/django-management-auth.svg)

Login to a Django application from a management command.

## Installation

```
pip install django-management-auth
```

Then, add `management_auth` to `INSTALLED_APPS`.

Finally, add the required URLs:

```python
# urls.py

urlpatterns += [path(".login-as", include("management_auth.urls"))]
```

## Usage

Authentication happens using a short-lived signed URL, generated from a management command.

```
./manage.py login_as <username>
```

This will create a URL for `<username>`. By default, the URLs are valid for 60 seconds (configurable with `--timeout`).

### Fully-qualified URLs

Where possible, URLs, are displayed fully-qualified, such that they can be quickly clicked to log in.

- To specify manually, use `MANAGEMENT_AUTH_BASE_URL`
- For Wagtail users, `WAGTAILADMIN_BASE_URL` is used to create the URL.
- For `django.contrib.sites` users, `SITE_ID` is correctly considered

If no base URL is found, a relative path is shown.

## Design considerations

- Tokens are only valid for a short amount of time, intended to prevent reuse / sharing.
- Tokens are signed URLs, rather than requiring a database table. This means the validation view is faster and more lightweight, and a database leak doesn't risk exposing sessions.
- Because tokens are signed, they can be used multiple times (however this is a bad idea)


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "django-management-auth",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jake Howard",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/a8/77/cf5d04ec9acf2f56b0e14a44b6c9e3079480fd974db427a4172cb25ecff3/django_management_auth-0.0.0.tar.gz",
    "platform": null,
    "description": "# Django management auth\n\n![CI](https://github.com/RealOrangeOne/django-management-auth/workflows/CI/badge.svg)\n![PyPI](https://img.shields.io/pypi/v/django-management-auth.svg)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-management-auth.svg)\n![PyPI - License](https://img.shields.io/pypi/l/django-management-auth.svg)\n\nLogin to a Django application from a management command.\n\n## Installation\n\n```\npip install django-management-auth\n```\n\nThen, add `management_auth` to `INSTALLED_APPS`.\n\nFinally, add the required URLs:\n\n```python\n# urls.py\n\nurlpatterns += [path(\".login-as\", include(\"management_auth.urls\"))]\n```\n\n## Usage\n\nAuthentication happens using a short-lived signed URL, generated from a management command.\n\n```\n./manage.py login_as <username>\n```\n\nThis will create a URL for `<username>`. By default, the URLs are valid for 60 seconds (configurable with `--timeout`).\n\n### Fully-qualified URLs\n\nWhere possible, URLs, are displayed fully-qualified, such that they can be quickly clicked to log in.\n\n- To specify manually, use `MANAGEMENT_AUTH_BASE_URL`\n- For Wagtail users, `WAGTAILADMIN_BASE_URL` is used to create the URL.\n- For `django.contrib.sites` users, `SITE_ID` is correctly considered\n\nIf no base URL is found, a relative path is shown.\n\n## Design considerations\n\n- Tokens are only valid for a short amount of time, intended to prevent reuse / sharing.\n- Tokens are signed URLs, rather than requiring a database table. This means the validation view is faster and more lightweight, and a database leak doesn't risk exposing sessions.\n- Because tokens are signed, they can be used multiple times (however this is a bad idea)\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Login to a Django application from a management command",
    "version": "0.0.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b48f30a7df33ad2ec9d9736dc82de6f66dd876c5c2d5fdcca3ebc72bb26f9457",
                "md5": "995defe822454f136cc9adfdc61d7aac",
                "sha256": "7044f3321dd3d74edb92a34326e680814382e0f5460d07cccd5e6c7466e0c5f3"
            },
            "downloads": -1,
            "filename": "django_management_auth-0.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "995defe822454f136cc9adfdc61d7aac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5503,
            "upload_time": "2023-11-10T16:41:37",
            "upload_time_iso_8601": "2023-11-10T16:41:37.939172Z",
            "url": "https://files.pythonhosted.org/packages/b4/8f/30a7df33ad2ec9d9736dc82de6f66dd876c5c2d5fdcca3ebc72bb26f9457/django_management_auth-0.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a877cf5d04ec9acf2f56b0e14a44b6c9e3079480fd974db427a4172cb25ecff3",
                "md5": "ab1d2b01a0ecc99d7e2e9f54c0ffc6e5",
                "sha256": "9050f504bf24a0e31610ca73ccceab24bcae98197a87ccd2a49e7efa19b5461b"
            },
            "downloads": -1,
            "filename": "django_management_auth-0.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ab1d2b01a0ecc99d7e2e9f54c0ffc6e5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8840,
            "upload_time": "2023-11-10T16:41:39",
            "upload_time_iso_8601": "2023-11-10T16:41:39.314035Z",
            "url": "https://files.pythonhosted.org/packages/a8/77/cf5d04ec9acf2f56b0e14a44b6c9e3079480fd974db427a4172cb25ecff3/django_management_auth-0.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-10 16:41:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "django-management-auth"
}
        
Elapsed time: 0.52112s