mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[collab] rename service
GitOrigin-RevId: 1fe8e4ab7de6f78300e62799fd8d189a79b2c6e7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0774cd8a14
commit
422f6a997f
@@ -16,6 +16,8 @@ import org.jetbrains.annotations.ApiStatus
|
||||
* Base class that provides a business logic part of [GitHttpAuthDataProvider] interface,
|
||||
* that can be extended by git hosting providers such as Space, GitHub, GitLab, BitBucket, etc.
|
||||
*
|
||||
* Will do no user interaction
|
||||
*
|
||||
* This logic can be described as: if user is logged in plugin (so their account is stored in [accountManager])
|
||||
* then their token will be passed as password for http remote operations.
|
||||
*
|
||||
@@ -28,7 +30,7 @@ import org.jetbrains.annotations.ApiStatus
|
||||
* Clients' auth data providers should be registered in plugin.xml with "Git4Idea.GitHttpAuthDataProvider" extension.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
abstract class HostedGitHttpAuthDataProvider<A : ServerAccount> : GitHttpAuthDataProvider {
|
||||
abstract class SilentHostedGitHttpAuthDataProvider<A : ServerAccount> : GitHttpAuthDataProvider {
|
||||
abstract val providerId: String
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="Git4Idea">
|
||||
<GitHttpAuthDataProvider implementation="org.jetbrains.plugins.github.extensions.GHHttpAuthDataProvider"/>
|
||||
<GitHttpAuthDataProvider implementation="org.jetbrains.plugins.github.extensions.GHSilentHttpAuthDataProvider"/>
|
||||
<GitHttpAuthDataProvider implementation="org.jetbrains.plugins.github.extensions.GHComHttpAuthDataProvider"/>
|
||||
<gitRepositoryHostingService implementation="org.jetbrains.plugins.github.extensions.GHRepositoryHostingService"/>
|
||||
<gitProtectedBranchProvider implementation="org.jetbrains.plugins.github.util.GithubProtectedBranchProvider"/>
|
||||
|
||||
@@ -14,7 +14,7 @@ internal class GHRepositoryHostingService : GitRepositoryHostingService() {
|
||||
@RequiresBackgroundThread
|
||||
override fun getInteractiveAuthDataProvider(project: Project, url: String)
|
||||
: InteractiveGitHttpAuthDataProvider? = runBlocking {
|
||||
GHHttpAuthDataProvider.getAccountsWithTokens(project, url).takeIf { it.isNotEmpty() }?.let {
|
||||
GHSilentHttpAuthDataProvider.getAccountsWithTokens(project, url).takeIf { it.isNotEmpty() }?.let {
|
||||
GHSelectAccountHttpAuthDataProvider(project, it)
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,9 @@ internal class GHRepositoryHostingService : GitRepositoryHostingService() {
|
||||
@RequiresBackgroundThread
|
||||
override fun getInteractiveAuthDataProvider(project: Project, url: String, login: String)
|
||||
: InteractiveGitHttpAuthDataProvider? = runBlocking {
|
||||
GHHttpAuthDataProvider.getAccountsWithTokens(project, url).mapNotNull { (acc, token) ->
|
||||
GHSilentHttpAuthDataProvider.getAccountsWithTokens(project, url).mapNotNull { (acc, token) ->
|
||||
if (token == null) return@mapNotNull null
|
||||
val details = GHHttpAuthDataProvider.getAccountDetails(acc, token) ?: return@mapNotNull null
|
||||
val details = GHSilentHttpAuthDataProvider.getAccountDetails(acc, token) ?: return@mapNotNull null
|
||||
if (details.login != login) return@mapNotNull null
|
||||
acc to token
|
||||
}.takeIf { it.isNotEmpty() }?.let {
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.intellij.openapi.progress.DumbProgressIndicator
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.project.Project
|
||||
import git4idea.remote.hosting.http.HostedGitAuthenticationFailureManager
|
||||
import git4idea.remote.hosting.http.HostedGitHttpAuthDataProvider
|
||||
import git4idea.remote.hosting.http.SilentHostedGitHttpAuthDataProvider
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.jetbrains.plugins.github.api.GithubApiRequestExecutor
|
||||
@@ -20,9 +20,9 @@ import org.jetbrains.plugins.github.authentication.accounts.GithubAccount
|
||||
import org.jetbrains.plugins.github.authentication.accounts.GithubAccountInformationProvider
|
||||
import org.jetbrains.plugins.github.authentication.accounts.GithubProjectDefaultAccountHolder
|
||||
|
||||
private val LOG = logger<GHHttpAuthDataProvider>()
|
||||
private val LOG = logger<GHSilentHttpAuthDataProvider>()
|
||||
|
||||
internal class GHHttpAuthDataProvider : HostedGitHttpAuthDataProvider<GithubAccount>() {
|
||||
internal class GHSilentHttpAuthDataProvider : SilentHostedGitHttpAuthDataProvider<GithubAccount>() {
|
||||
override val providerId: String = "GitHub Plugin"
|
||||
|
||||
override val accountManager: AccountManager<GithubAccount, String>
|
||||
@@ -42,7 +42,7 @@
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="Git4Idea">
|
||||
<GitHttpAuthDataProvider implementation="org.jetbrains.plugins.gitlab.git.http.GitLabGitHttpAuthDataProvider"/>
|
||||
<GitHttpAuthDataProvider implementation="org.jetbrains.plugins.gitlab.git.http.GitLabSilentHttpAuthDataProvider"/>
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
|
||||
@@ -8,16 +8,16 @@ import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.project.Project
|
||||
import git4idea.remote.hosting.http.HostedGitAuthenticationFailureManager
|
||||
import git4idea.remote.hosting.http.HostedGitHttpAuthDataProvider
|
||||
import git4idea.remote.hosting.http.SilentHostedGitHttpAuthDataProvider
|
||||
import org.jetbrains.plugins.gitlab.api.GitLabApiManager
|
||||
import org.jetbrains.plugins.gitlab.api.request.getCurrentUser
|
||||
import org.jetbrains.plugins.gitlab.authentication.accounts.GitLabAccount
|
||||
import org.jetbrains.plugins.gitlab.authentication.accounts.GitLabAccountManager
|
||||
import org.jetbrains.plugins.gitlab.authentication.accounts.GitLabProjectDefaultAccountHolder
|
||||
|
||||
private val LOG = logger<GitLabGitHttpAuthDataProvider>()
|
||||
private val LOG = logger<GitLabSilentHttpAuthDataProvider>()
|
||||
|
||||
internal class GitLabGitHttpAuthDataProvider : HostedGitHttpAuthDataProvider<GitLabAccount>() {
|
||||
internal class GitLabSilentHttpAuthDataProvider : SilentHostedGitHttpAuthDataProvider<GitLabAccount>() {
|
||||
override val providerId: String = "GitLab Plugin"
|
||||
|
||||
override val accountManager: AccountManager<GitLabAccount, String>
|
||||
Reference in New Issue
Block a user