Exemplo n.º 1
0
        public ApAuthorizeResponse Authorize(ApAuthorizeRequest request)
        {
            Log.Debug(this, "Authorize()");

            try
            {
                Authenticate(request);
                ApAuthorizeResponse response = new ApAuthorizeResponse();
                response.Authorized = IaasClient.Authorize();
                return response;
            }
            catch (Exception e)
            {
                Log.Error(this, e);
                throw e;
            }
        }
Exemplo n.º 2
0
        //
        // GET: /applicationgrid/
        public ActionResult Index()
        {
            try
            {
                ViewData["MonoscapeAccessKey"] = Credentials.AccessKey;
                ViewData["MonoscapeSecretKey"] = Credentials.SecretKey;
                ViewData["ApplicationGridEndPointURL"] = Settings.ApplicationGridEndPointURL;
                ViewData["ApplicationGridStatus"] = "Offline";

                try
                {
                    ApGetConfigurationSettingsRequest request = new ApGetConfigurationSettingsRequest(Credentials);
                    ApGetConfigurationSettingsResponse response = EndPoints.ApDashboardService.GetConfigurationSettings(request);
                    if (response != null)
                    {
                        ViewData["IaasName"] = response.ConfigurationSettings.IaasName;
                        ViewData["IaasAccessKey"] = response.ConfigurationSettings.IaasAccessKey;
                        ViewData["IaasSecretKey"] = response.ConfigurationSettings.IaasSecretKey;
                        ViewData["IaasServiceURL"] = response.ConfigurationSettings.IaasServiceURL;
                        ViewData["IaasKeyName"] = response.ConfigurationSettings.IaasKeyName;
                        ViewData["RunningOnMono"] = response.ConfigurationSettings.RunningOnMono.ToString().ToUpper();
                        ViewData["MonoRuntime"] = response.ConfigurationSettings.MonoRuntime;
                        ViewData["DotNetRuntime"] = response.ConfigurationSettings.DotNetRuntime;
                        ViewData["OperatingSystem"] = response.ConfigurationSettings.OperatingSystem;
                        ViewData["ApplicationGridStatus"] = "Authorized";

                        try
                        {
                            ApAuthorizeRequest authRequest = new ApAuthorizeRequest(Credentials);
                            ApAuthorizeResponse authResponse = EndPoints.ApDashboardService.Authorize(authRequest);
                            if (authResponse.Authorized)
                                ViewData["IaasStatus"] = "Authorized";
                            else
                                ViewData["IaasStatus"] = "Authentication failed";
                        }
                        catch (Exception e)
                        {
                            ViewData["IaasStatus"] = "Authentication failed";
                            ViewData["IaasError"] = e.Message;
                        }
                    }
                }
                catch (Exception e)
                {
                    ViewData["ApplicationGridError"] = e.Message;
                }
                return View();
            }
            catch (Exception e)
            {
                return ShowError(e);
            }
        }