Skip to main content
CVAT supports multiple authentication methods for self-hosted deployments, providing flexibility for different organizational requirements.

Authentication Methods

CVAT implements the following authentication methods defined in cvat/settings/base.py:136-141:
  1. Token Authentication: API token-based authentication
  2. Access Token Authentication: Bearer token authentication
  3. Session Authentication: Cookie-based session authentication
  4. Basic Authentication: HTTP Basic authentication

Default Authentication Backends

Configured in cvat/settings/base.py:250-253:

Django Model Backend

The default Django authentication backend that authenticates against the PostgreSQL database using username/email and password.

Django-allauth Backend

Provides advanced authentication features including:
  • Email verification
  • Social authentication support
  • Account management
See cvat/settings/base.py:255-263 for allauth configuration.

REST API Authentication

REST API authentication classes defined in cvat/settings/base.py:136-141:

Token Authentication

Django REST Framework’s built-in token authentication. Users receive a token upon login that must be included in the Authorization header:

Access Token Authentication

Custom bearer token authentication for API access tokens. Implemented in cvat/apps/access_tokens/authentication.py:11-27. Tokens are passed in the Authorization header:
Key features:
  • Validates token against the database
  • Checks user active status
  • Updates last use timestamp
  • Raises AuthenticationFailed for invalid or expired tokens

Session Authentication

Cookie-based authentication for web browsers. Sessions are stored in Redis and managed by Django. Session configuration in cvat/settings/base.py:423:

Basic Authentication Extended

Custom implementation in cvat/apps/iam/authentication.py:12-26 that extends Django REST Framework’s BasicAuthentication with email verification:

Account Configuration

Account authentication settings in cvat/settings/base.py:256-263:

Username Requirements

Defined in cvat/settings/base.py:693:

Email Verification

Email verification can be configured to:
  • none: No email verification required (default)
  • optional: Email verification is optional
  • mandatory: Email must be verified before access is granted
To enable email verification, you need to configure email settings. See the Email Configuration section below.

Email Configuration Example

Create a custom settings file based on cvat/settings/email_settings.py:1-17:
Note: By default, EMAIL_BACKEND is set to None in cvat/settings/base.py:754, which will raise an error if email functionality is needed without proper configuration.

Identity and Access Management (IAM)

IAM settings in cvat/settings/base.py:223-233:

User Roles

Three built-in roles with descending priority:
  1. admin: Full system access
  2. user: Standard user access
  3. worker: Limited access for annotation workers

Password Validation

Password validators defined in cvat/settings/base.py:397-410:

Login URLs and Redirects

Defined in cvat/settings/base.py:233-234:

Open Policy Agent (OPA)

CVAT uses OPA for authorization decisions. Configuration in docker-compose.yml:313-330:
The OPA server fetches authorization rules from the CVAT server at /api/auth/rules.

API Rate Limiting

Throttle configuration in cvat/settings/base.py:158-163:
Anonymous users are limited to 100 requests per minute. Authenticated users have no throttle limit by default.

Custom Authentication Adapter

Custom account adapter in cvat/settings/base.py:696:

Security Settings

HTTPS Configuration

Configured in cvat/settings/base.py:601-609:

CORS Configuration

CORS headers defined in cvat/settings/base.py:585-596:

API Documentation

CVAT provides interactive API documentation with authentication support. Configuration in cvat/settings/base.py:617-689:
Access the API documentation at:
  • Swagger UI: http://your-host:8080/api/docs
  • ReDoc: http://your-host:8080/api/redoc
  • OpenAPI Schema: http://your-host:8080/api/schema

Next Steps

Additional Resources