addressing some code review comments
Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user