[Previous] [Next] [Contents] [Index]
This chapter describes how to create applications that use the Authorization Object. It includes the following sections:
2.2 Creating and Initializing the Object
2.3 Using the Object in Applications
2.1 Creating Applications
To create applications that use the Authorization Object, you use ASP (Active Server Pages).
The following pages give an overview of the necessary steps. For a complete description of the function calls, see Chapter 3.
2.2 Creating and Initializing the Object
You must create and optionally initialize the Authorization Object before you can use it.
NOTE:
The following examples use VBScript. If you are using a different
scripting language, use the appropriate commands for that language.
myObj.InitModel "mibank", "/", 0
mibank refers to the module name, and is the same name used to name the model file. (Model files are described in Chapter 4.)
"/" indicates that the model applies starting at the root.
"0" indicates that Traverse permission does not apply. (For a complete description of the InitModel call, see the Reference section later in this document.)
2.2.1 Object Scope
If you want to use the Authorization Object on a single page, you can create the object on that page and the object will be deleted when it goes out of scope (when the script terminates).
2.2.2 Sharing the Object Across Application Pages
dim netc
set netc = Server.CreateObject("NetCAuth.NetCObj.1")
set Session("sNetc") = netc
dim netc
set netc = Session("sNetc")
For more examples of using the Session object, see the sample code in the samples subdirectory of the NetCrusader/Web installation directory.
2.3 Using the Object in Applications
NOTE:
The samples use VBScript, but you are not limited to using VBScript in
your applications.
2.3.1 Forms-Based Logon
With the Authorization Object, you can use an HTML form to log a user in and authenticate that user. For example, the following illustration shows a very simple HTML form that is created when you run the sample logon.htm.
The form is a standard HTML form that uses the following
FORM tag:
<form name=enterData action=logon.asp method=post>
dim netc
set netc = Server.CreateObject("NetCAuth.NetCObj.1")
netc.InitModel "simple", "/", 0
formName = Request.Form("opName")
formPassword = Request.Form("opPwd")
netc.LogOff
2.3.3 Web Single Sign On
netc.SingleSignOn
2.3.4 Obtaining Users' Permissions
Response.Write netc.GetPermissions ("/obj1")
This displays the permissions the user has for obj1 (Obj1 is an object defined in the simple model.)
2.3.5 Getting a User's Attributes
The sample comtest.asp shows an example of how to obtain users' attributes. For example:
For more information, see comtest.asp, which shows examples of every function described in Chapter 3.
[Previous] [Next] [Contents] [Index]
To make comments or ask for help, contact support@entegrity.com.