archivebox.api.auth

Module Contents

Classes

APITokenAuthCheck

The base class for authentication methods that use an api.models.APIToken

UserPassAuthCheck

The base class for authentication methods that use a username & password

HeaderTokenAuth

Allow authenticating by passing X-API-Key=xyz as a request header

BearerTokenAuth

Allow authenticating by passing Bearer=xyz as a request header

QueryParamTokenAuth

Allow authenticating by passing api_key=xyz as a GET/POST query parameter

UsernameAndPasswordAuth

Allow authenticating by passing username & password via HTTP Basic Authentication (not recommended)

Functions

get_or_create_api_token

auth_using_token

Given an API token string, check if a corresponding non-expired APIToken exists, and return its user

auth_using_password

Given a username and password, check if they are valid and return the corresponding user

Data

API_AUTH_METHODS

API

archivebox.api.auth.get_or_create_api_token(user)[source]
archivebox.api.auth.auth_using_token(token, request: Optional[django.http.HttpRequest] = None) Optional[django.contrib.auth.models.AbstractBaseUser][source]

Given an API token string, check if a corresponding non-expired APIToken exists, and return its user

archivebox.api.auth.auth_using_password(username, password, request: Optional[django.http.HttpRequest] = None) Optional[django.contrib.auth.models.AbstractBaseUser][source]

Given a username and password, check if they are valid and return the corresponding user

class archivebox.api.auth.APITokenAuthCheck[source]

The base class for authentication methods that use an api.models.APIToken

authenticate(request: django.http.HttpRequest, key: Optional[str] = None) Optional[django.contrib.auth.models.AbstractBaseUser][source]
class archivebox.api.auth.UserPassAuthCheck[source]

The base class for authentication methods that use a username & password

authenticate(request: django.http.HttpRequest, username: Optional[str] = None, password: Optional[str] = None) Optional[django.contrib.auth.models.AbstractBaseUser][source]
class archivebox.api.auth.HeaderTokenAuth[source]

Bases: archivebox.api.auth.APITokenAuthCheck, ninja.security.APIKeyHeader

Allow authenticating by passing X-API-Key=xyz as a request header

param_name[source]

‘X-ArchiveBox-API-Key’

class archivebox.api.auth.BearerTokenAuth[source]

Bases: archivebox.api.auth.APITokenAuthCheck, ninja.security.HttpBearer

Allow authenticating by passing Bearer=xyz as a request header

class archivebox.api.auth.QueryParamTokenAuth[source]

Bases: archivebox.api.auth.APITokenAuthCheck, ninja.security.APIKeyQuery

Allow authenticating by passing api_key=xyz as a GET/POST query parameter

param_name[source]

‘api_key’

class archivebox.api.auth.UsernameAndPasswordAuth[source]

Bases: archivebox.api.auth.UserPassAuthCheck, ninja.security.HttpBasicAuth

Allow authenticating by passing username & password via HTTP Basic Authentication (not recommended)

archivebox.api.auth.API_AUTH_METHODS[source]

None