001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyrighted [year] [name of copyright owner]".
013 *
014 * Copyright 2014-2016 ForgeRock AS. All rights reserved.
015 */
016
017package org.forgerock.openam.sts.tokengeneration.saml2.statements;
018
019import com.iplanet.sso.SSOToken;
020import com.sun.identity.saml2.assertion.AttributeStatement;
021import org.forgerock.openam.sts.TokenCreationException;
022import org.forgerock.openam.sts.config.user.SAML2Config;
023
024import java.util.List;
025
026/**
027 * Defines the concerns of generating the AttributeStatement list to be included in the SAML2 assertion. If no custom
028 * class is specified in the SAML2Config, then the DefaultAttributeStatementsProvider will be used.
029 *
030 * @supported.all.api
031 */
032public interface AttributeStatementsProvider {
033
034    /**
035     * Invoked to obtain the List of AttributeStatement instances to be included in the generated SAML2 assertion.
036     *
037     * @param ssoToken The SSOToken corresponding to asserted subject
038     * @param saml2Config The STS-instance-specific SAML2 configurations
039     * @param attributeMapper The AttributeMapper implementation which will map attributes. If the AttributeMapper cannot map
040     *                        any attributes, then an empty list should be returned.
041     * @return The list of AttributeStatement instances containing the mapped attributes, or an empty list, if no attributes could
042     * be mapped.
043     * @throws TokenCreationException
044     */
045    List<AttributeStatement> get(SSOToken ssoToken, SAML2Config saml2Config, AttributeMapper attributeMapper) throws TokenCreationException;
046}