Return HTTPS URI username from CredentialsProvider (#1049)
Let the PasswordFinderCredentialsProvider support Username as a
CredentialItem type and return the user part of the repository URI when
it is requested.
(cherry picked from commit 679037b81d
)
This commit is contained in:
parent
a29414fce6
commit
e4ce435f00
1 changed files with 2 additions and 1 deletions
|
@ -58,6 +58,7 @@ abstract class GitOperation(gitDir: File, internal val callingActivity: Fragment
|
|||
override fun get(uri: URIish?, vararg items: CredentialItem): Boolean {
|
||||
for (item in items) {
|
||||
when (item) {
|
||||
is CredentialItem.Username -> item.value = uri?.user
|
||||
is CredentialItem.Password -> item.value = passwordFinder.reqPassword(null)
|
||||
else -> UnsupportedCredentialItem(uri, item.javaClass.name)
|
||||
}
|
||||
|
@ -66,7 +67,7 @@ abstract class GitOperation(gitDir: File, internal val callingActivity: Fragment
|
|||
}
|
||||
|
||||
override fun supports(vararg items: CredentialItem) = items.all {
|
||||
it is CredentialItem.Password
|
||||
it is CredentialItem.Username || it is CredentialItem.Password
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue