[Previous] [Next] [Contents] [Index]
This chapter describes the Authorization Library.
This chapter includes the following sections:
3.2 Interface Description
3.1 Authorization Library Overview
The following diagram shows the logical location of the Authorization Library with respect to other server elements.
Figure 3-1: Authorization Library Logical Relationships
The Security Adapter assumes that each application will contain a hierarchy of application-specific objects. Access control is specified on each object in the hierarchy using NetCrusader ACLs (for a definition of NetCrusader ACLs, refer to the NetCrusader/Web Overview Guide).
3.1.1 Setting Up the X.500 Server and NetCrusader Registry Entries
For instructions for creating these entries, refer to the Commander online help.
3.1.2 Building Applications
In addition, applications need to link to the follow libraries:
The steps involved in using the Authorization Library are:
Before an application can begin using the Authorization Library to perform authorization tasks, it must initialize the Security Adapter authorization functions by calling authz_module_init(). This call submits the application name and a path to a DLL that implements the application's netc_list_objects() call (Section 3.1.4).
Once the application has completed the definition of any ACL models using authz_model_register() (Section 3.1.5 on page 32), it calls authz_module_start(). If the application has not registered any new models, the Security Adapter uses the default NetCrusader ACL model.
If a program written to use the Authorization Library calls authz_module_init() without calling authz_module_start(), requests for HTML pages will return the error message document contains no data.
3.1.4 Defining Application Objects
For more information on netc_list_objects() and netc_free_list_objects(), see the description of the interface starting on page 35.
By default, objects protected by the NetCrusader/Web Security Adapter use the default NetCrusader ACL model (Section 3.1.5.2). The default NetCrusader ACL model contains access control permissions for read, write, execute, list, traverse, mount, and unmount operations. This palette of access control permissions applies primarily to an application that serves secure web documents.
The Security Adapter stores the model information in the ACL model database located in <installation directory>/netc_authz/<server name>/model.db. You should back this file up.
3.1.5.1 Multiple ACL Models and Traverse
If you apply multiple models to an object tree, and an ACL check for an object protected by a model for which Traverse is enabled spans a portion of the tree protected by a model for which Traverse is not enabled, the Authorization Library assumes that Traverse is allowed for all directories protected by the latter model.
3.1.5.2 Default NetCrusader ACL Model
In addition, the Authorization Library reserves the following four permissions:
unauthenticated netc_perm_read, netc_perm_traverse
any_other netc_perm_read, netc_perm_traverse
wccs-admin (group) <all permissions>
3.1.6 Checking Access Permissions
Both of these calls take an input handle that identifies the user. The application obtains this handle by calling uul_get_credentials() (page 19).
These calls also enforce Traverse permissions if the model specifies the traverse feature. If a model specifies the traverse feature, then calling authz_acl_authorized() or authz_acl_permissions() require that the user have traverse permission for all objects in the object path.
3.2 Interface Description
This section describes the functions that make up the Authorization Library. Functions are listed in alphabetical order.
authz_acl_permissions()
authz_free_acl_list()
authz_list_real_acls()
authz_model_register()
authz_module_init()
authz_module_start()
authz_module_terminate()
netc_list_objects()
netc_free_list_objects()
authz_acl_authorized()
The authz_acl_authorized() call allows an application to check whether a user has a particular type of access to an object. Each type of access is specified by a bit in the desired_access bit mask (for example read, write, execute, etc.).
Signature
int authz_acl_authorized (
module_handle_t module_handle,
uul_creds_ptr huser,
char * object_name,
unsigned long desired_access,
unsigned long * status);
Parameters
Returns
This function returns TRUE if the desired access is allowed by the object or FALSE otherwise.
Error Codes
Error Code
Description
error_status_ok
The function completed successfully.
authz_acl_permissions()
The authz_acl_permissions() call allows an application to retrieve the complete set of permissions that a particular user has to an object. The permissions are represented using a bit mask, with each permission represented as a particular bit in the bit mask.
Signature
unsigned long authz_acl_permissions (
module_handle_t module_handle,
uul_creds_ptr huser,
char * object_name
unsigned long *status);
Parameters
Returns
This function returns a bit mask (defined by the authz_model_register() call) indicating the user's permissions for the specified object.
Error Codes
Error Code
Description
error_status_ok
The function completed successfully.
authz_free_acl_list()
The auth_free_acl_list() call frees the memory associated with an ACL list.
Signature
unsigned long authz_free_acl_list(
acl_list_t ** aclList);
Parameters
IN/OUT
Parameter
Description
IN
aclList
An ACL list returned by the authz_list_real_acls() call.
Returns
The auth_list_real_acls() call retrieves a list of object names that have real (explicit, or non-inherited) ACLs.
Signature
unsigned long authz_list_real_acls(
module_handle_t module_handle
acl_list_t ** aclList,
unsigned long * status);
Parameters
Returns
This function returns the number of real ACLs in the list. If the function completes successfully, it returns error_status_ok. Otherwise it returns an error status.
Error Codes
Error Code
Description
error_status_ok
No error.
authz_model_register()
You must call authz_model_register() between authz_module_init() and authz_module_start().
Signature
unsigned long authz_model_register(
module_handle_t module_handle,
char * model_root,
permission_def_t model_definition[ ],
unsigned long traverse_perm,
char * defaul_acl[ ]);
Parameters
Usage
<ACL type>:[<ACL identifier>:]<permissions>
authz_model_register(
my_extension, /* Module handle */
NULL, /* Model root */
my_model_perms, /* Permissions */
0x20, /* Traversal perm */
my_model_default_acl); /* Default settings */
Returns
This function returns error_status_ok on success or an error_status otherwise.
Error Codes
authz_module_init()
The authz_module_init() call returns a handle that can be used to identify this application module to the Security Adapter in later calls.
Signature
module_handle_t authz_module_init (
char * module_name,
char * module_path,
char * module_unique_id,
netc_authz_flags_t flags
unsigned long * status);
Parameters
Returns
This function returns a module handle on success or NULL otherwise.
Error Codes
Error Code
Description
error_status_ok
No error.
authz_s_no_memory
The call was unable to allocate memory.
authz_s_application_name_in_use
The module name was already in use by another application.
authz_module_start()
The authz_model_start() call initializes Security Adapter authorization service for a particular module.
Signature
unsigned long authz_module_start(
module_handle_t module_handle);
Parameters
IN/OUT
Parameter
Description
IN
module_handle
A module handle obtained by calling the authz_module_init() function.
Returns
This function returns error_status_ok on success or an error_status otherwise.
Error Codes
Usage
Changing the model settings across invocations of the application deletes any ACLs created using the previous model settings and applies new default ACLs.
authz_module_terminate()
The authz_module_terminate() call shuts down the Security Adapter authorization service for a particular module. It frees any state and memory associated with the module_handle parameter.
Signature
unsigned long authz_module_start(
module_handle_t module_handle);
Parameters
IN/OUT
Parameter
Description
IN
module_handle
A module handle obtained by calling the authz_module_init() function.
Returns
This function returns error_status_ok on success or an error_status otherwise.
Error Codes
Error Code
Description
error_status_ok
No error.
netc_list_objects()
The netc_list_objects() routine is invoked by the Security Adapter to retrieve a list of application objects for Commander to display.
Signature
unsigned long netc_list_objects(
char *AppName,
char *Path,
object_list_t **ObjectList);
Parameters
Returns
The number of nodes in the returned linked list.
Usage
files or application object <object>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include "netc_list.h"
/*
* Routine: add_node
*
* Purpose: Build the list using the given object template.
*/
/* Set the object size; leave space for null. */
pCurrent = malloc(sizeof(object_list_t));
/* Allocate and set the object. */
pCurrent->Object = malloc(size);
strcpy(pCurrent->Object, objName);
/* Tack the new node onto the front of list. */
pCurrent->pNext = *ObjectList;
*ObjectList = pCurrent;
return;
}
/* Check for NULL path - Root object */
if ((strcmp(Path, "") == 0) || (strcmp(Path, "/") == 0))
{
/* Path = NULL; make first level directory (grandparent). */
/* Children of '/grandparent' */
void DLL_EXPORT
netc_free_list_objects(object_list_t **ObjectList)
{
object_list_t *pCurrent = NULL;
/* Loop through the list and free each node. */
while (*ObjectList != NULL)
{
pCurrent = *ObjectList;
*ObjectList = pCurrent->pNext;
free(pCurrent->Object);
free(pCurrent);
}
return;"
}
netc_free_list_objects()
When finished reading the list of objects, the Security Adapter calls netc_free_list_objects() to allow the application to free any memory consumed by the object list.
Signature
void netc_free_list_objects(
object_list_t **ObjectList);
Parameters
IN/OUT
Parameter
Description
OUT
ObjectList
A pointer to the list of objects returned by a call to netc_list_objects().
Returns
This function has no return value.
[Previous] [Next] [Contents] [Index]
To make comments or ask for help, contact support@entegrity.com.