Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (909 KB)
Chapter 9 Web FunctionsThis chapter provides a reference to the functions in the C SDK intended for use by only web agents of Sun JavaTM System Access Manager. Function summaries include a short description, syntax, parameters and returns. The following functions are contained in the header file am_web.h: am_web_clean_post_urls()Cleans up data structure containing dummy post URL, action URL and unique key. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_clean_post_urls(post_urls_t *posturl_struct); ParametersThis function takes the following parameter:
ReturnsNone am_web_cleanup()Cleans up any memory called by the am_web_* functions. This should be called before a web agent exits. Syntax#include "am_web.h" AM_WEB_EXPORT am_status_t am_web_cleanup(); ParametersThis function does not take any parameters. ReturnsThis function returns am_status_t with one of the following values:
am_web_create_post_page()Creates the HTMLform with the Javascript that submits the POST with the invisible name value pairs. Syntax#include "am_web.h"
AM_WEB_EXPORT char * am_web_create_post_page(const char *key,
const char *postdata,
const char *actionurl);
ParametersThis function takes the following parameters:
ReturnsThis function returns char * with one of the following values:
am_web_create_post_preserve_urls()Constructs dummy post URL, action URL and unique key. Syntax#include "am_web.h" AM_WEB_EXPORT post_urls_t * am_web_create_post_preserve_urls(const char *request_url); ParametersThis function takes the following parameter:
ReturnsThis function returns post_urls_t * with one of the following value:
DetailsDummy redirect URL is filtered by web server SAF to identify POST preservation redirects from general redirects. All three of these variables are required for POST preservation. am_web_free_memory()Frees memory previously allocated by a am_web_* routine. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_free_memory(void *memory); ParametersThis function takes the following parameter:
ReturnsNone am_web_get_agent_server_host()Retrieves the name of the Agent Server Host. Syntax#include "am_web.h" AM_WEB_EXPORT const char * am_web_get_agent_server_host(); ParametersThis function does not take any parameters. ReturnsThis function returns const char * with one of the following value:
am_web_get_agent_server_port()Retrieves the name of the Agent Server Port. Syntax#include "am_web.h" AM_WEB_EXPORT int am_web_get_agent_server_port(); ParametersThis function does not take any parameters. ReturnsThis function returns int with one of the following value:
am_web_get_cookie_name()Retrieves the name of the Access Manager cookie. Syntax#include "am_web.h" AM_WEB_EXPORT const char * am_web_get_cookie_name(); ParametersThis function does not take any parameters. ReturnsThis function returns const char * with one of the following values:
am_web_get_notification_url()Retrieves the name of the Access Manager notification URL. Syntax#include "am_web.h" AM_WEB_EXPORT const char * am_web_get_notification_url(); ParametersThis function does not take any parameters. ReturnsThis function returns const char * with one of the following values:
am_web_get_parameter_value()Gets the value of the given query parameter from the given URL. Syntax#include "am_web.h"
AM_WEB_EXPORT am_status_t
am_web_get_parameter_value(const char *inpQuery,
const char *param_name, char **param_value);
ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
am_web_get_redirect_url()Returns a string representing the Access Manager URL that web agent should redirect to. For example, if the status is AM_INVALID_SESSION and CDSSO is not enabled, the redirect URL would be the Access Manager login URL as configured in the AMAgent.properties file and associated query parameters. Syntax#include "am_web.h"
AM_WEB_EXPORT am_status_t
am_web_get_redirect_url(am_status_t status,
const am_map_t advice_map,
const char *goto_url,
const char* function,
char ** redirect_url);
ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
DetailsThe string may either redirect the user to the login URL or the access denied URL. If the redirection is to the login URL then the URL will include any existing information specified in the URL from the configuration file, like org value etc., followed by the specified goto parameter value, which will be used by Access Manager after the user has successfully authenticated. If the redirect_url returned is NOT NULL, the caller of this function must call am_web_free_memory(void *) to free the pointer. am_web_get_token_from_assertion()Returns the SSO Token from the given SAML assertion. Syntax#include "am_web.h" AM_WEB_EXPORT am_status_t am_web_get_token_from_assertion(char *assertion, char **token); ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
am_web_handle_notification()Handles notification data received by an agent. Syntax#include "am_web.h"
AM_WEB_EXPORT void
am_web_handle_notification(const char *data,
size_t data_length);
ParametersThis function takes the following parameters:
ReturnsNone DetailsThis code handles generating logging messages for the event and any error that may occur during the processing of the notification. am_web_http_decode()URL decodes the given URL encoded string. Syntax#include "am_web.h" AM_WEB_EXPORT char * am_web_http_decode(const char *string, size_t len); ParametersThis function takes the following parameters:
ReturnsThis function returns the URL decoded value of the URL encoded string, or NULL if any error occurred. The returned value should be freed by calling am_web_free(). am_web_init()Initializes the Agent Toolkit. Syntax#include "am_web.h" AM_WEB_EXPORT am_status_t am_web_init(const char *config_file); ParametersThis function takes the following parameter:
ReturnsThis function returns am_status_t with one of the following values:
am_web_is_access_allowed()Evaluates the access control policies for a specified web-resource and action. Syntax#include "am_web.h"
AM_WEB_EXPORT am_status_t am_web_is_access_allowed(const char *sso_token,
const char *url, const char *path_info,
const char *action_name,
const char *client_ip,
const am_map_t env_parameter_map,
am_policy_result_t *result);
ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
am_web_is_cdsso_enabled()Returns whether CDSSO is enabled in the agent’s configuration file. Syntax#include "am_web.h" AM_WEB_EXPORT boolean_t am_web_is_cdsso_enabled(); ParametersThis function takes no parameters. ReturnsThis function returns true if CDSSO is enabled and false otherwise. am_web_is_debug_on()Returns debug is on, that is, if the log level is set to anything greater than 0. Syntax#include "am_web.h" AM_WEB_EXPORT boolean_t am_web_is_debug_on(); ParametersThis function takes no parameters. ReturnsThis function returns boolean_t with one of the following values:
am_web_is_in_not_enforced_ip_list()Returns true if the given IP address is present in the list of not enforced IP addresses. Syntax#include "am_web.h" AM_WEB_EXPORT boolean_t am_web_is_in_not_enforced_ip_list(const char *ip); ParametersThis function takes the following parameters:
ReturnsThis function returns boolean_t with one of the following values:
am_web_is_in_not_enforced_list()Returns true if the URL being accessed by the user is in the not enforced list. Syntax#include "am_web.h"
AM_WEB_EXPORT boolean_t am_web_is_in_not_enforced_list(const char *url,
const char *path_info);
ParametersThis function takes the following parameters:
ReturnsThis function returns boolean_t with one of the following values:
am_web_is_max_debug_on()Returns true if the log level is set to 5. Syntax#include "am_web.h" AM_WEB_EXPORT boolean_t am_web_is_max_debug_on(); ParametersThis function takes no parameters. ReturnsThis function returns boolean_t with one of the following values:
am_web_is_notification()Returns true if the given URL is the notification URL for the web agent as configured in AMAgent.properties. Syntax#include "am_web.h" AM_WEB_EXPORT boolean_t am_web_is_notification(const char *request_url); ParametersThis function takes the following parameter:
ReturnsThis function returns am_web_is_notification with one of the following values:
am_web_is_postpreserve_enabled()Finds out if POST data preservation is enabled by clients through AMAgent.Properties. Syntax#include "am_web.h" AM_WEB_EXPORT boolean_t am_web_is_postpreserve_enabled(); ParametersThis function takes no parameters ReturnsThis function returns boolean_t with one of the following values:
am_web_is_valid_fqdn_url()Returns if the requested URL is a Valid FQDN resource, that is if the host is a fully qualified domain name such as myhost.mydomain.com as configured in AMAgent.properties. Syntax#include "am_web.h" AM_WEB_EXPORT boolean_t am_web_is_valid_fqdn_url(const char *url); ParametersThis function takes no parameters. ReturnsThis function returns boolean_t with one of the following values:
am_web_log_always()Log the given message regardless of the log level set in AMAgent.properties. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_log_always(const char *fmt, ...); ParametersThis function takes the following parameters:
ReturnsNone am_web_log_auth()Log the given access allowed or denied message to the Access Manager logs. Syntax#include "am_web.h" AM_WEB_EXPORT boolean_t am_web_log_auth(am_web_access_t access_type, const char *fmt, ...); ParametersThis function takes the following parameters:
ReturnsThis function returns boolean_t with one of the following values:
am_web_log_debug()Log the given message at the debug level. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_log_debug(const char *fmt, ...); ParametersThis function takes the following parameters:
ReturnsNone am_web_log_error()Log the given message at the debug log level. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_log_error(const char *fmt, ...); ParametersThis function takes the following parameters:
ReturnsNone am_web_log_info()Log the given message at the info log level. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_log_info(const char *fmt, ...); ParametersThis function takes the following parameters:
ReturnsNone am_web_log_max_debug()Log the given message at maximum debug level. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_log_max_debug(const char *fmt, ...); ParametersThis function takes the following parameters:
ReturnsNone am_web_log_warning()Log the given message at the warning log level. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_log_warning(const char *fmt, ...); ParametersThis function takes the following parameters:
ReturnsNone am_web_postcache_data_cleanup()Cleans up data structure containing post string value, redirect URL. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_postcache_data_cleanup(am_web_postcache_data_t * const postentry_struct); ParametersThis function takes the following parameters:
ReturnsNone am_web_postcache_insert()Inserts POST data entry in the POST cache. Syntax#include "am_web.h"
AM_WEB_EXPORT boolean_t am_web_postcache_insert(const char *key,
const am_web_postcache_data_t *value);
ParametersThis function takes the following parameters:
ReturnsThis function returns boolean_t with one of the following values:
am_web_postcache_lookup()Looks up POST data in the POST cache. Syntax#include "am_web.h"
AM_WEB_EXPORT boolean_t
am_web_postcache_lookup(const char *key,
am_web_postcache_data_t *postdata_entry);
ParametersThis function takes the following parameters:
ReturnsThis function returns M_WEB_EXPORT boolean_t with one of the following values:
am_web_postcache_remove()Removes POST data from the POST cache. Syntax#include "am_web.h" AM_WEB_EXPORT void am_web_postcache_remove(const char *key); ParametersThis function takes the following parameters:
ReturnsNone am_web_remove_parameter_from_query()Removes the given query parameter from the URL, if it is in the URL. Syntax#include "am_web.h"
AM_WEB_EXPORT am_status_t
am_web_remove_parameter_from_query(const char* inpString,
const char *remove_str,
char **outString );
ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
|