This article as a result of a series of questions I was asked by a customer about Self Service authentication.
The customer had been reviewing some pages that had been written by a partner. The code they were looking at was very similar to this:
if (!eWare.Authenticated) { eWareLogin(); } else { Response.Redirect("custommain.asp"); }
The property of eWare.Authenticated is being used in this example as a guard to code within the Self Service page. But what determines the value of eWare.Authenticated?
The basic logon form for Self Service looks like
User
Name: Password: Remember me |
The credentials from the web form are used for the logon.
eWare.Authenticated is a ReadOnly boolean value set at the time of the initial logon and initialisation of the Self Service object.
eWare = Server.CreateObject("eWare.eWareSelfService"); eWare.Init( Request.Querystring, Request.Form, Request.Cookies("eware"),true);
The Init() method takes the following parameters
Init(ByVal QueryString As String, ByVal ContentString As String, ByVal Cookie As String, ByVal UseCookies As Boolean) As String
So if the visitor has logged on, the initialisation method checks to see whether there is a valid cookie. If there is then eWare.Authenticated is true, else eWare.Authenticated is false.
You can investigate this further by writing out the value of the parameters passed to the eWare.Init() method. You can then see how values change when you try and access the page when logged on.
function CheckObject(myObject) { //usage CheckObject(myObject); //e.g. CheckObject(Request.QueryString); var myVarCount = myObject.Count; var KeyName; Response.Write(myObject); Response.Write("
- ");
for (var iLoop=1;iLoop
- "+KeyName+" is "+myObject(KeyName)); } Response.Write("
"); } CheckObject(Request.QueryString); CheckObject(Request.Form); Response.Write(Request.Cookies("eware"));