예제 #1
0
        public void TestUpdateSite_oxd_http()
        {
            intializedParameter();
            var RegisterSite = new RegisterSiteClient();
            RegisterSiteResponse registerSiteResponse = RegisterSite.RegisterSite("https://127.0.0.1:8443", registerSiteParams);

            Assert.That(registerSiteResponse, Is.Not.Null);
            Assert.That(registerSiteResponse.Data.OxdId, Is.Not.Null);

            var updateSiteParams = new UpdateSiteParams();

            updateSiteParams.OxdId = registerSiteResponse.Data.OxdId;
            updateSiteParams.Scope = new List <string> {
                "openid", "profile"
            };
            updateSiteParams.Contacts = new List <string> {
                "*****@*****.**"
            };
            updateSiteParams.PostLogoutRedirectUri = "https://client.example.com/LogoutUri";

            var updateSiteRegistrationclient      = new UpdateSiteRegistrationClient();
            UpdateSiteResponse updatesiteresponse = updateSiteRegistrationclient.UpdateSiteRegistration("127.0.0.1", 8099, updateSiteParams);

            Assert.That(updatesiteresponse, Is.Not.Null);
        }
예제 #2
0
        public ActionResult Update(OxdModel oxd)
        {
            Loadoxdsettings();

            string updateStatus = "ok";

            if (dynamic_registration)
            {
                var updateSiteInputParams = new UpdateSiteParams();
                var updateSiteClient      = new UpdateSiteRegistrationClient();

                updateSiteInputParams.AuthorizationRedirectUri = oxd.RedirectUrl;
                updateSiteInputParams.PostLogoutRedirectUri    = oxd.PostLogoutRedirectUrl;
                updateSiteInputParams.ClientName = oxd.ClientName;

                updateSiteInputParams.OxdId    = oxd.OxdId;
                updateSiteInputParams.Contacts = new List <string> {
                    oxd.OxdEmail
                };
                updateSiteInputParams.PostLogoutRedirectUri = oxd.PostLogoutRedirectUrl;
                updateSiteInputParams.GrantTypes            = grant_types;
                //updateSiteInputParams.Scope = scope;


                var updateSiteResponse = new UpdateSiteResponse();

                //Update Client using  OXD Local
                if (oxd.ConnectionType == "local")
                {
                    //Get ProtectionAccessToken
                    updateSiteInputParams.ProtectionAccessToken = GetProtectionAccessToken(oxdHost, oxd.OxdPort);
                    // Update Site response
                    updateSiteResponse = updateSiteClient.UpdateSiteRegistration(oxdHost, oxd.OxdPort, updateSiteInputParams);
                }

                //Update Client using OXD Web
                if (oxd.ConnectionType == "web")
                {
                    updateSiteInputParams.ProtectionAccessToken = GetProtectionAccessToken(oxd.HttpRestUrl);
                    updateSiteResponse = updateSiteClient.UpdateSiteRegistration(oxd.HttpRestUrl, updateSiteInputParams);
                }


                updateStatus = updateSiteResponse.Status;
            }

            Updateoxdsettingfile(oxd);


            //Process Response
            return(Json(new { status = updateStatus }));
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateSiteResponse response = new UpdateSiteResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Site", targetDepth))
                {
                    var unmarshaller = SiteUnmarshaller.Instance;
                    response.Site = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }