auth-backend-module-oauth2-proxy-provider: internal refactor to avoid deprecated method

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-02-15 18:45:41 +01:00
parent 72572b2fe1
commit e77d7a90c6
2 changed files with 7 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend-module-oauth2-proxy-provider': patch
---
Internal refactor to avoid deprecated method.
@@ -15,10 +15,7 @@
*/
import { AuthenticationError } from '@backstage/errors';
import {
createProxyAuthenticator,
getBearerTokenFromAuthorizationHeader,
} from '@backstage/plugin-auth-node';
import { createProxyAuthenticator } from '@backstage/plugin-auth-node';
import { decodeJwt } from 'jose';
import { OAuth2ProxyResult } from './types';
@@ -46,7 +43,7 @@ export const oauth2ProxyAuthenticator = createProxyAuthenticator({
async authenticate({ req }) {
try {
const authHeader = req.header(OAUTH2_PROXY_JWT_HEADER);
const jwt = getBearerTokenFromAuthorizationHeader(authHeader);
const jwt = authHeader?.match(/^Bearer[ ]+(\S+)$/i)?.[1];
const decodedJWT = jwt && decodeJwt(jwt);
const result = {