public bool Authenticate() { ConoHa.UserName = Options.UserName; ConoHa.TenantId = Options.TenantId; ConoHa.TenantName = Options.TenantName; ConoHaNet.Objects.CloudIdentity Identity = null; if ((Options.TenantName != null) || (Options.TenantId != null)) { Identity = new ConoHaNet.Objects.Identity.CloudIdentityWithProject() { Username = Options.UserName, Password = Options.Password, ProjectId = (new ConoHaNet.Objects.ProjectId(Options.TenantId ?? Options.TenantName)), ProjectName = Options.TenantName } } ; else { Identity = new CloudIdentity() { Username = Options.UserName, Password = Options.Password } }; ConoHa.Identity = Identity; ConoHa.DefaultRegion = Options.Region; ConoHa.IdentityProvider.Authenticate(ConoHa.Identity); return(true); }
public bool Authenticate() { this.m_Core.Logger?.WriteLine("Identity authenticate request."); //this.m_Core.Logger?.WriteLine(System.String.Format("[NAME] {0} / [PASS] {1}", this.UserName, this.Password)); ConoHa.UserName = this.UserName; ConoHa.TenantId = this.TenantId; ConoHa.TenantName = this.TenantName; ConoHaNet.Objects.CloudIdentity Identity = null; if ((this.TenantName != null) || (this.TenantId != null)) { Identity = new ConoHaNet.Objects.Identity.CloudIdentityWithProject() { Username = this.UserName, Password = this.Password, ProjectId = (new ConoHaNet.Objects.ProjectId(this.TenantId ?? this.TenantName)), ProjectName = this.TenantName } } ; else { Identity = new CloudIdentity() { Username = this.UserName, Password = this.Password } }; ConoHa.Identity = Identity; ConoHa.DefaultRegion = this.DefaultRegion; try { ConoHa.IdentityProvider.Authenticate(ConoHa.Identity); } catch (System.Exception ex) { this.m_Core.Logger?.WriteLine(ex.Message, eLogLevel.ERROR); return(false); } return(true); }