![Netscape ENTERPRISE SERVER 6.1 Manual Download Page 217](http://html1.mh-extra.com/html/netscape/enterprise-server-6-1/enterprise-server-6-1_manual_1674653217.webp)
AuthTrans Example
Chapter
6
Examples of Custom SAFs
217
AuthTrans Example
This simple example of an
AuthTrans
function demonstrate how to use your own
custom ways of verifying that the username and password that a remote client
provided is accurate. This program uses a hard coded table of usernames and
passwords and checks a given user's password against the one in the static data
array. The userdb parameter is not used in this function.
AuthTrans
directives work in conjunction with
PathCheck
directives. Generally,
an
AuthTrans
function checks if the username and password associated with the
request are acceptable, but it does not allow or deny access to the request – it leaves
that to a
PathCheck
function.
AuthTrans
functions get the username and password from the headers associated
with the request. When a client initially makes a request, the username and
password are unknown so the
AuthTrans
function and
PathCheck
function work
together to reject the request, since they can’t validate the username and password.
When the client receives the rejection, the usual response is for it to pop up a dialog
box asking the user for their username and password, and then the client submits
the request again, this time including the username and password in the headers.
In this example, the
hardcoded-auth
function, which is invoked during the
AuthTrans
step, checks if the username and password correspond to an entry in
the hard-coded table of users and passwords.
Installing the Example
To install the function on the Enterprise Server, add the following
Init
directive to
magnus.conf
to load the compiled function:
Init fn=load-modules shlib=
yourlibrary
funcs=hardcoded-auth
Inside the default object in
obj.conf
add the following
AuthTrans
directive:
AuthTrans fn=basic-auth auth-type="basic" userfn=hardcoded-auth
userdb=unused
Summary of Contents for ENTERPRISE SERVER 6.1
Page 1: ...NSAPI Programmer s Guide Netscape Enterprise Server Version6 1 April 2002 Draft...
Page 290: ...Miscellaneous 290 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 318: ...cinfo 318 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 336: ...Buffered Streams 336 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 344: ...344 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 350: ...350 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 356: ...356 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...