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:

  1. Create a suitable authentication method.
  2. Populate it with authentication data (credentials, etc).
  3. 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::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 os = openstack::Cloud::new(auth);

Creating an authentication method from environment variables:

use openstack;

let auth = openstack::auth::from_env().expect("Failed to authenticate");
let os = openstack::Cloud::new(auth);

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

Identity

Authentication method factory using Identity API V3.

NoAuth

Authentication method that provides no authentication.

PasswordAuth

Password authentication using Identity API V3.

Traits

AuthMethod

Trait for an authentication method.

BoxedClone

Helper trait to allow cloning of sessions.

Functions

from_env

Create an authentication method from environment variables.