remove PluginDatabaseManager and PluginEndpointDiscovery

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-12-21 20:41:08 +01:00
parent d9d62ef90c
commit 8379bf4a80
25 changed files with 105 additions and 115 deletions
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import {
decodeProtectedHeader,
exportJWK,
@@ -27,6 +27,7 @@ import { v4 as uuid } from 'uuid';
import { DefaultIdentityClient } from './DefaultIdentityClient';
import { IdentityApiGetIdentityRequest } from './IdentityApi';
import { DiscoveryService } from '@backstage/backend-plugin-api';
interface AnyJWK extends Record<string, string> {
use: 'sig';
@@ -87,7 +88,7 @@ function jwtKid(jwt: string): string {
const server = setupServer();
const mockBaseUrl = 'http://backstage:9191/i-am-a-mock-base';
const discovery: PluginEndpointDiscovery = {
const discovery: DiscoveryService = {
async getBaseUrl() {
return mockBaseUrl;
},
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import { AuthenticationError } from '@backstage/errors';
import {
createRemoteJWKSet,
@@ -28,6 +27,7 @@ import { GetKeyFunction } from 'jose/dist/types/types';
import { getBearerTokenFromAuthorizationHeader } from './getBearerTokenFromAuthorizationHeader';
import { IdentityApi, IdentityApiGetIdentityRequest } from './IdentityApi';
import { BackstageIdentityResponse } from '../types';
import { DiscoveryService } from '@backstage/backend-plugin-api';
const CLOCK_MARGIN_S = 10;
@@ -38,7 +38,7 @@ const CLOCK_MARGIN_S = 10;
* @public
*/
export type IdentityClientOptions = {
discovery: PluginEndpointDiscovery;
discovery: DiscoveryService;
issuer?: string;
/** JWS "alg" (Algorithm) Header Parameter values. Defaults to an array containing just ES256.
@@ -54,7 +54,7 @@ export type IdentityClientOptions = {
* @public
*/
export class DefaultIdentityClient implements IdentityApi {
private readonly discovery: PluginEndpointDiscovery;
private readonly discovery: DiscoveryService;
private readonly issuer?: string;
private readonly algorithms?: string[];
private keyStore?: GetKeyFunction<JWSHeaderParameters, FlattenedJWSInput>;
@@ -14,7 +14,6 @@
* limitations under the License.
*/
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import { registerMswTestHooks } from '@backstage/backend-test-utils';
import {
decodeProtectedHeader,
@@ -28,6 +27,7 @@ import { setupServer } from 'msw/node';
import { v4 as uuid } from 'uuid';
import { IdentityClient } from './IdentityClient';
import { DiscoveryService } from '@backstage/backend-plugin-api';
interface AnyJWK extends Record<string, string> {
use: 'sig';
@@ -88,7 +88,7 @@ function jwtKid(jwt: string): string {
const server = setupServer();
const mockBaseUrl = 'http://backstage:9191/i-am-a-mock-base';
const discovery: PluginEndpointDiscovery = {
const discovery: DiscoveryService = {
async getBaseUrl() {
return mockBaseUrl;
},