Sun Java System Identity Server 2004Q2 Developer's Reference |
Chapter 5
Policy FunctionsThis chapter provides a reference to the public functions for using Sun Java System Identity Server Access Management SDK policy objects. Function summaries include a short description, syntax, parameters and returns.
The following functions are contained in the header file am_policy.h.
am_policy_compare_urls()Takes two url resources compares theme, and returns an appropriate result.
Syntax
#include "am_policy.h"
AM_EXPORT am_resource_match_t
am_policy_compare_urls(const am_resource_traits_t *rsrc_traits,
const char *policy_resource_name,
const char *resource_name,
boolean_t use_patterns);Parameters
If the usePatterns is AM_TRUE, this function will consider occurrences of '*' in the policy resource name as wildcards. If usePatterns is AM_FALSE, '*' occurrences are taken as a literal characters.
Returns
This function returns am_resource_match_t with one of the following values:
Details
In cases of SUB/SUPER_RESOURCE_MATCH, if the usePatterns is * AM_TRUE, the patterns are sub/super matching patterns.
am_policy_destroy()Frees an initialized policy evaluator.
Syntax
#include "am_policy.h"
AM_EXPORT am_status_t
am_policy_destroy(am_policy_t policy);Parameters
This function takes the following parameters:
Returns
This function returns am_status_t with one of the following values:
Value
Description
AM_SUCCESS
If the call was successful.
AM_*
If any error occurs, the type of error indicated by the status value.
am_policy_evaluate()Evaluates a policy for a given resource and returns the policy result.
Syntax
#include "am_policy.h"
AM_EXPORT am_status_t
am_policy_evaluate(am_policy_t policy_handle,
const char *sso_token,
const char *resource_name,
const char *action_name,
const am_map_t env_parameter_map,
am_map_t policy_response_map_ptr,
am_policy_result_t *policy_result);Parameters
This function takes the following parameters:
Returns
This function returns am_status_t with one of the following values:
Value
Description
AM_SUCCESS
If the call was successful.
AM_*
If any error occurs, the type of error indicated by the status value.
am_policy_get_url_resource_root()Populates the pointer resourceRoot with the resource root.
Syntax
#include "am_policy.h"
AM_EXPORT boolean_t
am_policy_get_url_resource_root(const char *resource_name,
char *resource_root, size_t length);Parameters
This function takes a URL resource name.
Returns
This function returns boolean_t with one of the following values:
am_policy_init()Initializes the policy evaluation engine.
Syntax
#include "am_policy.h"
AM_EXPORT am_status_t
am_policy_init(am_properties_t policy_config_properties);Parameters
This function takes the following parameters:
Returns
This function returns am_status_t with one of the following values:
Value
Description
AM_SUCCESS
If the call was successful.
AM_*
If any error occurs, the type of error indicated by the status value.
am_policy_is_notification_enabled()Checks if notification is enabled in the SDK.
Syntax
#include "am_policy.h"
AM_EXPORT boolean_t
am_policy_is_notification_enabled(am_policy_t policy_handle);Parameters
This function takes the following parameters:
Parameter
Description
policy_handle
The opaque policy service handle created from am_policy_service_init().
Returns
This function returns boolean_t with one of the following values:
am_policy_notify()Refreshes policy cache when a policy notification is received by the client.
Syntax
#include "am_policy.h"
AM_EXPORT am_status_t
am_policy_notify(am_policy_t policy_handle,
const char *notification_data,
size_t notification_data_len);Parameters
This function takes the following parameters:
Parameter
Description
policy_handle
Opaque handle to the policy service
notification_data
The notification message as an XML String.
notification_data_len
Length of the notification data.
Returns
This function returns am_status_t with one of the following values:
Value
Description
AM_SUCCESS
If the call was successful.
AM_*
If any error occurs, the type of error indicated by the status value.
am_policy_resource_canonicalize()Canonicalize the given resource name.Syntax
#include "am_policy.h"
AM_EXPORT void
am_policy_resource_canonicalize(const char *resource, char **c_resource);Parameters
This function takes the following parameters:
Parameter
Description
resource
Name of resource to be canonicalized
c_resource
Pointer to location where the canonicalized string will be placed.
the value returned should be freed using free().
Returns
None
am_policy_resource_has_patterns()Returns whether the given resource name has patterns such as '*'.Syntax
#include "am_policy.h"
AM_EXPORT boolean_t
am_policy_resource_has_patterns(const char *resource_name);Parameters
This function takes the following parameters:
Returns
This function returns boolean_t with one of the following values:
am_policy_result_destroy()Destroys am_policy_result internal structures.
Syntax
#include "am_policy.h"
AM_EXPORT void
am_policy_result_destroy(am_policy_result_t *result);Parameters
This function takes the following parameters:
Returns
None
am_policy_service_init()Initializes one specific instance of service for policy evaluation.
Syntax
#include "am_policy.h"
AM_EXPORT am_status_t
am_policy_service_init(const char *service_name,
const char *instance_name,
am_resource_traits_t rsrc_traits,
am_properties_t service_config_properties,
am_policy_t *policy_handle_ptr);Parameters
This function takes the following parameters:
Returns
This function returns am_status_t with one of the following values:
Value
Description
AM_SUCCESS
If the call was successful.
AM_*
If any error occurs, the type of error indicated by the status value.