The Forms Module¶
- class openstack_auth.forms.DummyAuth(user_id)[source]¶
A dummy Auth object
It is needed for _KeystoneAdapter to get the user_id from, but otherwise behaves as if it doesn’t exist (is falsy).
- get_headers(session, **kwargs)[source]¶
Fetch authentication headers for message.
This is a more generalized replacement of the older get_token to allow plugins to specify different or additional authentication headers to the OpenStack standard ‘X-Auth-Token’ header.
How the authentication headers are obtained is up to the plugin. If the headers are still valid they may be re-used, retrieved from cache or the plugin may invoke an authentication request against a server.
The default implementation of get_headers calls the get_token method to enable older style plugins to continue functioning unchanged. Subclasses should feel free to completely override this function to provide the headers that they want.
There are no required kwargs. They are passed directly to the auth plugin and they are implementation specific.
Returning None will indicate that no token was able to be retrieved and that authorization was a failure. Adding no authentication data can be achieved by returning an empty dictionary.
- Parameters:
session (keystoneauth1.session.Session) – The session object that the auth_plugin belongs to.
- Returns:
Headers that are set to authenticate a message or None for failure. Note that when checking this value that the empty dict is a valid, non-failure response.
- Return type:
dict
- class openstack_auth.forms.Login(*args, **kwargs)[source]¶
Form used for logging in a user.
Handles authentication with Keystone by providing the domain name, username and password. A scoped token is fetched after successful authentication.
A domain name is required if authenticating with Keystone V3 running multi-domain configuration.
If the user authenticated has a default project set, the token will be automatically scoped to their default project.
If the user authenticated has no default project set, the authentication backend will try to scope to the projects returned from the user’s assigned projects. The first successful project scoped will be returned.
Inherits from the base
django.contrib.auth.forms.AuthenticationForm
class for added security features.- clean()[source]¶
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media¶
Return all media required to render the widgets on this form.
- class openstack_auth.forms.Password(*args, **kwargs)[source]¶
Form used for changing user’s password without having to log in.
- clean()[source]¶
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media¶
Return all media required to render the widgets on this form.
- class openstack_auth.forms.TimeBasedOneTimePassword(*args, **kwargs)[source]¶
Form used for TOTP authentification
- clean()[source]¶
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media¶
Return all media required to render the widgets on this form.