Skip to main content

No project description provided

Project description

aboutcode.api_auth

Secured APIToken model and related APITokenAuthentication class.

Install

pip install aboutcode.api_auth

Define the APIToken model

In your main models.py module:

from aboutcode.api_auth import AbstractAPIToken

class APIToken(AbstractAPIToken):
    class Meta:
        verbose_name = "API Token"

Generate and apply schema migration:

$ ./manage.py makemigrations
$ ./manage.py migrate

Authenticator settings

Declare your APIToken model location in the API_TOKEN_MODEL setting:

API_TOKEN_MODEL = "app.APIToken"  # noqa: S105

Declare the APITokenAuthentication authentication class as one of the REST_FRAMEWORK.DEFAULT_AUTHENTICATION_CLASSES:

REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": (
        "aboutcode.api_auth.APITokenAuthentication",
    ),
}

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

aboutcode_api_auth-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

aboutcode_api_auth-0.1.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file aboutcode_api_auth-0.1.0.tar.gz.

File metadata

  • Download URL: aboutcode_api_auth-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aboutcode_api_auth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f186f1b53cb14087b0e3c99fba6a4812679b3a810f2ca8645955bb0838b1771
MD5 78c8500e61e3d8cc2145a72fa04666da
BLAKE2b-256 941a0786b8dd83b4f7b84797ce5fe84b3363bfc7995f0a77afb957fa87e7a46f

See more details on using hashes here.

Provenance

The following attestation bundles were made for aboutcode_api_auth-0.1.0.tar.gz:

Publisher: publish-pypi-release-aboutcode-api-auth.yml on aboutcode-org/dejacode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aboutcode_api_auth-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aboutcode_api_auth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee17edb5811167642affadb28e17187b5b226de99b861135600c5794ef127bee
MD5 8b7f6fdbb94ccf0f78bb83ff35a85a85
BLAKE2b-256 0be156c2622c69095e78e6a3c313d52a25b39c81c0cea3c9b2718669327f9fc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for aboutcode_api_auth-0.1.0-py3-none-any.whl:

Publisher: publish-pypi-release-aboutcode-api-auth.yml on aboutcode-org/dejacode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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