Skip to content

Commit

Permalink
Allow aud of pds or entryway for service auth tokens on pds (#2694)
Browse files Browse the repository at this point in the history
allow aud of pds or entryway for service auth tokens on pds
  • Loading branch information
dholms authored and haileyok committed Aug 16, 2024
1 parent 89615ae commit dc9a35a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/pds/src/auth-verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,18 @@ export class AuthVerifier {

userServiceAuth = async (ctx: ReqCtx): Promise<UserServiceAuthOutput> => {
const payload = await this.verifyServiceJwt(ctx, {
aud: this.dids.entryway ?? this.dids.pds,
aud: null,
iss: null,
})
if (
payload.aud !== this.dids.pds &&
(!this.dids.entryway || payload.aud !== this.dids.entryway)
) {
throw new AuthRequiredError(
'jwt audience does not match service did',
'BadJwtAudience',
)
}
return {
credentials: {
type: 'user_service_auth',
Expand Down

0 comments on commit dc9a35a

Please sign in to comment.