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;
029
030import java.util.Map;
031import java.util.Set;
032
033/**
034 * Translates from a source to a map of attributes.
035 * @param <T> The type of source.
036 *
037 * @supported.all.api
038 */
039public interface AttributeMapper<T> {
040
041    /**
042     * Initialise the instance for i18n.
043     * @param bundleName The name of the bundle for exceptions thrown by the getAttributes method.
044     */
045    void init(String bundleName);
046
047    /**
048     * Maps from values found in the source to a map of keys in the result, according to a provided map of keys in the
049     * source to keys in the result.
050     * @param attributeMapConfiguration The map of keys in the source to keys in the result.
051     * @param source The source of values.
052     * @return A map of attribute keys to values found.
053     * @throws AuthLoginException
054     */
055    Map<String, Set<String>> getAttributes(Map<String, String> attributeMapConfiguration, T source)
056            throws AuthLoginException;
057
058}