Merge pull request #23075 from backstage/rugvip/pr/910e28

auth-backend-module-oauth2-proxy-provider: internal refactor to avoid deprecated method
This commit is contained in:
Patrik Oldsberg
2024-02-23 14:46:25 +01:00
committed by GitHub
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 = {