暗号化されていないシングルサインオンの ASP スクリプト例

  • リリースバージョン: Washingtondc
  • 更新日 2024年02月01日
  • 読む2読むのに数分
  • このサンプル ASP.NET コードは、簡易認証ポータルを作成し、暗号化されていない HTTP ヘッダーを URL パラメーターとして渡します。

    このサンプルでは、以下を前提としています。
    • Web サーバーが ASP .NET をサポートしている
    • ターゲットインスタンスが https://<instance name>.service-now.com/ である
    • SiteMinder または別のシングルサインオンアプリケーションがユーザーを事前認証している
    • ターゲットインスタンスは HTTP ヘッダー SM_USER を予期している
    ASP コードを変更して、ユーザーを適切なインスタンスにリダイレクトし、適切な HTTP ヘッダーを作成するようにします。
    <html xmlns = "http://www.w3.org/1999/xhtml" > <head  runat = "server" > <title >Portal Page Login </ title > <%--    <meta http-equiv = "REFRESH" content = "0;url=https://<instance name>.service-now.com/">--%>
     
         <script  runat = "server" >
     
            public void go_to(object sender, EventArgs e)
            {
                ////Send URL parameters
                String URL = urlBox.Text + "?SM_USER=" + userNameBox.Text;
                Response.Redirect(URL);
            }
         </ script >  
     
    
      </ head > <body > <form id = "form1"  runat = "server" > <h2 >< b > Portal Page Login  </ b >< / h2 > <hr style = "position: static" / > <br / > <asp:Label ID = "Label2"  runat = "server"  Font- Size = "Larger" Height = "21px" Style = "position: static"Text = "Instance URL:" Width = "113px" >< / asp:Label> <asp:TextBox ID = "urlBox"  runat = "server"  Font- Size = "Large" Style = "position: static" >< / asp:TextBox> <br / > <br / > <asp:Label ID = "Label1"  runat = "server"  Font- Size = "Larger" Height = "17px" Style = "position: static;"Text = "User Id:" Width = "113px" >< / asp:Label> <asp:TextBox ID = "userNameBox"  runat = "server"  Font- Size = "Large" Style = "position: static;" >< / asp:TextBox> <br / > <br / > <asp:Button ID = "Button1"  runat = "server" Height = "39px" Style = "position: static;" Text = "Ok"Width = "88px" OnClick = "go_to" / > </ form > </ body > </ html >
    図 : 1. デザイナー
    デザイナー