Oracle Internet Directory Application Developer's Guide Release 9.2 Part Number A96577-01 |
|
This chapter introduces the DBMS_LDAP_UTL Package, which contains Oracle Extension utility functions. This chapter contains these topics:
This section contains details about the DBMS_LDAP_UTL subprograms. The entries for each subprogram contain the following information:
This section contains information about the DBMS_LDAP_UTL functions. This section contains these topics:
Function or Procedure | Purpose |
---|---|
Creates a group handle |
|
Associates the given properties with the group handle |
|
Retrieves group properties from an LDAP server |
|
Retrieves a group DN |
Function or Procedure | Purpose |
---|---|
Creates a subscriber handle |
|
Retrieves subscriber properties from an LDAP server |
|
Retrieves a subscriber DN |
A user is represented using DBMS_LDAP_UTL.HANDLE data type. You can create a user handle by using a DN, GUID or a simple name, along with the appropriate subscriber handle. When a simple name is used, additional information from the root Oracle Context and the subscriber Oracle Context is used to identify the user. Here is an example of a user handle creation:
retval := DBMS_LDAP_UTL.create_user_handle( user_handle, DBMS_LDAP_UTL.TYPE_DN, "cn=user1,cn=users,o=acme,dc=com" );
This user handle must be associated with appropriate subscriber handle. For example given a Subscriber handle : subscriber_handle representing o=acme,dc=com
, the subscriber handle can be associated in the following way:
retval := DBMS_LDAP_UTL.set_user_handle_properties( user_handle, DBMS_LDAP_UTL.SUBSCRIBER_HANDLE, subscriber_handle );
Some common usage of User handles include setting and getting user properties, and authentication of the user. Here is an example of authenticating a user:
retval := DBMS_LDAP_UTL.authenticate_user( my_session, user_handle, DBMS_LDAP_UTL.AUTH_SIMPLE, " welcome", NULL );
In this example, the user is authenticated using a clear text password welcome
.
Here is an example of getting the telephone number of the user:
-- my_attrs is of type DBMS_LDAP.STRING_COLLECTION my_attrs(1) := `telephonenumber'; retval := DBMS_LDAP_UTL.get_user_properties( my_session, my_attrs, DBMS_LDAP_UTL.ENTRY_PROPERTIES, my_pset_coll );
See Also:
"DBMS_LDAP_UTL Sample Code" for samples of user handle |
The function authenticate_user() authenticates the user against Oracle Internet Directory.
FUNCTION authenticate_user ( ld IN SESSION, user_handle IN HANDLE, auth_type IN PLS_INTEGER, credentials IN VARCHAR2, binary_credentials IN RAW ) RETURN PLS_INTEGER;
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.init(), DBMS_LDAP_UTL.create_user_handle().
The function create_user_handle() creates a user handle.
FUNCTION create_user_handle ( user_hd OUT HANDLE, user_type IN PLS_INTEGER, user_id IN VARCHAR2, ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.PARAM_ERROR |
Invalid input parameters. |
DBMS_LDAP_UTL.GENERAL_ERROR |
Other error. |
DBMS_LDAP_UTL.get_user_properties(), DBMS_LDAP_UTL.set_user_handle_properties().
The function set_user_handle_properties() configures the user handle properties.
FUNCTION set_user_handle_properties ( user_hd IN HANDLE, property_type IN PLS_INTEGER, property IN HANDLE ) RETURN PLS_INTEGER;
The subscriber handle doesn't need to be set in User Handle Properties if the user handle is created with TYPE_DN or TYPE_GUID as the user_type.
DBMS_LDAP_UTL.get_user_properties().
The function get_user_properties() retrieves the user properties.
FUNCTION get_user_properties ( ld IN SESSION, user_handle IN HANDLE, attrs IN STRING_COLLECTION, ptype IN PLS_INTEGER, ret_pset_coll OUT PROPERTY_SET_COLLECTION ) RETURN PLS_INTEGER;
This function requires the following:
This function doesn't identify a NULL subscriber handle as a default subscriber. The default subscriber can be obtained from - DBMS_LDAP_UTL.create_subscriber_handle(), where a NULL subscriber_id is passed as an argument.
If the group type is any of the following, then the subscriber handle doesn't need to be set in the user handle properties:
- DBMS_LDAP_UTL.TYPE_GUID
- DBMS_LDAP_UTL.TYPE_DN .
If the subscriber handle is set, then it would be ignored.
DBMS_LDAP.init(), DBMS_LDAP_UTL.create_user_handle().
The function set_user_properties() modifies the properties of a user.
FUNCTION set_user_properties ( ld IN SESSION, user_handle IN HANDLE, pset_type IN PLS_INTEGER, mod_pset IN PROPERTY_SET, mod_op IN PLS_INTEGER ) RETURN PLS_INTEGER;
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.init(), DBMS_LDAP_UTL.get_user_properties().
The function get_user_extended_properties() retrieves user extended properties.
FUNCTION get_user_extended_properties ( ld IN SESSION, user_handle IN HANDLE, ptype IN PLS_INTEGER, filter IN VARCHAR2, rep_pset_coll OUT PROPERTY_SET_COLLECTION ) RETURN PLS_INTEGER;
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.init(), DBMS_LDAP_UTL.get_user_properties().
The function get_user_dn() returns the user DN.
FUNCTION get_user_dn ( ld IN SESSION, user_handle IN HANDLE, dn OUT VARCHAR2 ) RETURN PLS_INTEGER;
Parameter Name | Parameter Type | Parameter Description |
---|---|---|
ld |
SESSION |
A valid LDAP session handle. |
user_handle |
HANDLE |
The user handle. |
dn |
VARCHAR2 |
The user DN. |
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.init().
The function check_group_membership() checks the membership of the user to a group.
FUNCTION check_group_membership ( ld IN SESSION, user_handle IN HANDLE, group_handle IN HANDLE, nested IN PLS_INTEGER ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
If user is a member. |
DBMS_LDAP_UTL.PARAM_ERROR |
Invalid input parameters. |
DBMS_LDAP_UTL.GROUP_MEMBERSHIP |
If user is not a member. |
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.get_group_membership().
The function locate_subscriber_for_user() retrieves the subscriber for the given user and returns a handle to it.
FUNCTION locate_subscriber_for_user ( ld IN SESSION, user_handle IN HANDLE, subscriber_handle OUT HANDLE ) RETURN PLS_INTEGER;
Parameter Name | Parameter Type | Parameter Description |
---|---|---|
ld |
SESSION |
A valid LDAP session handle. |
user_handle |
HANDLE |
The user handle. |
subscriber_handle |
HANDLE |
The subscriber handle. |
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.init(), DBMS_LDAP_UTL.create_user_handle().
The function get_group_membership() returns the list of groups to which the user is a member.
FUNCTION get_group_membership ( user_handle IN HANDLE, nested IN PLS_INTEGER, attr_list IN STRING_COLLECTION, ret_groups OUT PROPERTY_SET_COLLECTION ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.PARAM_ERROR |
Invalid input parameters. |
DBMS_LDAP_UTL.GENERAL_ERROR |
Other error. |
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.init().
A group is represented using by using the DBMS_LDAP_UTL.HANDLE data type. A group handle represents a valid group entry. You can create a group handle by using a DN, GUID or a simple name, along with the appropriate subscriber handle. When a simple name is used, additional information from the Root Oracle Context and the Subscriber Oracle Context is used to identify the group. Here is an example of a group handle creation:
retval := DBMS_LDAP_UTL.create_group_handle( group_handle, DBMS_LDAP_UTL.TYPE_DN, "cn=group1,cn=Groups,o=acme,dc=com" );
This group handle has to be associated with appropriate subscriber handle. For example given a Subscriber handle : subscriber_handle representing "o=acme,dc=com", the subscriber handle can be associated in the following way:
retval := DBMS_LDAP_UTL.set_group_handle_properties( group_handle, DBMS_LDAP_UTL.SUBSCRIBER_HANDLE, subscriber_handle );
A sample usage of group handle is getting group properties. Here is an example:
my_attrs is of type DBMS_LDAP.STRING_COLLECTION my_attrs(1) := `uniquemember'; retval := DBMS_LDAP_UTL.get_group_properties( my_session, my_attrs, DBMS_LDAP_UTL.ENTRY_PROPERTIES, my_pset_coll );
The group-related subprograms also support membership-related functionality. Given a user handle, you can find out if it is a direct or a nested member of a group by using the DBMS_LDAP_UTL.check_group_membership()
function. Here is an example:
retval := DBMS_LDAP_UTL.check_group_membership( session, user_handle, group_handle, DBMS_LDAP_UTL.DIRECT_MEMBERSHIP
You can also obtain a list of groups that a particular group belongs to using DBMS_LDAP_UTL.get_group_membership()
function. For example:
my_attrs is of type DBMS_LDAP.STRING_COLLECTION my_attrs(1) := `cn'; retval := DBMS_LDAP_UTL.get_group_membership( my_session, user_handle, DBMS_LDAP_UTL.DIRECT_MEMBERSHIP, my_attrs my_pset_coll );
See Also:
Example: Group-Related Functions for more usage samples of group handle |
The function create_group_handle() creates a group handle.
FUNCTION create_group_handle ( group_hd OUT HANDLE, group_type IN PLS_INTEGER, group_id IN VARCHAR2 ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.PARAM_ERROR |
Invalid input parameters. |
DBMS_LDAP_UTL.GENERAL_ERROR |
Other error. |
DBMS_LDAP_UTL.get_group_properties(), DBMS_LDAP_UTL.set_group_handle_properties().
The function set_group_handle_properties() configures the group handle properties.
FUNCTION set_group_handle_properties ( group_hd IN HANDLE, property_type IN PLS_INTEGER, property IN HANDLE ) RETURN PLS_INTEGER;
The subscriber handle doesn't need to be set in Group Handle Properties if the group handle is created with TYPE_DN or TYPE_GUID as the group_type.
DBMS_LDAP_UTL.get_group_properties().
The function get_group_properties() retrieves the group properties.
FUNCTION get_group_properties ( ld IN SESSION, group_handle IN HANDLE, attrs IN STRING_COLLECTION, ptype IN PLS_INTEGER, ret_pset_coll OUT PROPERTY_SET_COLLECTION ) RETURN PLS_INTEGER;
This function requires the following:
This function doesn't identify a NULL subscriber handle as a default subscriber. The default subscriber can be obtained from - DBMS_LDAP_UTL.create_subscriber_handle(), where a NULL subscriber_id is passed as an argument.
If the group type is any of the following, then the subscriber handle doesn't need to be set in the group handle properties:
If the subscriber handle is set, then it would be ignored.
DBMS_LDAP.init(), DBMS_LDAP_UTL.create_group_handle().
The function get_group_dn() returns the group DN.
FUNCTION get_group_dn ( ld IN SESSION, group_handle IN HANDLE dn OUT VARCHAR2 ) RETURN PLS_INTEGER;
Parameter Name | Parameter Type | Parameter Description |
---|---|---|
ld |
SESSION |
A valid LDAP session handle. |
group_handle |
HANDLE |
The group handle. |
dn |
VARCHAR2 |
The group DN. |
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.init().
A subscriber is represented by using dbms_ldap_utl.handle
data type. You can create a subscriber handle by using a DN, GUID or a simple name. When a simple name is used, additional information from the root Oracle Context is used to identify the subscriber. Here is an example of a subscriber handle creation:
retval := DBMS_LDAP_UTL.create_subscriber_handle( subscriber_handle, DBMS_LDAP_UTL.TYPE_DN, "o=acme,dc=com" );
subscriber_handle
is created by it's DN: o=oracle,dc=com
.
A common usage of subscriber handle is getting subscriber properties. Here is an example:
my_attrs is of type DBMS_LDAP.STRING_COLLECTION my_attrs(1) := `orclguid'; retval := DBMS_LDAP_UTL.get_subscriber_properties( my_session, my_attrs, DBMS_LDAP_UTL.ENTRY_PROPERTIES, my_pset_coll );
See Also:
"DBMS_LDAP_UTL Sample Code" for samples of subscriber handle |
The function create_subscriber_handle() creates a subscriber handle.
FUNCTION create_subscriber_handle ( ld IN SESSION, subscriber_hd OUT HANDLE, subscriber_type IN PLS_INTEGER, subscriber_id IN VARCHAR2 ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.PARAM_ERROR |
Invalid input parameters. |
DBMS_LDAP_UTL.GENERAL_ERROR |
Other error. |
DBMS_LDAP_UTL.get_subscriber_properties().
The function get_subscriber_properties() retrieves the subscriber properties for the given subscriber handle.
FUNCTION get_subscriber_properties ( ld IN SESSION, subscriber_handle IN HANDLE, attrs IN STRING_COLLECTION, ptype IN PLS_INTEGER, ret_pset_coll OUT PROPERTY_SET_COLLECTION ) RETURN PLS_INTEGER;
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.init(), DBMS_LDAP_UTL.create_subscriber_handle().
The function get_subscriber_dn() returns the subscriber DN.
FUNCTION get_subscriber_dn ( ld IN SESSION, subscriber_handle IN HANDLE, dn OUT VARCHAR2 ) RETURN PLS_INTEGER;
Parameter Name | Parameter Type | Parameter Description |
---|---|---|
ld |
SESSION |
A valid LDAP session handle. |
subscriber_handle |
HANDLE |
The subscriber handle. |
dn |
VARCHAR2 |
The subscriber DN. |
This function can only be called after a valid LDAP session is obtained from a call to DBMS_LDAP.init().
DBMS_LDAP.init().
Many of the user-related, subscriber-related, and group-related subprograms return DBMS_LDAP_UTL.PROPERTY_SET_COLLECTION
, which is a collection of one or more LDAP entries representing results. Each of these entries is represented by a DBMS_LDAP_UTL.PROPERTY_SET
. A PROPERTY_SET
may contain attributes--that is, properties--and its values. Here is sample usage illustrating the retrieval of properties from DBMS_LDAP_UTL.PROPERTY_SET_COLLECTION
:
my_attrs is of type DBMS_LDAP.STRING_COLLECTION my_attrs(1) := `cn'; retval := DBMS_LDAP_UTL.get_group_membership( my_session, user_handle, DBMS_LDAP_UTL.DIRECT_MEMBERSHIP, my_attrs, my_pset_coll ); IF my_pset_coll.count > 0 THEN FOR i in my_pset_coll.first .. my_pset_coll.last LOOP -- my_property_names is of type DBMS_LDAP.STRING_COLLECTION retval := DBMS_LDAP_UTL.get_property_names( pset_coll(i), property_names IF my_property_names.count > 0 THEN FOR j in my_property_names.first .. my_property_names.last LOOP retval := DBMS_LDAP_UTL.get_property_values( pset_coll(i), property_names(j), property_values if my_property_values.COUNT > 0 then FOR k in my_property_values.FIRST..my_property_values.LAST LOOP DBMS_OUTPUT.PUT_LINE(my_property_names(j) || `: ` ||my_property_values(k)); END LOOP; -- For each value else DBMS_OUTPUT.PUT_LINE('NO VALUES FOR ` || my_property_names(j)); end if; END LOOP; -- For each property name END IF; -- IF my_property_names.count > 0 END LOOP; -- For each propertyset END IF; -- If my_pset_coll.count > 0
use_handle
is a userhandle. my_pset_coll
contains all the nested groups that user_handle
belongs to. The code loops through the resulting entries and prints out the cn
of each entry.
See Also:
Example: Property-Related Subprograms for more usage samples of the Property-related subpropgrams |
The function normalize_dn_with_case() removes unnecessary white space characters from a DN and converts all characters to lower case based on a flag.
FUNCTION normalize_dn_with_case ( dn IN VARCHAR2, lower_case IN PLS_INTEGER, norm_dn OUT VARCHAR2 ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.PARAM_ERROR |
Invalid input parameters. |
DBMS_LDAP_UTL.GENERAL_ERROR |
On failure. |
This function can be used while comparing two DNs.
The function get_property_names() retrieves the list of property names in the property set.
FUNCTION get_property_names ( pset IN PROPERTY_SET, property_names OUT STRING_COLLECTION ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.PARAM_ERROR |
Invalid input parameters. |
DBMS_LDAP_UTL.GENERAL_ERROR |
On error. |
DBMS_LDAP_UTL.get_property values().
The function get_property_values() retrieves the property values (the strings) for a given property name and property.
FUNCTION get_property_values ( pset IN PROPERTY_SET, property_name IN VARCHAR2, property_values OUT STRING_COLLECTION ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.PARAM_ERROR |
Invalid input parameters. |
DBMS_LDAP_UTL.GENERAL_ERROR |
On failure. |
DBMS_LDAP_UTL.get_property_values_len().
The function get_property_values_len() retrieves the binary property values for a given property name and property.
FUNCTION get_property_values_len ( pset IN PROPERTY_SET, property_name IN VARCHAR2, auth_type IN PLS_INTEGER, property_values OUT BINVAL_COLLECTION ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.PARAM_ERROR |
Invalid input parameters. |
DBMS_LDAP_UTL.GENERAL_ERROR |
On failure. |
DBMS_LDAP_UTL.get_property_values().
The procedure free_propertyset_collection() frees the memory associated with property set collection.
PROCEDURE free_propertyset_collection ( pset_collection IN OUT PROPERTY_SET_COLLECTION );
N/A
DBMS_LDAP_UTL.get_group_membership(), DBMS_LDAP_UTL.get_subscriber_properties(), DBMS_LDAP_UTL.get_user_properties(), DBMS_LDAP_UTL.get_group_properties().
The function create_mod_propertyset() creates a MOD_PROPERTY_SET data structure.
FUNCTION create_mod_propertyset ( pset_type IN PLS_INTEGER, pset_name IN VARCHAR2, ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.GENERAL_ERROR |
Other error. |
DBMS_LDAP_UTL.populate_mod_propertyset().
The function populate_mod_propertyset() populates the MOD_PROPERTY_SET data structure.
FUNCTION populate_mod_propertyset ( mod_pset IN MOD_PROPERTY_SET, property_mod_op IN PLS_INTEGER, property_name IN VARCHAR2, property_values IN STRING_COLLECTION ) RETURN PLS_INTEGER;
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
On a successful completion. |
DBMS_LDAP_UTL.GENERAL_ERROR |
Authentication failed. |
DBMS_LDAP_UTL.PWD_GRACELOGIN_WARN |
Grace login for user. |
DBMS_LDAP_UTL.create_mod_propertyset().
The procedure free_mod_propertyset() frees the MOD_PROPERTY_SET data structure.
PROCEDURE free_mod_propertyset ( mod_pset IN MOD_PROPERTY_SET );
Parameter Name | Parameter Type | Parameter Description |
---|---|---|
mod_pset |
PROPERTY_SET |
Mod_PropertySet data structure. |
N/A
DBMS_LDAP_UTL.create_mod_propertyset().
The procedure free_handle() frees the memory associated with the handle.
PROCEDURE free_handle ( handle IN OUT HANDLE );
Parameter Name | Parameter Type | Parameter Description |
---|---|---|
handle |
HANDLE |
A pointer to a handle. |
N/A
DBMS_LDAP_UTL.create_user_handle(), DBMS_LDAP_UTL.create_subscriber_handle(), DBMS_LDAP_UTL.create_group_handle().
The function check_interface_version() checks for support of the interface version.
FUNCTION check_interface_version ( interface_version IN VARCHAR2 ) RETURN PLS_INTEGER;
Parameter Name | Parameter Type | Parameter Description |
---|---|---|
interface_version |
VARCHAR2 |
Version of the interface. |
Value | Description |
---|---|
DBMS_LDAP_UTL.SUCCESS |
Interface version is supported. |
DBMS_LDAP_UTL.GENERAL_ERROR |
Interface version is not supported. |
The DBMS_LDAP_UTL functions can return the values in the following table
.The DBMS_LDAP_UTL package uses the data types in the following table
.
|
Copyright © 1999, 2002 Oracle Corporation. All Rights Reserved. |
|