Merge pull request #4224 from backjo/patch/fixAlbResponseType

fix: use .text instead of .json for ALB key http call
This commit is contained in:
Patrik Oldsberg
2021-01-23 22:00:06 +01:00
committed by GitHub
3 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': patch
---
Use .text instead of .json for ALB key response
@@ -36,7 +36,7 @@ jest.mock('cross-fetch', () => ({
__esModule: true,
default: async () => {
return {
json: async () => {
text: async () => {
return mockKey();
},
};
@@ -102,7 +102,7 @@ export class AwsAlbAuthProvider implements AuthProviderRouteHandlers {
}
const keyText: string = await fetch(
`https://public-keys.auth.elb.${this.options.region}.amazonaws.com/${keyId}`,
).then(response => response.json());
).then(response => response.text());
const keyValue = crypto.createPublicKey(keyText);
this.keyCache.set(keyId, keyValue);
return keyValue;