# getCredentials

abstract fun getCredentials(): PasswordCredentials(source)

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 to obtain the credentials.

#### Return

the credentials

#### Since

1.0

#### Throws

java.lang.IllegalStateException

if the credential type was previously set with credentials where the type was not PasswordCredentials

abstract fun <T : Credentials?> getCredentials(credentialsType: Class<T>): T(source)

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.

#### Return

The credentials

#### Since

2.4

#### Parameters

credentialsType

type of the credential

#### Throws

java.lang.IllegalArgumentException

when the credentials assigned to this repository are not assignable to the specified type