Diffusion C API  6.3.3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Management of the security store.

Functions

SECURITY_STORE_Tsecurity_store_create (void)
 Create a new, empty security store structure. More...
 
void security_store_free (SECURITY_STORE_T *store)
 Free all memory associated with a security store structure. More...
 
SECURITY_STORE_Tsecurity_store_dup (const SECURITY_STORE_T *store)
 The returned structure is unsynchronized, so appropriate mutexes should be use if the structure is to be used concurrently. More...
 
void get_security_store (SESSION_T *session, const GET_SECURITY_STORE_PARAMS_T params)
 Get the server's security store. More...
 
char ** get_security_default_anonymous_roles (const SECURITY_STORE_T store)
 Get the default roles for anonymous connections. More...
 
char ** get_security_default_named_roles (const SECURITY_STORE_T store)
 Get the default roles for connections made with a principal. More...
 
char ** get_security_role_names (const SECURITY_STORE_T store)
 Get the names of all roles defined in the security store. More...
 
char ** get_security_included_roles (const SECURITY_STORE_T store, const char *role_name)
 Get the names of other roles that this role includes. More...
 
GLOBAL_PERMISSIONS_T ** get_security_global_permissions (const SECURITY_STORE_T store, const char *role_name)
 Get an array of global permissions assigned to a role. More...
 
TOPIC_PERMISSIONS_T ** get_security_default_topic_permissions (const SECURITY_STORE_T store, const char *role_name)
 Get an array of default topic permissions assigned to a role. More...
 
TOPIC_PERMISSIONS_T ** get_security_topic_permissions (const SECURITY_STORE_T store, const char *role_name, const char *topic_name)
 Get an array of topic permissions assigned to a role, for a specified topic. More...
 
void update_security_store (SESSION_T *session, const UPDATE_SECURITY_STORE_PARAMS_T params)
 Send updates to the security store. More...
 
SCRIPT_Tupdate_security_store_global_role_permissions (SCRIPT_T *script, const char *role_name, const SET_T *permissions)
 Updates a script to assign global permissions to a security role. More...
 
SCRIPT_Tupdate_security_store_default_topic_permissions (SCRIPT_T *script, const char *role_name, const SET_T *permissions)
 Updates a script to assign default topic permissions to a security role. More...
 
SCRIPT_Tupdate_security_store_topic_permissions (SCRIPT_T *script, const char *role_name, const char *topic_path, const SET_T *permissions)
 Updates a script to assign permissions for named role and topic. More...
 
SCRIPT_Tupdate_security_store_remove_topic_permissions (SCRIPT_T *script, const char *role_name, const char *topic_path)
 Updates a script to remove permissions for a named role and topic. More...
 
SCRIPT_Tupdate_security_store_include_roles (SCRIPT_T *script, const char *role_name, const LIST_T *included_roles)
 Updates a script to include other roles within a role. More...
 
SCRIPT_Tupdate_security_store_named_session_roles (SCRIPT_T *script, const LIST_T *roles)
 Updates a script to set the roles assigned to named sessions. More...
 
SCRIPT_Tupdate_security_store_anonymous_session_roles (SCRIPT_T *script, const LIST_T *roles)
 Updates a script to set the roles assigned to anonymous sessions. More...
 

Detailed Description

Function Documentation

char** get_security_default_anonymous_roles ( const SECURITY_STORE_T  store)

Get the default roles for anonymous connections.

Parameters
storeA security store.
Returns
A NULL-terminated array of strings.
char** get_security_default_named_roles ( const SECURITY_STORE_T  store)

Get the default roles for connections made with a principal.

Parameters
storeA security store.
Returns
A NULL-terminated array of strings.
TOPIC_PERMISSIONS_T** get_security_default_topic_permissions ( const SECURITY_STORE_T  store,
const char *  role_name 
)

Get an array of default topic permissions assigned to a role.

Parameters
storeA security store.
role_nameThe name of the role in the store.
Returns
A NULL-terminated array of TOPIC_PERMISSIONS_T. The caller is responsible for freeing the returned pointer, but the array elements are shared and should not be freed.
GLOBAL_PERMISSIONS_T** get_security_global_permissions ( const SECURITY_STORE_T  store,
const char *  role_name 
)

Get an array of global permissions assigned to a role.

Parameters
storeA security store.
role_nameThe name of the role in the store.
Returns
A NULL-terminated array of GLOBAL_PERMISSIONS_T. The caller is responsible for freeing the returned pointer, but the array elements are shared and should not be freed.
char** get_security_included_roles ( const SECURITY_STORE_T  store,
const char *  role_name 
)

Get the names of other roles that this role includes.

Parameters
storeA security store.
role_nameThe name of the role in the store.
Returns
A NULL-terminated array of strings.
char** get_security_role_names ( const SECURITY_STORE_T  store)

Get the names of all roles defined in the security store.

