class TokenRequestMarshallerImpl implements TokenRequestMarshaller {

    @Override
    public RestTokenProviderParameters<?> buildTokenProviderParameters(
                                                                        TokenTypeId inputTokenType,
                                                                        JsonValue inputToken,
                                                                        TokenTypeId desiredTokenType,
                                                                        JsonValue desiredTokenState) throws TokenMarshalException {
        if (TokenType.SAML2.getId().equals(desiredTokenType.getId())) {
            return createSAML2TokenProviderParameters(inputTokenType, inputToken, desiredTokenState);
        } else if (TokenType.OPENIDCONNECT.getId().equals(desiredTokenType.getId())) {
            return createOpenIdConnectTokenProviderParameters(inputTokenType, inputToken, desiredTokenState);
        } else {
            for (CustomTokenOperation customTokenOperation : customTokenProviders) {
                if (desiredTokenType.getId().equals(customTokenOperation.getCustomTokenName())) {
                    return buildCustomTokenProviderParameters(inputTokenType, inputToken, desiredTokenState);
                }
            }
        }
        throw new TokenMarshalException(ResourceException.BAD_REQUEST, "Unsupported output token type: " + desiredTokenType);
    }

    @Inject  TokenRequestMarshallerImpl(@Named(AMSTSConstants.OFFLOADED_TWO_WAY_TLS_HEADER_KEY) String  offloadedTlsClientCertKey,
                               @Named(AMSTSConstants.TLS_OFFLOAD_ENGINE_HOSTS) Set<String> tlsOffloadEngineHosts,
                               @Named(AMSTSConstants.REST_CUSTOM_TOKEN_VALIDATORS) Set<CustomTokenOperation> customTokenValidators,
                               @Named(AMSTSConstants.REST_CUSTOM_TOKEN_PROVIDERS) Set<CustomTokenOperation> customTokenProviders,
                               Logger logger);

}