fairdm.contrib.contributors.utils.tokens#
Signed, time-limited claim tokens.
Module Contents#
Functions#
Generate a signed, time-stamped claim token for a person. |
|
Validate a claim token and return the unclaimed person it names. |
API#
- generate_claim_token(person: fairdm.contrib.contributors.models.Person) str#
Generate a signed, time-stamped claim token for a person.
The token holds the person’s primary key and is validated by its signature, so nothing is stored.
Args: person: The person to generate the token for.
Returns: The signed token string.
- validate_claim_token(token_string: str) fairdm.contrib.contributors.models.Person | None#
Validate a claim token and return the unclaimed person it names.
Args: token_string: The signed token from
generate_claim_token.Returns: The person the token names, who has not yet claimed their profile.
Raises: ClaimingError: The signature is invalid, the token is older than
CLAIM_TOKEN_MAX_AGE, no person matches, or the person has already claimed their profile.