私は現在、ScriptedRest2DJ サンプルに基づくGroovy フレームワーク コネクタを使用して、外部システムをプロビジョニングするための独自のOpenidm コネクタを構築しています。
ターゲット システムでリソース (ユーザー) を検索するためにsearchScript.groovyファイルを実装しており、リクエストでソース システムの現在のユーザー UID を渡したいと考えています。
SearchScript.groovy のソース コードは次のとおりです。
import groovyx.net.http.RESTClient
import org.apache.http.client.HttpClient
import org.forgerock.openicf.connectors.scriptedrest.ScriptedRESTConfiguration
import org.forgerock.openicf.misc.scriptedcommon.OperationType
import org.identityconnectors.common.logging.Log
import org.identityconnectors.framework.common.objects.Attribute
import org.identityconnectors.framework.common.objects.AttributeUtil
import org.identityconnectors.framework.common.objects.Name
import org.identityconnectors.framework.common.objects.ObjectClass
import org.identityconnectors.framework.common.objects.OperationOptions
import org.identityconnectors.framework.common.objects.SearchResult
import org.identityconnectors.framework.common.objects.Uid
import org.identityconnectors.framework.common.objects.filter.Filter
import org.identityconnectors.framework.common.objects.AttributesAccessor
import static groovyx.net.http.Method.GET
import static groovyx.net.http.ContentType.JSON;
// imports used for CREST based REST APIs
import org.forgerock.openicf.misc.crest.CRESTFilterVisitor
import org.forgerock.openicf.misc.crest.VisitorParameter
def operation = operation as OperationType
def configuration = configuration as ScriptedRESTConfiguration
def httpClient = connection as HttpClient
def connection = customizedConnection as RESTClient
def filter = filter as Filter
def log = log as Log
def objectClass = objectClass as ObjectClass
def options = options as OperationOptions
def resultHandler = handler
log.info("Entering " + operation + " Script")
switch (objectClass) {
case ObjectClass.ACCOUNT:
// Search for a specific user in Alfresco
// http://docs.alfresco.com/community/references/RESTful-PersonPersonGet.html
def searchResult = connection.request(GET, JSON) { req ->
uri.path = 'people'
headers.Accept = 'application/json'
response.success = { resp, json ->
json.people.each() { value ->
resultHandler {
uid value.userName
id value.userName
attribute 'email', value?.email
attribute 'lastName', value?.lastName
attribute 'userName', value?.userName
attribute 'firstName', value?.firstName
attribute 'enabled', value?.enabled
//attribute ('groups', *(value?.groups))
}
}
json
}
}
return new SearchResult(null, -1) // no remaining results
}
スクリプト内のソース値にどのようにアクセスできますか? Uid、Id、Name などをテストしましたが、成功しませんでした。
助けてくれてありがとう