Parameters
storeA security store.
Returns
A NULL-terminated array of strings.
void get_security_store ( SESSION_T session,
const GET_SECURITY_STORE_PARAMS_T  params 
)

Get the server's security store.

Parameters
sessionThe current session. If NULL, this function returns immediately.
paramsParameter structure containing callbacks to receive the contents of the security store.
TOPIC_PERMISSIONS_T** get_security_topic_permissions ( const SECURITY_STORE_T  store,
const char *  role_name,
const char *  topic_name 
)

Get an array of topic permissions assigned to a role, for a specified topic.

Parameters
storeA security store.
role_nameThe name of the role in the store.
topic_nameThe name of the topic to look up.
Returns
A NULL-terminated array of TOPIC_PERMISSIONS_T or NULL if the lookup fails (e.g. role_name not in the store, or there are no specific permissions for the role_name/topic_name pair). The caller is responsible for freeing the returned pointer, but the array elements are shared and should not be freed.
SECURITY_STORE_T* security_store_create ( void  )

Create a new, empty security store structure.

The returned structure is unsynchronized, so appropriate mutexes should be use if the structure is to be used concurrently.

Returns
A newly allocated security store.
SECURITY_STORE_T* security_store_dup ( const SECURITY_STORE_T store)

The returned structure is unsynchronized, so appropriate mutexes should be use if the structure is to be used concurrently.

Parameters
storeThe security store to be copied.
Returns
A deep copy of a security store.
void security_store_free ( SECURITY_STORE_T store)

Free all memory associated with a security store structure.

Parameters
storeThe security store to be freed.
void update_security_store ( SESSION_T session,
const UPDATE_SECURITY_STORE_PARAMS_T  params 
)

Send updates to the security store.

If the server is configured for topic replication, then the changes will be replicated to all members of the cluster.

Parameters
sessionThe current session. If NULL, this function returns immediately.
paramsParameter structure describing the updates to perform and callbacks to handle success or failure notifications.
SCRIPT_T* update_security_store_anonymous_session_roles ( SCRIPT_T script,
const LIST_T roles 
)

Updates a script to set the roles assigned to anonymous sessions.

Parameters
scriptThe script to update.
rolesA list of strings representing the roles which are assigned to anonymous sessions.
Returns
The updated script or NULL on error. (It is also modified in-place.)
SCRIPT_T* update_security_store_default_topic_permissions ( SCRIPT_T script,
const char *  role_name,
const SET_T permissions 
)

Updates a script to assign default topic permissions to a security role.

The collection of permissions to be assigned should be passed in a set created with set_new_int().

Parameters
scriptThe script to update.
role_nameThe role which will receive the new permissions.
permissionsA set of TOPIC_PERMISSIONS_T specifying the permissions to assign.
Returns
The updated script or NULL on error (It is also modified in-place.)
SCRIPT_T* update_security_store_global_role_permissions ( SCRIPT_T script,
const char *  role_name,
const SET_T permissions 
)

Updates a script to assign global permissions to a security role.

Parameters
scriptThe script to update.
role_nameThe role which will receive the new permissions.
permissionsA set of GLOBAL_PERMISSIONS_T specifying the permissions to assign.
Returns
The updated script or NULL on error. (It is also modified in-place).
SCRIPT_T* update_security_store_include_roles ( SCRIPT_T script,
const char *  role_name,
const LIST_T included_roles 
)

Updates a script to include other roles within a role.

Parameters
scriptThe script to update.
role_nameThe role name which will include other roles.
included_rolesA list of strings representing the roles to be included in the named role.
Returns
The updated script or NULL on error. (It is also modified in-place.)
SCRIPT_T* update_security_store_named_session_roles ( SCRIPT_T script,
const LIST_T roles 
)

Updates a script to set the roles assigned to named sessions.

Parameters
scriptThe script to update.
rolesA list of strings representing the roles which are assigned to authenticated (named) sessions.
Returns
The updated script or NULL on error. (It is also modified in-place.)
SCRIPT_T* update_security_store_remove_topic_permissions ( SCRIPT_T script,
const char *  role_name,
const char *  topic_path 
)

Updates a script to remove permissions for a named role and topic.

Parameters
scriptThe script to update.
role_nameThe role for which permissions will be removed.
topic_pathThe path for which permissions will be removed.
Returns
The updated script or NULL on error. (It is also modified in-place.)
SCRIPT_T* update_security_store_topic_permissions ( SCRIPT_T script,
const char *  role_name,
const char *  topic_path,
const SET_T permissions 
)

Updates a script to assign permissions for named role and topic.

Parameters
scriptThe script to update.
role_nameThe role which will receive the new permissions.
topic_pathThe path to the topic for which the permissions will apply.
permissionsA set of TOPIC_PERMISSIONS_T specifying the permissions to assign.
Returns
The updated script or NULL on error. (It is also modified in-place.)