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.sun.identity.saml2.assertion.Conditions;
020import org.forgerock.openam.sts.TokenCreationException;
021import org.forgerock.openam.sts.config.user.SAML2Config;
022import org.forgerock.openam.sts.token.SAML2SubjectConfirmation;
023
024import java.util.Date;
025
026/**
027 *  Implementations of this interface will be consulted to obtain the Conditions object included in generated SAML2 assertions.
028 *  If the published STS instance does not encapsulate a custom ConditionsProvider, then the DefaultConditionsProvider class
029 *  will be referenced to obtain the Conditions statement.
030 *
031 * @supported.all.api
032 */
033public interface ConditionsProvider {
034    /**
035     * Called to obtain the Conditions instance to be included in the generated SAML2 assertion
036     * @param saml2Config STS-instance-specific SAML2 configurations
037     * @param issueInstant The instant at which the enclosing assertion was issued
038     * @param saml2SubjectConfirmation The subject confirmation specification
039     * @return The generated Conditions instance.
040     * @throws TokenCreationException
041     */
042    Conditions get(SAML2Config saml2Config, Date issueInstant,
043                   SAML2SubjectConfirmation saml2SubjectConfirmation) throws TokenCreationException;
044}