public string GetToken() { OAuth2Token.Initialize(userName, password, domain, baseURL); OData4.Initialize(baseURL); //return OAuth2Token.Token; return(ConfigurationManager.AppSettings["token"]); }
private string GetToken() { string userName = txtUserName.Text; string password = txtPassword.Text; string baseURL = txtBaseURL.Text; string domain = txtDomain.Text; OAuth2Token.Initialize(userName, password, domain, baseURL); OData4.Initialize(baseURL); return(OAuth2Token.Token); }
/// <summary> /// 初始化UMC静态类,并使用传入的管理员登录UMC。 /// </summary> /// <param name="adminUserName">UMC管理员用户名</param> /// <param name="adminPassword">UMC管理员密码</param> /// <param name="baseURL">UMC服务器地址</param> /// <returns>如果失败返回false</returns> public static void Initialize(string adminUserName, string adminPassword, string baseURL) { try { OAuth2Token.Initialize(adminUserName, adminPassword, "", baseURL); OData4.Initialize(baseURL); Token = OAuth2Token.Token; }catch (Exception ex) { Token = string.Empty; throw ex; } }