Skip to content

Commit

Permalink
fix: Fix disabled AS assertion by looking at configured AS
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jan 10, 2025
1 parent 0a2b27f commit 1e5b251
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/issuer-rest/lib/OID4VCIServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,16 @@ export class OID4VCIServer<DIDDoc extends object> {
private assertAccessTokenHandling(tokenEndpointOpts?: ITokenEndpointOpts) {
const authServer = this.issuer.issuerMetadata.authorization_servers
if (this.isTokenEndpointDisabled(tokenEndpointOpts)) {
if (!authServer) {
if (!authServer || authServer.length === 0) {
throw Error(
`No Authorization Server (AS) is defined in the issuer metadata and the token endpoint is disabled. An AS or token endpoints needs to be present`,
)
}
console.log('Token endpoint disabled by configuration')
} else {
if (authServer) {
if (authServer && authServer.some(as => as !== this.issuer.issuerMetadata.credential_issuer)) {
throw Error(
`A Authorization Server (AS) was already enabled in the issuer metadata (${authServer}). Cannot both have an AS and enable the token endpoint at the same time `,
`An external Authorization Server (AS) was already enabled in the issuer metadata (${authServer}). Cannot both have an AS and enable the token endpoint at the same time `,
)
}
}
Expand Down

0 comments on commit 1e5b251

Please sign in to comment.