AuthenticationSupported (Gradle API 2.14.1)

Package: org.gradle.api.artifacts.repositories

## [Java] Interface AuthenticationSupported

- An artifact repository which supports username/password authentication.

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `authentication(Action<? super AuthenticationContainer> action)`
    `void` | `credentials(Action<? super PasswordCredentials> action)` Configures the username and password credentials for this repository using the supplied action.
    `void` | `credentials(Class<T> credentialsType, Action<? super T> action)` Configures the credentials for this repository using the supplied action.
    `AuthenticationContainer` | `getAuthentication()` Returns the authentication schemes for this repository.
    `PasswordCredentials` | `getCredentials()` Returns the username and password credentials used to authenticate to this repository.
    `T` | `getCredentials(Class<T> credentialsType)` Returns the credentials of the specified type used to authenticate with this repository.

- - ### Method Detail

    - #### @Incubating public void authentication(Action<? super AuthenticationContainer> action)

      Configures the authentication schemes for this repository.

      This method executes the given action against the AuthenticationContainer for this project. The AuthenticationContainer is passed to the closure as the closure's delegate.

      If no authentication schemes have been assigned to this repository, a default set of authentication schemes are used based on the repository's transport scheme.

           repositories {
               maven {
                   url "${url}"
                   authentication {
                       basic(BasicAuthentication)
                   }
               }
           }

      Supported authentication scheme types extend Authentication.

      Parameters:
        `action` - the action to use to configure the authentication schemes.

    - #### public void credentials(Action<? super PasswordCredentials> action)

      Configures the username and password credentials for this repository using the supplied action.

      If no credentials have been assigned to this repository, an empty set of username and password credentials is assigned to this repository and passed to the action.

           repositories {
               maven {
                   url "${url}"
                   credentials {
                       username = 'joe'
                       password = 'secret'
                   }
               }
           }

      throws:
        IllegalStateException when the credentials assigned to this repository are not of type PasswordCredentials

    - #### @Incubating public void credentials(Class<T> credentialsType, Action<? super T> action)

      Configures the credentials for this repository using the supplied action.

      If no credentials have been assigned to this repository, an empty set of credentials of the specified type will be assigned to this repository and given to the configuration action. If credentials have already been specified for this repository, they will be passed to the given configuration action.

           repositories {
               maven {
                   url "${url}"
                   credentials(AwsCredentials) {
                       accessKey "myAccessKey"
                       secretKey "mySecret"
                   }
               }
           }

      The following credential types are currently supported for the `credentialsType` argument:

      - PasswordCredentials
      - AwsCredentials
      throws:
        IllegalArgumentException if `credentialsType` is not of a supported type
      throws:
        IllegalArgumentException if `credentialsType` is of a different type to the credentials previously specified for this repository

    - #### @Incubating public AuthenticationContainer getAuthentication()

      Returns the authentication schemes for this repository.

      Returns:
        the authentication schemes for this repository

    - #### public PasswordCredentials getCredentials()

      Returns the username and password credentials used to authenticate to this repository.

      If no credentials have been assigned to this repository, an empty set of username and password credentials is assigned to this repository and returned.

      If you are using a different type of credentials than PasswordCredentials, please use getCredentials(Class) to obtain the credentials.

      throws:
        IllegalStateException if the credential type was previously set with credentials(Class, Action) where the type was not PasswordCredentials
      Returns:
        the credentials

    - #### @Incubating public T getCredentials(Class<T> credentialsType)

      Returns the credentials of the specified type used to authenticate with this repository.

      If no credentials have been assigned to this repository, an empty set of credentials of the specified type is assigned to this repository and returned.

      throws:
        IllegalArgumentException when the credentials assigned to this repository are not assignable to the specified type
      Parameters:
        `credentialsType` - type of the credential
      Returns:
        The credentials