maasserver.models.user

MAAS-specific helpers for User.

Functions

create_auth_token(user) Create new Token and Consumer (OAuth authorisation) for user.
create_user(sender, instance, created, **kwargs)
get_auth_tokens(user) Fetches all the user’s OAuth tokens.
get_creds_tuple(token) Return API credentials as tuple, as used in MAASOAuth.

Classes

Consumer(id, name, description, key, secret, ...)
Token(id, key, secret, verifier, token_type, ...)
maasserver.models.user.create_auth_token(user)[source]

Create new Token and Consumer (OAuth authorisation) for user.

Parameters:user (User) – The user to create a token for.
Returns:The created Token.
Return type:piston.models.Token
maasserver.models.user.get_auth_tokens(user)[source]

Fetches all the user’s OAuth tokens.

Returns:A QuerySet of the tokens.
Return type:django.db.models.query.QuerySet
maasserver.models.user.get_creds_tuple(token)[source]

Return API credentials as tuple, as used in MAASOAuth.

Returns a tuple of (consumer key, resource token, resource secret). The consumer secret is hard-wired to the empty string.