backend-plugin-api: remove identity and token manager services

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-08-21 15:31:15 +02:00
parent 337a4704a6
commit 1780a67bc5
47 changed files with 86 additions and 507 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ import { PermissionsServiceRequestOptions } from '@backstage/backend-plugin-api'
import { PolicyDecision } from '@backstage/plugin-permission-common';
import { QueryPermissionRequest } from '@backstage/plugin-permission-common';
import { ResourcePermission } from '@backstage/plugin-permission-common';
import { TokenManagerService } from '@backstage/backend-plugin-api';
import { TokenManager } from '@backstage/backend-common';
import { z } from 'zod';
// @public
@@ -290,7 +290,7 @@ export class ServerPermissionClient implements PermissionsService {
config: Config,
options: {
discovery: DiscoveryService;
tokenManager: TokenManagerService;
tokenManager?: TokenManager;
auth?: AuthService;
},
): ServerPermissionClient;
@@ -82,7 +82,6 @@ describe('ServerPermissionClient', () => {
it('should bypass the permission backend if permissions are disabled', async () => {
const client = ServerPermissionClient.fromConfig(new ConfigReader({}), {
discovery,
tokenManager: mockServices.tokenManager.mock(),
auth: mockServices.auth(),
});
@@ -101,7 +100,6 @@ describe('ServerPermissionClient', () => {
it('should bypass the permission backend if permissions are enabled and request has valid server credentials', async () => {
const client = ServerPermissionClient.fromConfig(config, {
discovery,
tokenManager: mockServices.tokenManager.mock(),
auth: mockServices.auth(),
});
@@ -115,7 +113,6 @@ describe('ServerPermissionClient', () => {
it('should call the permission backend if permissions are enabled and request does not have valid server credentials', async () => {
const client = ServerPermissionClient.fromConfig(config, {
discovery,
tokenManager: mockServices.tokenManager.mock(),
auth: mockServices.auth(),
});
@@ -156,7 +153,6 @@ describe('ServerPermissionClient', () => {
it('should bypass the permission backend if permissions are disabled', async () => {
const client = ServerPermissionClient.fromConfig(new ConfigReader({}), {
discovery,
tokenManager: mockServices.tokenManager.mock(),
auth: mockServices.auth(),
});
@@ -173,7 +169,6 @@ describe('ServerPermissionClient', () => {
it('should bypass the permission backend if permissions are enabled and request has valid server credentials', async () => {
const client = ServerPermissionClient.fromConfig(config, {
discovery,
tokenManager: mockServices.tokenManager.mock(),
auth: mockServices.auth(),
});
@@ -190,7 +185,6 @@ describe('ServerPermissionClient', () => {
it('should call the permission backend if permissions are enabled and request does not have valid server credentials', async () => {
const client = ServerPermissionClient.fromConfig(config, {
discovery,
tokenManager: mockServices.tokenManager.mock(),
auth: mockServices.auth(),
});
@@ -223,7 +217,6 @@ describe('ServerPermissionClient', () => {
}),
{
discovery,
tokenManager: mockServices.tokenManager(),
auth: mockServices.auth(),
},
);
@@ -14,7 +14,10 @@
* limitations under the License.
*/
import { createLegacyAuthAdapters } from '@backstage/backend-common';
import {
TokenManager,
createLegacyAuthAdapters,
} from '@backstage/backend-common';
import {
AuthService,
BackstageCredentials,
@@ -22,7 +25,6 @@ import {
DiscoveryService,
PermissionsService,
PermissionsServiceRequestOptions,
TokenManagerService,
} from '@backstage/backend-plugin-api';
import { Config } from '@backstage/config';
import {
@@ -51,7 +53,8 @@ export class ServerPermissionClient implements PermissionsService {
config: Config,
options: {
discovery: DiscoveryService;
tokenManager: TokenManagerService;
/** @deprecated This option will be removed in the future, provide a the auth option instead */
tokenManager?: TokenManager;
auth?: AuthService;
},
) {
@@ -62,6 +65,7 @@ export class ServerPermissionClient implements PermissionsService {
if (
permissionEnabled &&
tokenManager &&
(tokenManager as any).isInsecureServerTokenManager
) {
throw new Error(