addressing some code review comments

Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
Brian Fletcher
2022-08-15 14:34:26 +01:00
parent 7ab1fc429a
commit 518e5ddcd1
8 changed files with 52 additions and 16 deletions
@@ -27,7 +27,6 @@ import { GetKeyFunction } from 'jose/dist/types/types';
import { BackstageIdentityResponse } from './types';
import { getBearerTokenFromAuthorizationHeader, IdentityApi } from '.';
import { Request } from 'express';
const CLOCK_MARGIN_S = 10;
@@ -78,7 +77,7 @@ export class DefaultIdentityClient implements IdentityApi {
async getIdentity(req: Request) {
try {
return await this.authenticate(
getBearerTokenFromAuthorizationHeader(req.headers.authorization),
getBearerTokenFromAuthorizationHeader(req.headers.get('authorization')),
);
} catch (e) {
return undefined;
+1 -4
View File
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Request } from 'express';
import { BackstageIdentityResponse } from './types';
/**
@@ -29,7 +28,5 @@ export interface IdentityApi {
* Returns a BackstageIdentity (user) matching the token.
* The method throws an error if verification fails.
*/
getIdentity(
req: Request<any>,
): Promise<BackstageIdentityResponse | undefined>;
getIdentity(req: Request): Promise<BackstageIdentityResponse | undefined>;
}