Gestion de l’authentification

Modèles de données

class core.accounts.models.LegacyAccountProfile(*args, **kwargs)

Defines the information associated with a legacy account that was imported from a user DB.

This model associates a user instance with informations related to its previous database:

  • which database?
  • which identifier into this database?
  • ...
legacy_id = None

Defines the legacy identifier associated with the account (the ID in the legacy DB).


The legacy profile can be associated with an organisation.

origin = None

Defines the origin of the legacy profile (the original database).

sync_date = None

Date at which the legacy account was last synchronized with its database.

synced_with_origin = None

Defines if the legacy account is synced with the original database. Defaults to False.


The user associated with the considered legacy profile.


class core.accounts.hashers.DrupalPasswordHasher

Allows to authenticate users using Drupal 7 passwords.

The passwords that are imported from a Drupal database should be prefixed with ‘drupal$’. This hasher is inspired from the following snippet:

class core.accounts.hashers.PBKDF2WrappedAbonnementsSHA1PasswordHasher

This hasher wraps existing ‘abonnements’ SHA1 passwords.

This password hasher allow to store weak hashes from the ‘abonnement’ DB (SHA1) using the PBKDF2(AbonnementsSHA1(password)) algorithm.

encode(password, salt, iterations=None, legacy_salt=None)

Encodes a password using the Abonnements-SHA1 algorithm from the legacy system.

encode_sha1_hash(sha1_hash, salt, iterations=None)

Encodes a SHA1-password that comes from the ‘abonnement’ DB.

sha1(password, legacy_salt=None)

Encodes using the crypt function from the legacy system.