rebase and fix bitbucket server

Signed-off-by: headphonejames <generalfuzz@gmail.com>
This commit is contained in:
headphonejames
2023-02-27 17:32:00 -08:00
parent 5177a7f2b4
commit 63a6a3d44b
3 changed files with 12 additions and 1 deletions
+3 -1
View File
@@ -233,9 +233,11 @@ export const apis = [
deps: {
discoveryApi: discoveryApiRef,
oauthRequestApi: oauthRequestApiRef,
configApi: configApiRef,
},
factory: ({ discoveryApi, oauthRequestApi }) =>
factory: ({ discoveryApi, oauthRequestApi, configApi }) =>
BitbucketServerAuth.create({
configApi,
discoveryApi,
oauthRequestApi,
defaultScopes: ['REPO_READ'],
@@ -17,6 +17,8 @@
import MockOAuthApi from '../../OAuthRequestApi/MockOAuthApi';
import { UrlPatternDiscovery } from '../../DiscoveryApi';
import BitbucketServerAuth from './BitbucketServerAuth';
import { ConfigReader } from '@backstage/config';
import { ConfigApi } from '@backstage/core-plugin-api';
const getSession = jest.fn();
@@ -40,7 +42,12 @@ describe('BitbucketServerAuth', () => {
['PROJECT_ADMIN', 'REPO_READ', 'ACCOUNT_WRITE'],
],
])(`should normalize scopes correctly - %p`, (scope, scopes) => {
const configApi: ConfigApi = new ConfigReader({
enableExperimentalRedirectFlow: false,
});
const bitbucketServerAuth = BitbucketServerAuth.create({
configApi: configApi,
oauthRequestApi: new MockOAuthApi(),
discoveryApi: UrlPatternDiscovery.compile('http://example.com'),
});
@@ -48,6 +48,7 @@ export default class BitbucketServerAuth {
options: OAuthApiCreateOptions,
): typeof bitbucketServerAuthApiRef.T {
const {
configApi,
discoveryApi,
environment = 'development',
provider = DEFAULT_PROVIDER,
@@ -56,6 +57,7 @@ export default class BitbucketServerAuth {
} = options;
return OAuth2.create({
configApi,
discoveryApi,
oauthRequestApi,
provider,