Interface CredentialsContainer
-
- All Implemented Interfaces:
public interface CredentialsContainerHolds credentials to access a remote service.
Similar to the credentials part of Gradle's org.gradle.api.artifacts.repositories.AuthenticationSupported (which unfortunately cannot be extended with new credential types).
-
-
Method Summary
Modifier and Type Method Description abstract PasswordCredentialsgetCredentials()Returns the username/password credentials used to authenticate to this service. abstract <T extends Credentials> TgetCredentials(Class<T> type)Returns the credentials of the specified type used to authenticate with this service. abstract <T extends Credentials> Unitcredentials(Class<T> type, Action<in T> configAction)Configures the credentials for this service using the supplied action. <T extends Credentials> Unitcredentials(Class<T> type, @DelegatesTo(strategy = 1, genericTypeIndex = 0) Closure<?> configClosure)Configures the credentials for this service using the supplied closure. abstract Unitcredentials(Action<in PasswordCredentials> configAction)Configures the username/password credentials for this service using the supplied action. Unitcredentials(@DelegatesTo(value = PasswordCredentials.class, strategy = 1) Closure<?> configClosure)Configures the username/password credentials for this service using the supplied closure. abstract Provider<Credentials>getConfiguredCredentials()A provider that returns the currently configured credentials. -
-
Method Detail
-
getCredentials
abstract PasswordCredentials getCredentials()
Returns the username/password credentials used to authenticate to this service.
If no credentials have been assigned to this repository, an empty set of username/password credentials is assigned to this repository and returned.
If you are using a different type of credentials than PasswordCredentials, please use the
getCredentials(Class)method to obtain the credentials.- Returns:
the current PasswordCredentials
-
getCredentials
abstract <T extends Credentials> T getCredentials(Class<T> type)
Returns the credentials of the specified type used to authenticate with this service.
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:
type- the type of credentials- Returns:
the credentials
-
credentials
abstract <T extends Credentials> Unit credentials(Class<T> type, Action<in T> configAction)
Configures the credentials for this service 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.
credentials(CertificateCredentials) { certificateFile file("/path/to/certificate") keyFile file("/path/to/key") }The following credential types are currently supported for the
typeargument:- Parameters:
type- the type of credentialsconfigAction- an Action to configure the credentials
-
credentials
@Deprecated(message = "The function is deprecated: Gradle doesn't recommend to pass `Closure<*>` as input parameter. Nothing needs to be changed for Groovy users, please use overloaded method in Java/Kotlin", replaceWith = @ReplaceWith(imports = {}, expression = "credentials")) <T extends Credentials> Unit credentials(Class<T> type, @DelegatesTo(strategy = 1, genericTypeIndex = 0) Closure<?> configClosure)
Configures the credentials for this service using the supplied closure.
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.
credentials(CertificateCredentials) { certificateFile file("/path/to/certificate") keyFile file("/path/to/key") }The following credential types are currently supported for the
typeargument:- Parameters:
type- the type of credentialsconfigClosure- a Closure to configure the credentials
-
credentials
abstract Unit credentials(Action<in PasswordCredentials> configAction)
Configures the username/password credentials for this service using the supplied action.
If no credentials have been assigned to this repository, an empty set of username/password credentials is assigned to this repository and passed to the action.
credentials { username = 'joe' password = 'secret' }- Parameters:
configAction- an Action to configure the credentials
-
credentials
@Deprecated(message = "The function is deprecated: Gradle doesn't recommend to pass `Closure<*>` as input parameter. Nothing needs to be changed for Groovy users, please use overloaded method in Java/Kotlin", replaceWith = @ReplaceWith(imports = {}, expression = "credentials")) Unit credentials(@DelegatesTo(value = PasswordCredentials.class, strategy = 1) Closure<?> configClosure)
Configures the username/password credentials for this service using the supplied closure.
If no credentials have been assigned to this repository, an empty set of username/password credentials is assigned to this repository and passed to the action.
credentials { username = 'joe' password = 'secret' }- Parameters:
configClosure- a Closure to configure the credentials
-
getConfiguredCredentials
abstract Provider<Credentials> getConfiguredCredentials()
A provider that returns the currently configured credentials.
Will have no value if no credentials have been configured.
-
-
-
-