From 679037b81dee889bdd3b79bd02c37353df63ccc5 Mon Sep 17 00:00:00 2001 From: Fabian Henneke Date: Mon, 24 Aug 2020 09:11:40 +0200 Subject: [PATCH] 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. --- .../main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt b/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt index ae4674fe..3efd3bd8 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt @@ -57,6 +57,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) } @@ -65,7 +66,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 } }