Remove backend-common from permission-node
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
@@ -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