AuthenticateScript.groovy revision f2b76022e244a5f1078d49d4d098f1f686062f62
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici * Copyright (c) 2014 ForgeRock AS. All Rights Reserved
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 * You can obtain a copy of the License at
4b3769ce483ece06f60f983193712492b920144fJake Feasel * See the License for the specific language governing
4b3769ce483ece06f60f983193712492b920144fJake Feasel * permission and limitations under the License.
4b3769ce483ece06f60f983193712492b920144fJake Feasel * When distributing Covered Code, include this CDDL
4b3769ce483ece06f60f983193712492b920144fJake Feasel * Header Notice in each file and include the License file
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]"
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Brici * @author Gael Allioux <gael.allioux@forgerock.com>
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.forgerock.openicf.connectors.scriptedsql.ScriptedSQLConfiguration
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.forgerock.openicf.misc.scriptedcommon.OperationType
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.common.security.GuardedString
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.common.security.SecurityUtil
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.framework.common.exceptions.InvalidPasswordException
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.framework.common.objects.ObjectClass
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Briciimport org.identityconnectors.framework.common.objects.OperationOptions
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Bricidef configuration = configuration as ScriptedSQLConfiguration
f2b76022e244a5f1078d49d4d098f1f686062f62Alin Bricisql.eachRow("SELECT id FROM Users WHERE uid = ? AND password = sha1(?)", [username, SecurityUtil.decrypt(password)]) {
4b3769ce483ece06f60f983193712492b920144fJake Feasel throw new InvalidPasswordException("Authentication Failed")