/// <summary> /// Initializes a new instance of the <see cref="AuthenticationData"/> class with the specified values and /// extension data. /// </summary> /// <remarks> /// <para>This constructor is typically used when authenticating with vendor-specific credentials that require /// additional properties which are not present in the typical OpenStack authentication scenarios.</para> /// </remarks> /// <param name="tenantName">The tenant name.</param> /// <param name="tenantId">The tenant ID.</param> /// <param name="passwordCredentials">The credentials to use for authentication.</param> /// <param name="token">The <see cref="V2.Token"/> to use for authentication.</param> /// <param name="extensionData">The extension data.</param> /// <exception cref="ArgumentNullException">If <paramref name="extensionData"/> is <see langword="null"/>.</exception> public AuthenticationData(string tenantName, ProjectId tenantId, PasswordCredentials passwordCredentials, Token token, ImmutableDictionary <string, JToken> extensionData) : base(extensionData) { _tenantName = tenantName; _tenantId = tenantId; _passwordCredentials = passwordCredentials; _token = token; }
/// <summary> /// Initializes a new instance of the <see cref="AuthenticationData"/> class with the specified tenant name and /// credentials. /// </summary> /// <param name="tenantName">The tenant name.</param> /// <param name="passwordCredentials">The credentials to use for authentication.</param> public AuthenticationData(string tenantName, PasswordCredentials passwordCredentials) : this(tenantName, default(ProjectId), passwordCredentials, default(Token), EmptyExtensionData) { }
/// <summary> /// Initializes a new instance of the <see cref="AuthenticationData"/> class with the specified tenant ID and /// credentials. /// </summary> /// <param name="tenantId">The tenant ID.</param> /// <param name="passwordCredentials">The credentials to use for authentication.</param> public AuthenticationData(ProjectId tenantId, PasswordCredentials passwordCredentials) : this(default(string), tenantId, passwordCredentials, default(Token), EmptyExtensionData) { }
/// <summary> /// Create an <see cref="AuthenticationRequest"/> using the specified username and password as credentials. /// </summary> /// <remarks> /// <note type="warning"> /// For improved security, clients are encouraged to use API key credentials instead of a password whenever /// possible. /// </note> /// </remarks> /// <param name="username">The account username.</param> /// <param name="password">The account password.</param> /// <returns> /// <para>An <see cref="AuthenticationRequest"/> instance containing the specified credentials, which is /// typically used for constructing an instance of <see cref="RackspaceAuthenticationService"/>.</para> /// </returns> /// <exception cref="ArgumentNullException"> /// <para>If <paramref name="username"/> is <see langword="null"/>.</para> /// <para>-or-</para> /// <para>If <paramref name="password"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="ArgumentException"> /// <para>If <paramref name="username"/> is empty.</para> /// <para>-or-</para> /// <para>If <paramref name="password"/> is empty.</para> /// </exception> public static AuthenticationRequest Password(string username, string password) { if (username == null) throw new ArgumentNullException("username"); if (password == null) throw new ArgumentNullException("password"); if (string.IsNullOrEmpty(username)) throw new ArgumentException("username cannot be empty"); if (string.IsNullOrEmpty(password)) throw new ArgumentException("password cannot be empty"); PasswordCredentials passwordCredentials = new PasswordCredentials(username, password); AuthenticationData authenticationData = new AuthenticationData(passwordCredentials); AuthenticationRequest authenticationRequest = new AuthenticationRequest(authenticationData); return authenticationRequest; }
/// <summary> /// Initializes a new instance of the <see cref="AuthenticationData"/> class with the specified values and /// extension data. /// </summary> /// <remarks> /// <para>This constructor is typically used when authenticating with vendor-specific credentials that require /// additional properties which are not present in the typical OpenStack authentication scenarios.</para> /// </remarks> /// <param name="tenantName">The tenant name.</param> /// <param name="tenantId">The tenant ID.</param> /// <param name="passwordCredentials">The credentials to use for authentication.</param> /// <param name="token">The <see cref="V2.Token"/> to use for authentication.</param> /// <param name="extensionData">The extension data.</param> /// <exception cref="ArgumentNullException">If <paramref name="extensionData"/> is <see langword="null"/>.</exception> public AuthenticationData(string tenantName, ProjectId tenantId, PasswordCredentials passwordCredentials, Token token, ImmutableDictionary<string, JToken> extensionData) : base(extensionData) { _tenantName = tenantName; _tenantId = tenantId; _passwordCredentials = passwordCredentials; _token = token; }