Module openstack::auth
[−]
[src]
Authentication modules.
Usually, accessing OpenStack services requires authentication. This module provides a way to authenticate against an Identity service, as well as simple authentication implementations for standalone use.
The usual workflow for connecting to OpenStack API is as follows:
- Create a suitable authentication method.
- Populate it with authentication data (credentials, etc).
- Create a Session by using the Session constructor or the session method.
- Pass a reference to the resulting session to various API managers.
See identity module for more details on how to use authentication agaist an Identity service.
Examples
Creating an authentication method using projet-scoped tokens:
use openstack::auth::Identity; use openstack::Session; let auth = Identity::new("https://my.cloud.com/identity").unwrap() .with_user("admin", "pa$$w0rd", "My Domain") .with_project_scope("project1", "My Domain") .create().expect("Failed to authenticate"); let session = Session::new(auth);
Creating an authentication method from environment variables:
use openstack::auth::Identity; use openstack::Session; let auth = Identity::from_env().expect("Failed to authenticate"); let session = Session::new(auth);
Creating a dummy authentication method for use against clouds that do not have actual authentication:
use openstack::auth::NoAuth; use openstack::Session; let auth = NoAuth::new("https://my.cloud.com/some-service").unwrap(); let session = Session::new(auth);
Limitations
- Only Identity API v3 is supported and planned for support.
Reexports
pub use self::identity::Identity; |
Modules
identity |
OpenStack Identity V3 API support for access tokens. |
Structs
NoAuth |
Authentication method that provides no authentication. |
SimpleToken |
Plain authentication token without additional details. |
Traits
Method |
Trait for an authentication method. |
Token |
Trait for authentication token implementations. |