Expand description
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 Cloud.
Using password authentication
Start with creating an Identity object which will guide you through setting all necessary values. PasswordAuth is the actual implementation of the authentication method trait.
Note that as of now, only project-scoped tokens are supported. An attempt to create unscoped tokens always fails. This restriction may be lifted in the future.
Examples
Creating an authentication method using project-scoped tokens:
use openstack;
let auth = openstack::auth::Password::new(
"https://my.cloud.com/identity",
"admin", "pa$$w0rd", "domain.com")
.expect("Invalid authentication URL")
.with_project_scope("project1", "domain.com");
let os = openstack::Cloud::new(auth);
Creating a session and a cloud from environment variables:
use openstack;
let session = openstack::auth::from_env().expect("Failed to authenticate");
let os = openstack::Cloud::from(session);
Creating a dummy authentication method for use against clouds that do not have actual authentication:
use openstack;
let auth = openstack::auth::NoAuth::new("https://my.cloud.com/some-service")
.unwrap();
let os = openstack::Cloud::new(auth);
Limitations
- Only Identity API v3 is supported and planned for support.
Structs
Traits
Functions
Session
from the config file.Session
from environment variables.