Backends¶
RestAuth uses backends to store data. RestAuth knows three different types of backends:
- User backends
- Store user data.
- Property backends
- Store user properties.
- Group backends
- Store groups.
RestAuth can use different backends for each individual task, but property- and
group-backends may depend on a specific user-backend being used. Most
prominently, the default backends
DjangoPropertyBackend
and
DjangoGroupBackend
require that you
also use DjangoUserBackend
.
Configuring backends¶
To configure what backend to use, use the USER_BACKEND
,
PROPERTY_BACKEND
and GROUP_BACKEND
settings. Backends
shipping with RestAuth are listed below, if you want to develop your own
backend(s), please see Custom backends.
Note that each backend may use settings not listed in the settings reference. For backend-specific settings, please consult the backends documentation.
User backends¶
A user backend handles the most basic operations related to users. The user backend is used to create and delete users as well as to check and update a users password.
-
class
RestAuth.backends.django_backend.
DjangoUserBackend
[source]¶ Use the standard Django ORM to store user data.
This backend should be ready-to use as soon as you have configured your database.
All settings used by this backend are documented in the settings reference.
Property backends¶
A property backend handles user properties such as email, full name and so on.
-
class
RestAuth.backends.django_backend.
DjangoPropertyBackend
[source]¶ Use the standard Django ORM to store user properties.
This backend should be ready-to use as soon as you have configured your database. This backend requires that you also use the
DjangoUserBackend
.All settings used by this backend are documented in the settings reference.
-
class
RestAuth.backends.redis_backend.
RedisPropertyBackend
[source]¶ Store properties in a Redis key/value store.
This backend enables you to store user properties in a key/value store. Note that the backend is not really faster if you only have a few hundred users.
This backend uses a few additional settings in RestAuth/localsettings.py:
REDIS_HOST
- The hostname where the redis installation runs.
Default:
'localhost'
. REDIS_PORT
- The port ot he redis installation. Default:
6379
. REDIS_DB
- The id of the Redis database. Default:
0
.
Note
Transaction support of this backend is limited. Basic transaction management works, but no sensible values are returned for method calls within a transaction.
Group backends¶
A group backend handles user groups. Groups may be used by a service for authorization or similar purposes.
-
class
RestAuth.backends.django_backend.
DjangoGroupBackend
[source]¶ Use the standard Django ORM to store groups.
This backend should be ready-to use as soon as you have configured your database. This backend requires that you also use the
DjangoUserBackend
.All settings used by this backend are documented in the settings reference.