1

WPF アプリケーションで SSO 認証を実装しようとしています。以下はシナリオです

  1. ファイアウォールで保護された Web アプリケーションでホストされている asmx Web サービスがあります。
  2. Web アプリケーションにログインするか、本番サーバーからブラウザで Web サービスを表示するには、sso ID を使用してログインする必要があります。WPF アプリケーションで SSO 認証を実装する必要があります。
  3. 最初に、ユーザーが認証された場合に有効な SMSESSION を文字列形式で返すサードパーティの Web サービスを使用する必要があります。
  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