AuthenticateScript.groovy revision 3b9de50fdf0980762d6930a49e1a0f20b61a6f6b
4b3769ce483ece06f60f983193712492b920144fJake Feasel/*
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4b3769ce483ece06f60f983193712492b920144fJake Feasel *
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici * Copyright (c) 2014 ForgeRock AS. All Rights Reserved
4b3769ce483ece06f60f983193712492b920144fJake Feasel *
4b3769ce483ece06f60f983193712492b920144fJake Feasel * The contents of this file are subject to the terms
4b3769ce483ece06f60f983193712492b920144fJake Feasel * of the Common Development and Distribution License
4b3769ce483ece06f60f983193712492b920144fJake Feasel * (the License). You may not use this file except in
4b3769ce483ece06f60f983193712492b920144fJake Feasel * compliance with the License.
4b3769ce483ece06f60f983193712492b920144fJake Feasel *
4b3769ce483ece06f60f983193712492b920144fJake Feasel * You can obtain a copy of the License at
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici * http://forgerock.org/license/CDDLv1.0.html
4b3769ce483ece06f60f983193712492b920144fJake Feasel * See the License for the specific language governing
4b3769ce483ece06f60f983193712492b920144fJake Feasel * permission and limitations under the License.
4b3769ce483ece06f60f983193712492b920144fJake Feasel *
4b3769ce483ece06f60f983193712492b920144fJake Feasel * When distributing Covered Code, include this CDDL
4b3769ce483ece06f60f983193712492b920144fJake Feasel * Header Notice in each file and include the License file
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici * at http://forgerock.org/license/CDDLv1.0.html
4b3769ce483ece06f60f983193712492b920144fJake Feasel * If applicable, add the following below the CDDL Header,
4b3769ce483ece06f60f983193712492b920144fJake Feasel * with the fields enclosed by brackets [] replaced by
4b3769ce483ece06f60f983193712492b920144fJake Feasel * your own identifying information:
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici * "Portions Copyrighted [year] [name of copyright owner]"
4b3769ce483ece06f60f983193712492b920144fJake Feasel */
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici
4b3769ce483ece06f60f983193712492b920144fJake Feaselimport org.forgerock.json.resource.Connection
4b3769ce483ece06f60f983193712492b920144fJake Feaselimport org.forgerock.openicf.connectors.scriptedcrest.ScriptedCRESTConfiguration
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.forgerock.openicf.misc.scriptedcommon.OperationType
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.common.logging.Log
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.common.security.GuardedString
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.framework.common.objects.ObjectClass
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.framework.common.objects.OperationOptions
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.framework.common.objects.Uid
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Bricidef operation = operation as OperationType
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Bricidef configuration = configuration as ScriptedCRESTConfiguration
4b3769ce483ece06f60f983193712492b920144fJake Feaseldef connection = connection as Connection
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Bricidef username = username as String
4b3769ce483ece06f60f983193712492b920144fJake Feaseldef log = log as Log
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Bricidef objectClass = objectClass as ObjectClass
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Bricidef options = options as OperationOptions
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Bricidef password = password as GuardedString;
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciswitch (objectClass) {
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici case ObjectClass.ACCOUNT:
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici return new Uid(username)
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici default:
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici throw new UnsupportedOperationException(operation.name() + " operation of type:" +
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici objectClass.objectClassValue + " is not supported.")
4b3769ce483ece06f60f983193712492b920144fJake Feasel}
4b3769ce483ece06f60f983193712492b920144fJake Feasel