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.
015 */
016
017package org.forgerock.openam.sts.tokengeneration.saml2.statements;
018
019import com.sun.identity.saml2.assertion.Subject;
020import org.forgerock.openam.sts.TokenCreationException;
021import org.forgerock.openam.sts.token.SAML2SubjectConfirmation;
022import org.forgerock.openam.sts.config.user.SAML2Config;
023import org.forgerock.openam.sts.user.invocation.ProofTokenState;
024
025import java.util.Date;
026
027/**
028 * Defines the concerns of providing the Subject to be included in the generated SAML2 assertion. If no custom class
029 * name is specified in the SAML2Config, then the DefaultSubjectProvider will be used.
030 *
031 * @supported.all.api
032 */
033public interface SubjectProvider {
034    /**
035     * Called to obtain the Subject instance to be included in the generated SAML2 assertion
036     * @param subjectId The identifier for the subject
037     * @param audienceId Used to set the recipient in the SubjectConfirmationData
038     * @param saml2Config The STS-instance specific SAML2 configuration state
039     * @param subjectConfirmation The type of subject confirmation
040     * @param assertionIssueInstant The issue instant assertion
041     * @param proofTokenState The instance containing the proof token necessary for HoK assertions.
042     * @return The to-be-included Subject instance
043     * @throws TokenCreationException
044     */
045    Subject get(String subjectId, String audienceId, SAML2Config saml2Config,
046                SAML2SubjectConfirmation subjectConfirmation, Date assertionIssueInstant,
047                ProofTokenState proofTokenState) throws TokenCreationException;
048}