001/* 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright 2011-2015 ForgeRock AS. All rights reserved. 005 * 006 * The contents of this file are subject to the terms 007 * of the Common Development and Distribution License 008 * (the License). You may not use this file except in 009 * compliance with the License. 010 * 011 * You can obtain a copy of the License at 012 * http://forgerock.org/license/CDDLv1.0.html 013 * See the License for the specific language governing 014 * permission and limitations under the License. 015 * 016 * When distributing Covered Code, include this CDDL 017 * Header Notice in each file and include the License file 018 * at http://forgerock.org/license/CDDLv1.0.html 019 * If applicable, add the following below the CDDL Header, 020 * with the fields enclosed by brackets [] replaced by 021 * your own identifying information: 022 * "Portions Copyrighted [year] [name of copyright owner]" 023 * 024 */ 025 026package org.forgerock.openam.authentication.modules.common.mapping; 027 028import com.sun.identity.authentication.spi.AuthLoginException; 029import com.sun.identity.idm.AMIdentity; 030import com.sun.identity.idm.AMIdentityRepository; 031import java.util.Map; 032import java.util.Set; 033 034/** 035 * Implementations of this interface provide the means to search for and create users given a map of attributes. 036 * @see org.forgerock.openam.authentication.modules.common.mapping.DefaultAccountProvider 037 * 038 * @supported.all.api 039 */ 040public interface AccountProvider { 041 042 /** 043 * Search for a user given a map of attributes. 044 * @param idrepo The identity repository. 045 * @param attr The set of attributes, which should be treated as 'or' statements. 046 * @return The first matching user found. 047 */ 048 AMIdentity searchUser(AMIdentityRepository idrepo, Map<String, Set<String>> attr); 049 050 /** 051 * Provisions a user with the specified attributes. 052 * @param idrepo The identity repository in which the user will be created. 053 * @param attributes The user attributes. 054 * @return The created user identity. 055 * @throws AuthLoginException Thrown if user creation fails. 056 */ 057 AMIdentity provisionUser(AMIdentityRepository idrepo, Map<String, Set<String>> attributes) throws AuthLoginException; 058 059}