[−][src]Struct openstack::auth::Password
Password authentication using Identity API V3.
For any Identity authentication you need to know auth_url, which is an authentication endpoint
of the Identity service. For the Password authentication you also need:
- User name and password.
- Domain of the user.
- Name of the project to use.
- Domain of the project.
Note: currently only names are supported for user, user domain and project domain. ID support is coming later.
Start with creating a Password object using new, then add a project scope
with with_project_scope:
let auth = osauth::identity::Password::new( "https://cloud.local/identity", "admin", "pa$$w0rd", "Default" ) .expect("Invalid auth_url") .with_project_scope("project1", "Default"); let session = osauth::Session::new(auth);
If your cloud has several regions, pick one using with_region:
let auth = osauth::identity::Password::new( "https://cloud.local/identity", "admin", "pa$$w0rd", "Default" ) .expect("Invalid auth_url") .with_project_scope("project1", "Default") .with_region("US-East"); let session = osauth::Session::new(auth);
By default, the public endpoint interface is used. If you would prefer to default to another
one, you can set it with
with_default_endpoint_interface.
let auth = osauth::identity::Password::new( "https://cloud.local/identity", "admin", "pa$$w0rd", "Default" ) .expect("Invalid auth_url") .with_project_scope("project1", "Default") .with_default_endpoint_interface("internal");
The authentication token is cached while it's still valid or until refresh is called.
Methods
impl Password[src]
pub fn new<U, S1, S2, S3>(
auth_url: U,
user_name: S1,
password: S2,
user_domain_name: S3
) -> Result<Password, Error> where
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
U: IntoUrl, [src]
auth_url: U,
user_name: S1,
password: S2,
user_domain_name: S3
) -> Result<Password, Error> where
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
U: IntoUrl,
Create a password authentication.
pub fn new_with_client<U, S1, S2, S3>(
auth_url: U,
client: Client,
user_name: S1,
password: S2,
user_domain_name: S3
) -> Result<Password, Error> where
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
U: IntoUrl, [src]
auth_url: U,
client: Client,
user_name: S1,
password: S2,
user_domain_name: S3
) -> Result<Password, Error> where
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
U: IntoUrl,
Create a password authentication with the provided HTTP client.
pub fn default_endpoint_interface(&self) -> &String[src]
The default endpoint interface.
pub fn set_default_endpoint_interface<S>(&mut self, endpoint_interface: S) where
S: Into<String>, [src]
S: Into<String>,
Set the default endpoint interface to use.
pub fn set_region<S>(&mut self, region: S) where
S: Into<String>, [src]
S: Into<String>,
Set a region for this authentication method.
pub fn set_project_scope<S1, S2>(
&mut self,
project_name: S1,
project_domain_name: S2
) where
S1: Into<String>,
S2: Into<String>, [src]
&mut self,
project_name: S1,
project_domain_name: S2
) where
S1: Into<String>,
S2: Into<String>,
Scope authentication to the given project.
This is required in the most cases.
pub fn with_default_endpoint_interface<S>(
self,
endpoint_interface: S
) -> Password where
S: Into<String>, [src]
self,
endpoint_interface: S
) -> Password where
S: Into<String>,
Convert this session into one using the given endpoint interface.
pub fn with_project_scope<S1, S2>(
self,
project_name: S1,
project_domain_name: S2
) -> Password where
S1: Into<String>,
S2: Into<String>, [src]
self,
project_name: S1,
project_domain_name: S2
) -> Password where
S1: Into<String>,
S2: Into<String>,
Scope authentication to the given project.
pub fn with_region<S>(self, region: S) -> Password where
S: Into<String>, [src]
S: Into<String>,
Set a region for this authentication method.
pub fn user_name(&self) -> &String[src]
Use user in preparation for user ID support.
User name.
pub fn user(&self) -> &IdOrName[src]
User name or ID.
pub fn project(&self) -> Option<&IdOrName>[src]
Project name or ID (if project scoped).
Trait Implementations
impl AuthType for Password[src]
fn region(&self) -> Option<String>[src]
Get region.
fn request(
&self,
method: Method,
url: Url
) -> Box<dyn Future<Item = RequestBuilder, Error = Error> + 'static + Send>[src]
&self,
method: Method,
url: Url
) -> Box<dyn Future<Item = RequestBuilder, Error = Error> + 'static + Send>
Create an authenticated request.
fn get_endpoint(
&self,
service_type: String,
endpoint_interface: Option<String>
) -> Box<dyn Future<Item = Url, Error = Error> + 'static + Send>[src]
&self,
service_type: String,
endpoint_interface: Option<String>
) -> Box<dyn Future<Item = Url, Error = Error> + 'static + Send>
Get a URL for the requested service.
fn refresh(&self) -> Box<dyn Future<Item = (), Error = Error> + 'static + Send>[src]
Refresh the cached token and service catalog.
impl Clone for Password[src]
impl Debug for Password[src]
impl Identity for Password[src]
Auto Trait Implementations
impl Send for Password
impl Sync for Password
impl Unpin for Password
impl !UnwindSafe for Password
impl !RefUnwindSafe for Password
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,