Resolve username script
Connectors continue to be released outside the IDM release. For the latest documentation, refer to the ICF documentation. |
A resolve username script resolves an object to its uid
based on its username
.
A sample resolve username script for an SQL database is provided in openidm/samples/scripted-sql-with-mysql/tools/ResolveUsernameScript.groovy
.
- Input variables
-
The following variables are available to a resolve username script:
- configuration
-
A handler to the connector’s configuration object.
- options
-
A handler to the Operation Options.
- operation
-
An OperationType that corresponds to the action (
RESOLVE_USERNAME
). - objectClass
-
The object class for which the username is resolved, such as
__ACCOUNT__
or__GROUP__
. - username
-
A string that represents the username of the object.
- log
-
A logger instance for the connector.
- Returns
-
The user unique ID (ICF
__UID__
) of the object. Thetype
of the returned UID must be astring
or aUid
. If a null value or an object type other thanstring
orUid
is returned, the script must throw an exception.
def operation = operation as OperationType
def configuration = configuration as ScriptedConfiguration
def username = username as String
def log = log as Log
def objectClass = objectClass as ObjectClass
def options = options as OperationOptions
if (objectClass.is(ObjectClass.ACCOUNT_NAME)) {
if (username.equals("TESTOK1")) {
return new Uid("123")
}
throw new UnknownUidException();
}