Пример #1
0
        public void GetHubicOpenStackAuthInfo()
        {
            string response = SendRequest(HttpMethod.GET, URLApi, headers: GetAuthHeaders("Bearer"));

            if (!string.IsNullOrEmpty(response))
            {
                HubicOpenstackAuthInfo resp = JsonConvert.DeserializeObject <HubicOpenstackAuthInfo>(response);
                HubicOpenstackAuthInfo.endpoint = resp.endpoint;
                HubicOpenstackAuthInfo.expires  = resp.expires;
                HubicOpenstackAuthInfo.token    = resp.token;
            }
        }
Пример #2
0
 public Hubic(OAuth2Info oauth, HubicOpenstackAuthInfo osauth)
 {
     AuthInfo = oauth;
     HubicOpenstackAuthInfo = osauth;
 }
Пример #3
0
 public Hubic(OAuth2Info oauth, HubicOpenstackAuthInfo osauth)
 {
     AuthInfo = oauth;
     HubicOpenstackAuthInfo = osauth;
 }
Пример #4
0
        public void HubicAuthOpen()
        {
            try
            {
                OAuth2Info oauth = new OAuth2Info(APIKeys.HubicClientID, APIKeys.HubicClientSecret);
                HubicOpenstackAuthInfo osauth = new HubicOpenstackAuthInfo();

                string url = new Hubic(oauth, osauth).GetAuthorizationURL();

                if (!string.IsNullOrEmpty(url))
                {
                    Config.HubicOAuth2Info = oauth;
                    Config.HubicOpenstackAuthInfo = osauth;
                    URLHelpers.OpenURL(url);
                    DebugHelper.WriteLine("HubicAuthOpen - Authorization URL is opened: " + url);
                }
                else
                {
                    DebugHelper.WriteLine("HubicAuthOpen - Authorization URL is empty.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), Resources.UploadersConfigForm_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }