Interface AuthenticationSupported
- All Known Subinterfaces:
IvyArtifactRepository,JavaToolchainRepository,MavenArtifactRepository
-
Method Summary
Modifier and TypeMethodDescriptionvoidauthentication(Action<? super AuthenticationContainer> action) Configures the authentication schemes for this repository.voidcredentials(Class<? extends Credentials> credentialsType) Configures the credentials for this repository that will be provided by the build.<T extends Credentials>
voidcredentials(Class<T> credentialsType, Action<? super T> action) Configures the credentials for this repository using the supplied action.voidcredentials(Action<? super PasswordCredentials> action) Configures the username and password credentials for this repository using the supplied action.Returns the authentication schemes for this repository.Returns the username and password credentials used to authenticate to this repository.<T extends Credentials>
TgetCredentials(Class<T> credentialsType) Returns the credentials of the specified type used to authenticate with this repository.
-
Method Details
-
getCredentials
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 usegetCredentials(Class)to obtain the credentials.- Returns:
- the credentials
- Throws:
IllegalStateException- if the credential type was previously set withcredentials(Class, Action)where the type was notPasswordCredentials
-
getCredentials
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.
- Parameters:
credentialsType- type of the credential- Returns:
- The credentials
- Throws:
IllegalArgumentException- when the credentials assigned to this repository are not assignable to the specified type
-
credentials
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 = "https://example.com/m2" credentials { username = 'joe' password = 'secret' } } }- Throws:
IllegalStateException- when the credentials assigned to this repository are not of typePasswordCredentials
-
credentials
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 = "https://example.com/aws/proxy" credentials(AwsCredentials) { accessKey = "myAccessKey" secretKey = "mySecret" } } }The following credential types are currently supported for the
credentialsTypeargument:- Throws:
IllegalArgumentException- ifcredentialsTypeis not of a supported typeIllegalArgumentException- ifcredentialsTypeis of a different type to the credentials previously specified for this repository
-
credentials
Configures the credentials for this repository that will be provided by the build.Credentials will be provided from Gradle properties based on the repository name. If credentials for this repository can not be resolved and the repository will be used in the current build, then the build will fail to start and point to the missing configuration.
repositories { maven { url = "https://example.com/m2" credentials(PasswordCredentials) } }The following credential types are currently supported for the
credentialsTypeargument:- Throws:
IllegalArgumentException- ifcredentialsTypeis not of a supported type- Since:
- 6.6
-
authentication
Configures the authentication schemes for this repository.
This method executes the given action against the
AuthenticationContainerfor this project. TheAuthenticationContaineris 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 = "https://example.com/m2" authentication { basic(BasicAuthentication) } } }Supported authentication scheme types extend
Authentication.- Parameters:
action- the action to use to configure the authentication schemes.
-
getAuthentication
AuthenticationContainer getAuthentication()Returns the authentication schemes for this repository.- Returns:
- the authentication schemes for this repository
-