암호화되지 않은 Single Sign-On에 대한 샘플 ASP 스크립트
이 샘플 ASP .NET 코드는 간단한 인증 포털을 만들고 암호화되지 않은 HTTP 헤더를 URL 매개 변수로 전달합니다.
이 샘플에서는 다음을 가정합니다.
- 웹 서버는 ASP .NET을 지원합니다.
- 대상 인스턴스는
https://<instance name>.service-now.com/ 입니다. - SiteMinder 또는 다른 Single Sign-On 응용 프로그램이 사용자를 사전 인증했습니다.
- 대상 인스턴스에 다음의 HTTP 헤더가 필요합니다SM_USER
사용자를 적절한 인스턴스로 리디렉션하고 적절한 HTTP 헤더를 만들도록 ASP 코드를 변경합니다.그림 1. 디자이너
<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 >