Skip to content

Commit 4a29af4

Browse files
committed
Update oidc-spa so that DPoP work when the TLS terminaison is done upstream
1 parent 52577b2 commit 4a29af4

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@hono/node-server": "^1.11.1",
2525
"@hono/zod-openapi": "^0.13.0",
2626
"hono": "^4.11.1",
27-
"oidc-spa": "^8.7.3",
27+
"oidc-spa": "^8.7.4",
2828
"tsafe": "^1.8.12",
2929
"url-join": "^5.0.0",
3030
"zod": "^3.23.8"

src/auth.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,23 @@ export async function getUser(
2525
requiredRole?: "realm-admin" | "support-staff"
2626
): Promise<User> {
2727

28-
const { isSuccess, debugErrorMessage, decodedAccessToken } =
28+
const { isSuccess, errorCause, debugErrorMessage, decodedAccessToken } =
2929
await validateAndDecodeAccessToken({
3030
request: {
3131
url: req.url,
3232
method: req.method,
33-
headers: {
34-
Authorization: req.header("Authorization"),
35-
DPoP: req.header("DPoP")
36-
}
33+
getHeaderValue: headerName => req.header(headerName)
3734
}
3835
});
3936

4037
if (!isSuccess) {
41-
console.warn(debugErrorMessage);
38+
39+
if( errorCause === "missing Authorization header" ){
40+
console.warn("Anonymous request");
41+
}else{
42+
console.warn(debugErrorMessage);
43+
}
44+
4245
throw new HTTPException(401);
4346
}
4447

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ minimist@^1.2.6:
245245
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
246246
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
247247

248-
oidc-spa@^8.7.3:
249-
version "8.7.3"
250-
resolved "https://registry.yarnpkg.com/oidc-spa/-/oidc-spa-8.7.3.tgz#86b2df5ab1faf2d5485891f1e371f359107ece2c"
251-
integrity sha512-q1UOUhk6Ad7IJG2XUibJYyBLFKn+FtU4O5Uu5++UCjUFgvzxN46KWOrC0LUrZrQe3lQdvsjZhR5BrPi1eex8RQ==
248+
oidc-spa@^8.7.4:
249+
version "8.7.4"
250+
resolved "https://registry.yarnpkg.com/oidc-spa/-/oidc-spa-8.7.4.tgz#db85f06f296eb110f1b800b6cf9245f2264f4707"
251+
integrity sha512-+GKiMdFpeNryNymO71MJdQQq0xiwygmPjNpVojctCBamDYOoZL79Lfr239PwOf52/3g11IE3d5GMCuLPy8IAJQ==
252252

253253
openapi3-ts@^4.1.2:
254254
version "4.3.1"

0 commit comments

Comments
 (0)