/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions Copyrighted [year] [name of copyright owner]".
*
* Copyright 2015 ForgeRock AS.
*/

package org.forgerock.openam.sts.soap.token.provider.oidc;

import org.apache.cxf.sts.request.ReceivedToken;
import org.apache.ws.security.handler.WSHandlerResult;

import java.util.List;
import java.util.Set;

/**
 * An interface which allows soap-sts publishers to generate the amr claim for issued OpenIdConnect tokens on the basis
 * of the validated input token. See the amr claim here: http://openid.net/specs/openid-connect-core-1_0.html#IDToken.
 */
public interface SoapOpenIdConnectTokenAuthnMethodsReferencesMapper {
    /**
     * Returns the SAML2 AuthnContext class reference corresponding to the SupportingToken specified in the SecurityPolicy
     * bindings protecting a soap-sts instance.
     * @param securityPolicyBindingTraversalYield The yield of SecurityPolicy binding verification, as generated by apache
     *                                            wss4j. See the DefaultSaml2XmlTokenAuthnContextMapper for details on
     *                                            how to parse the classes corresponding to this processing.
     * @return A valid AuthnContext value, as defined here: http://docs.oasis-open.org/security/saml/v2.0/saml-authn-context-2.0-os.pdf
     */
    Set<String> getAuthnMethodsReferences(List<WSHandlerResult> securityPolicyBindingTraversalYield);

    /**
     * Returns the SAML2 AuthnContext class reference for delegated tokens (specified as part of the ActAs/OnBehalfOf
     * element in the RequestSecurityToken). The {@code List<WSHandlerResult> } which is the yield of the SecurityPolicy binding
     * traversal, is only provided as additional context, as the manner in which the delegated token was secured may well
     * have bearing on the type of AuthnContext class ref chosen, though it is not examined for the default implementation.
     * @param securityPolicyBindingTraversalYield The yield of SecurityPolicy binding verification, as generated by apache
     *                                            wss4j. See the DefaultSaml2XmlTokenAuthnContextMapper for details on
     *                                            how to parse the classes corresponding to this processing.
     * @param delegatedToken The token provided as part of the ActAs/OnBehalfOf element specified in the RequestSecurityToken.
     * @return A valid AuthnContext value, as defined here: http://docs.oasis-open.org/security/saml/v2.0/saml-authn-context-2.0-os.pdf
     */
    Set<String> getAuthnMethodsReferencesForDelegatedToken(List<WSHandlerResult> securityPolicyBindingTraversalYield, ReceivedToken delegatedToken);

}
