1

我正在尝试使用我们的 WPF 应用程序实现 SSO 身份验证。以下是场景

  1. 我们的 asmx Web 服务托管在受防火墙保护的 Web 应用程序中。
  2. 要登录我们的 Web 应用程序或从生产服务器在浏览器中查看我们的 Web 服务,我们需要使用 sso id 登录。我必须使用我们的 WPF 应用程序实现 SSO 身份验证。
  3. 首先,如果用户通过身份验证,我必须使用第 3 方 Web 服务,它会以字符串格式返回有效的 SMSESSION。
  4. 然后我必须将此 SMSESSION 传递给防火墙后面的 Web 服务。
  5. 现在我面临的问题是我无法将 SMSESSION 值传递给我们的 Web 服务进行身份验证。

当我尝试这个时,它会引发异常

The content type text/html; charset=iso-8859-1 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<HTML><HEAD><TITLE></TITLE></HEAD><BODY onLoad="document.AUTOSUBMIT.submit();">This page is used to hold your data while you are being authorized for your request.<BR><BR>You will be forwarded to continue the authorization process. If this does not happen automatically, please click the Continue button below.<FORM NAME="AUTOSUBMIT" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded" ACTION="https://xxx.com/ssologinforms/SSO_Generic_RME.fcc?TYPE=33554432&REALMOID=06-49a328ee-0d11-103b-ad01-83323a2d304d&GUID=&SMAUTHREASON=0&METHOD=POST&SMAGENTNAME=-SM-ooM6KmTLLwbCHi%2ffOCEVUabjNhcgULT5joVqmn4M77Tf0PAu3BFcfbexTaiWfZ4N&TARGET=-SM-http%3a%2f%2fdev--srvspeq%2eog%2ege%2ecom%2fSRVSpeQWebService%2easmx"><INPUT TYPE="HIDDEN" NAME="SMPostPreserve" VALUE="+rB+TqoVGXah2Uij3lfKDdCf2jsgE2NAUoujo+dFiiJ7yzqgpQaVnxRangTzcB/faU6BOAAcSBFUMUA1RpOCnVRVjN1cFbL0KhVu3y6IySj4gJE6X797kXkzMNEZgozuEz96g6PgQ6e5+sjqZaaNGii+Cy26QaD16fqQTI5VGkLdnD0fhNvJjXXgSBLNZd77nZz0aaMmz4cGZwnAElk7POTF/NBKdxCXS1l0U/iqqozqfBz0aFqLMpsy'.

请帮我做这件事

我使用以下代码获取有效的 SMSESSION

string userId = txtUsername.Text.Trim(); // User to be authenticate with site minder //xxxxxxxxx
string passwrod = txtPassward.Password.Trim(); //password of user to be authenticate with site minder //xxxxxxxx
string applicationID = "XXXXXX"; // Application id. To be authenticate with JBoss Server.//xxxxxxxx
string applicationPassword = "XXXXXXXXX";//applicationPassword to be authenticate with JBoss Sever.//xxxxxxxx

 NamespaceName.AuthenticationServiceClient proxy = new NamespaceName.AuthenticationServiceClient();

                AuthenticationServiceRequest request = new AuthenticationServiceRequest();
                UserAttributes ut = new UserAttributes();
                ut.userName = userId;
                ut.password = passwrod;
                request.userAttributes = ut;
                AuthenticationServiceResponse response = null;
                try
                {
                    ServicePointManager.Expect100Continue = false;
                    proxy.ClientCredentials.UserName.UserName = applicationID;
                    proxy.ClientCredentials.UserName.Password = applicationPassword;

                    response = proxy.passwordAuthenticate(request);

                    if (response.result != null)
                    {
                        switch (response.result.ToString())
                        {
                            case "SUCCESS":
                                MessageBox.Show("Valid SMSESSION :" + response.smSession.ToString());
                                break;
                            case "ERROR":
                                MessageBox.Show("ERROR CODE :" + response.errCode.ToString() + "\n Error Message :" + response.errMsg.ToString());
                                break;
                            default: MessageBox.Show("Response is neither SUCCESS nor ERROR, its something different\nERROR CODE :" + response.errCode.ToString() + "\n " + response.errMsg.ToString());
                                break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
}

如何将 SMSESSION 传递给 asmx Web 服务

4

0 回答 0