ICF 1.5.20.21

Resolve username script

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. The type of the returned UID must be a string or a Uid. If a null value or an object type other than string or Uid is returned, the script must throw an exception.

Resolve Username Script
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();
}
Copyright © 2010-2024 ForgeRock, all rights reserved.