Remove backend-common from permission-node

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2025-03-13 15:04:26 +01:00
parent 226c18d44a
commit 22ace13d10
6 changed files with 17 additions and 28 deletions
@@ -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,