Remove backend-common from permission-node
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
@@ -56,7 +56,6 @@
|
||||
"test": "backstage-cli package test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^0.25.0",
|
||||
"@backstage/backend-plugin-api": "workspace:^",
|
||||
"@backstage/config": "workspace:^",
|
||||
"@backstage/errors": "workspace:^",
|
||||
|
||||
@@ -29,7 +29,6 @@ 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 { TokenManager } from '@backstage/backend-common';
|
||||
import { z } from 'zod';
|
||||
|
||||
// @public
|
||||
@@ -385,8 +384,7 @@ export class ServerPermissionClient implements PermissionsService {
|
||||
config: Config,
|
||||
options: {
|
||||
discovery: DiscoveryService;
|
||||
tokenManager?: TokenManager;
|
||||
auth?: AuthService;
|
||||
auth: AuthService;
|
||||
},
|
||||
): ServerPermissionClient;
|
||||
}
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
TokenManager,
|
||||
createLegacyAuthAdapters,
|
||||
} from '@backstage/backend-common';
|
||||
import {
|
||||
AuthService,
|
||||
BackstageCredentials,
|
||||
@@ -53,28 +49,14 @@ export class ServerPermissionClient implements PermissionsService {
|
||||
config: Config,
|
||||
options: {
|
||||
discovery: DiscoveryService;
|
||||
/** @deprecated This option will be removed in the future, provide a the auth option instead */
|
||||
tokenManager?: TokenManager;
|
||||
auth?: AuthService;
|
||||
auth: AuthService;
|
||||
},
|
||||
) {
|
||||
const { discovery, tokenManager } = options;
|
||||
const { auth, discovery } = options;
|
||||
const permissionClient = new PermissionClient({ discovery, config });
|
||||
const permissionEnabled =
|
||||
config.getOptionalBoolean('permission.enabled') ?? false;
|
||||
|
||||
if (
|
||||
permissionEnabled &&
|
||||
tokenManager &&
|
||||
(tokenManager as any).isInsecureServerTokenManager
|
||||
) {
|
||||
throw new Error(
|
||||
'Service-to-service authentication must be configured before enabling permissions. Read more here https://backstage.io/docs/auth/service-to-service-auth',
|
||||
);
|
||||
}
|
||||
|
||||
const { auth } = createLegacyAuthAdapters(options);
|
||||
|
||||
return new ServerPermissionClient({
|
||||
auth,
|
||||
permissionClient,
|
||||
|
||||
Reference in New Issue
Block a user