[−][src]Struct osauth::identity::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
U: IntoUrl,
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
[src]
auth_url: U,
user_name: S1,
password: S2,
user_domain_name: S3
) -> Result<Password, Error> where
U: IntoUrl,
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
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
U: IntoUrl,
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
[src]
auth_url: U,
client: Client,
user_name: S1,
password: S2,
user_domain_name: S3
) -> Result<Password, Error> where
U: IntoUrl,
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
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) -> Self where
S: Into<String>,
[src]
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) -> Self where
S: Into<String>,
[src]
S: Into<String>,
Set a region for this authentication method.
pub fn user_name(&self) -> &String
[src]
User name.
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> + Send>
[src]
&self,
method: Method,
url: Url
) -> Box<dyn Future<Item = RequestBuilder, Error = Error> + Send>
Create an authenticated request.
fn get_endpoint(
&self,
service_type: String,
endpoint_interface: Option<String>
) -> Box<dyn Future<Item = Url, Error = Error> + Send>
[src]
&self,
service_type: String,
endpoint_interface: Option<String>
) -> Box<dyn Future<Item = Url, Error = Error> + Send>
Get a URL for the requested service.
fn refresh(&self) -> Box<dyn Future<Item = (), Error = Error> + Send>
[src]
Refresh the cached token and service catalog.
impl Identity for Password
[src]
impl Clone for Password
[src]
fn clone(&self) -> Password
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Password
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
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> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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> Erased for T
impl<T, U> TryInto for T where
U: TryFrom<T>,
U: TryFrom<T>,