<commit_before>/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.hod.client.api.authentication;

import com.hp.autonomy.hod.client.api.authentication.tokeninformation.*;
import com.hp.autonomy.hod.client.error.HodErrorException;
import com.hp.autonomy.hod.client.token.TokenProxy;

import java.util.Collection;
import java.util.UUID;

/**
 * Service for making authentication requests to HP Haven OnDemand
 */
public interface AuthenticationService {

    /**
     * Acquire a token for an application
     * @param apiKey The API key of the application
     * @param applicationName The name of the application
     * @param domain The domain of the application
     * @param tokenType The type of the resulting token
     * @param <T> The type of the required token type
     * @return A token for use with HP Haven OnDemand
     * @throws HodErrorException
     */
    <T extends TokenType> TokenProxy<EntityType.Application, T> authenticateApplication(
        ApiKey apiKey,
        String applicationName,
        String domain,
        T tokenType
    ) throws HodErrorException;

    /**
     * Acquire a token for a user
     * @param apiKey The API key of the user
     * @param applicationName The name of the application
     * @param applicationDomain The domain of the application
     * @param tokenType The type of the resulting token
     * @param <T> The type of the required token type
     * @return A token for use with HP Haven OnDemand
     * @throws HodErrorException
     */
    <T extends TokenType> TokenProxy<EntityType.User, T> authenticateUser(
        ApiKey apiKey,
        String applicationName,
        String applicationDomain,
        T tokenType
    ) throws HodErrorException;

    /**
     * Acquire a token for a user in a given user store
     * @param apiKey The API key of the user
     * @param applicationName The name of the application
     * @param applicationDomain The domain of the application
     * @param tokenType The type of the resulting token
     * @param userStore The name of the user store
     * @param storeDomain The domain of the user store
     * @param <T> The type of the required token type
     * @return A token for use with HP Haven OnDemand
     * @throws HodErrorException
     */
    <T extends TokenType> TokenProxy<EntityType.User, T> authenticateUser(
        ApiKey apiKey,
        String applicationName,
        String applicationDomain,
        T tokenType,
        String userStore,
        String storeDomain
    ) throws HodErrorException;

    // TODO: JavaDoc
    AuthenticationToken<EntityType.Developer, TokenType.HmacSha1> authenticateDeveloper(
        ApiKey apiKey,
        UUID tenantUuid,
        String email
    ) throws HodErrorException;

    /**
     * Acquire an unbound application token for use with HP Haven OnDemand. This must be combined with an unbound user
     * token before it can be used to query HP Haven OnDemand
     * @param apiKey The application API key
     * @return A response containing an unbound application token and a list of applications
     * @throws HodErrorException
     */
    <T extends TokenType> AuthenticationToken<EntityType.Unbound, T> authenticateUnbound(
        ApiKey apiKey,
        T tokenType
    ) throws HodErrorException;

    /**
     * Get information from Haven OnDemand about a simple combined token.
     * @param token The combined token
     * @return Information about the combined token
     * @throws HodErrorException
     */
    CombinedTokenInformation getCombinedTokenInformation(AuthenticationToken<EntityType.Combined, TokenType.Simple> token) throws HodErrorException;

    /**
     * Get information from Haven OnDemand about an HMAC combined token.
     * @param token The combined token<commit_msg>[CCUK-1181] Added JavaDoc to the authenticate developer method. [rev: none]<commit_after>/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.hod.client.api.authentication;

import com.hp.autonomy.hod.client.api.authentication.tokeninformation.*;
import com.hp.autonomy.hod.client.error.HodErrorException;
import com.hp.autonomy.hod.client.token.TokenProxy;

import java.util.Collection;
import java.util.UUID;

/**
 * Service for making authentication requests to HP Haven OnDemand
 */
public interface AuthenticationService {

    /**
     * Acquire a token for an application
     * @param apiKey The API key of the application
     * @param applicationName The name of the application
     * @param domain The domain of the application
     * @param tokenType The type of the resulting token
     * @param <T> The type of the required token type
     * @return A token for use with HP Haven OnDemand
     * @throws HodErrorException
     */
    <T extends TokenType> TokenProxy<EntityType.Application, T> authenticateApplication(
        ApiKey apiKey,
        String applicationName,
        String domain,
        T tokenType
    ) throws HodErrorException;

    /**
     * Acquire a token for a user
     * @param apiKey The API key of the user
     * @param applicationName The name of the application
     * @param applicationDomain The domain of the application
     * @param tokenType The type of the resulting token
     * @param <T> The type of the required token type
     * @return A token for use with HP Haven OnDemand
     * @throws HodErrorException
     */
    <T extends TokenType> TokenProxy<EntityType.User, T> authenticateUser(
        ApiKey apiKey,
        String applicationName,
        String applicationDomain,
        T tokenType
    ) throws HodErrorException;

    /**
     * Acquire a token for a user in a given user store
     * @param apiKey The API key of the user
     * @param applicationName The name of the application
     * @param applicationDomain The domain of the application
     * @param tokenType The type of the resulting token
     * @param userStore The name of the user store
     * @param storeDomain The domain of the user store
     * @param <T> The type of the required token type
     * @return A token for use with HP Haven OnDemand
     * @throws HodErrorException
     */
    <T extends TokenType> TokenProxy<EntityType.User, T> authenticateUser(
        ApiKey apiKey,
        String applicationName,
        String applicationDomain,
        T tokenType,
        String userStore,
        String storeDomain
    ) throws HodErrorException;

    /**
     * Acquire a token for a developer.
     * @param apiKey The API key to use for authentication
     * @param tenantUuid The UUID of the developer's tenant
     * @param email The email address of the developer
     * @return A token to authenticate request made to Haven OnDemand
     * @throws HodErrorException
     */
    AuthenticationToken<EntityType.Developer, TokenType.HmacSha1> authenticateDeveloper(
        ApiKey apiKey,
        UUID tenantUuid,
        String email
    ) throws HodErrorException;

    /**
     * Acquire an unbound application token for use with HP Haven OnDemand. This must be combined with an unbound user
     * token before it can be used to query HP Haven OnDemand
     * @param apiKey The application API key
     * @return A response containing an unbound application token and a list of applications
     * @throws HodErrorException
     */
    <T extends TokenType> AuthenticationToken<EntityType.Unbound, T> authenticateUnbound(
        ApiKey apiKey,
        T tokenType
    ) throws HodErrorException;

    /**
     * Get information from Haven OnDemand about a simple combined token.
     * @param token The combined token
     * @return Information about the combined token
     * @throws HodErrorException
     */
    CombinedTokenInformation getCombinedTokenInformation(AuthenticationToken<EntityType.Combined, TokenType.Simple> token) throws HodErrorException;

    /**
     * Get information from Haven OnDemand about an HMAC combined token.
     * @param token The combined token
{'fraction_non_alphanumeric': 0.06003889158969373, 'fraction_numerical': 0.001701507049100632, 'mean_word_length': 2.99078564500485, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5329644', 'n_tokens_mistral': 2155, 'n_tokens_neox': 2082, 'n_words': 871}