Exemple de script ASP pour l’authentification unique non chiffrée
Cet exemple de code ASP .NET crée un portail d’authentification simple et transmet un en-tête HTTP non chiffré en tant que paramètre d’URL.
Cet exemple suppose que :
- Le serveur Web prend en charge ASP .NET
- L’instance cible est
https://<nom de l’instance>.service-now.com/ - SiteMinder ou une autre application d’authentification unique a pré-authentifié l’utilisateur
- L’instance cible attend un en-tête HTTP de SM_USER
Modifiez le code ASP pour rediriger les utilisateurs vers l’instance appropriée et créer l’en-tête HTTP approprié.Figure 1. Concepteur
<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 >