Skip to content

Commit

Permalink
feat: Allow to configure 2 github providers simultaneously (#966)
Browse files Browse the repository at this point in the history
* feat: Allow to configure 2 github providers simultaneously

Signed-off-by: Anatolii Bazko <[email protected]>

* yarn test -u

Signed-off-by: Anatolii Bazko <[email protected]>

---------

Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha authored Oct 30, 2023
1 parent ce115df commit fd69603
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/common/src/dto/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ export { webSocket };

export type GitOauthProvider =
| 'github'
| 'github_2'
| 'gitlab'
| 'bitbucket'
| 'bitbucket-server'
| 'azure-devops';

// The list of available Git providers for PAT
// https://eclipse.dev/che/docs/stable/end-user-guide/using-a-git-provider-access-token/
export type GitProvider =
| 'github'
| 'gitlab'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ exports[`GitServices should correctly render the component which contains four g
data-label="Name"
onMouseEnter={[Function]}
>
Bitbucket Server
Bitbucket Server (OAuth 1.0)
<span>
Provided API does not support the automatic token revocation. You can revoke it manually on  
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { AppState } from '@/store';
import * as GitOauthConfig from '@/store/GitOauthConfig';
import { selectGitOauth, selectIsLoading } from '@/store/GitOauthConfig/selectors';

export const enabledProviders: api.GitOauthProvider[] = ['github'];
export const enabledProviders: api.GitOauthProvider[] = ['github', 'github_2'];

type Props = MappedProps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ import { api } from '@eclipse-che/common';

export const GIT_OAUTH_PROVIDERS: Record<api.GitOauthProvider, string> = {
'azure-devops': 'Microsoft Azure DevOps',
bitbucket: 'Bitbucket Server',
// Either Bitbucket Cloud or Bitbucket Server
// https://github.com/eclipse-che/che-server/blob/main/wsmaster/che-core-api-auth-bitbucket/src/main/java/org/eclipse/che/security/oauth/BitbucketOAuthAuthenticator.java
'bitbucket-server': 'Bitbucket',
// Bitbucket Server only
// https://github.com/eclipse-che/che-server/blob/main/wsmaster/che-core-api-auth-bitbucket/src/main/java/org/eclipse/che/security/oauth1/BitbucketServerOAuthAuthenticator.java
bitbucket: 'Bitbucket Server (OAuth 1.0)',
github: 'GitHub',
github_2: 'GitHub (The second provider)',
gitlab: 'GitLab',
} as const;

Expand All @@ -35,5 +41,6 @@ export const PROVIDER_ENDPOINTS: Record<api.GitOauthProvider | api.GitProvider,
'bitbucket-server': '',
bitbucket: '',
github: 'https://github.com',
github_2: 'https://github.com',
gitlab: 'https://gitlab.com',
} as const;

0 comments on commit fd69603

Please sign in to comment.