Skip to content

Commit

Permalink
Allow aud of pds or entryway for service auth tokens on pds (bluesky-…
Browse files Browse the repository at this point in the history
…social#2694)

allow aud of pds or entryway for service auth tokens on pds
  • Loading branch information
dholms authored Aug 7, 2024
1 parent 1072ba6 commit 8092715
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 8092715

Please sign in to comment.