File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ export class ValidationServer {
2323 port : config . port || 0 , // 0 means random port
2424 authRequired : config . authRequired || false ,
2525 metadataLocation : config . metadataLocation || '/.well-known/oauth-protected-resource' ,
26- authServerMetadataLocation : config . authServerMetadataLocation || '/.well-known/oauth-authorization-server'
26+ authServerMetadataLocation : config . authServerMetadataLocation || '/.well-known/oauth-authorization-server' ,
27+ includeWwwAuthenticate : config . includeWwwAuthenticate !== false // Default true
2728 } ;
2829
2930 // Start auth server if auth is required
@@ -121,7 +122,9 @@ export class ValidationServer {
121122 // We'll set the full URL dynamically in the middleware
122123 bearerMiddleware = async ( req : Request , res : Response , next : any ) => {
123124 const serverPort = this . getPort ( ) ;
124- const resourceMetadataUrl = `http://localhost:${ serverPort } ${ this . config . metadataLocation } ` ;
125+ const resourceMetadataUrl = this . config . includeWwwAuthenticate
126+ ? `http://localhost:${ serverPort } ${ this . config . metadataLocation } `
127+ : undefined ;
125128 const middleware = requireBearerAuth ( {
126129 verifier : tokenVerifier ,
127130 requiredScopes : [ ] ,
Original file line number Diff line number Diff line change @@ -45,4 +45,5 @@ export interface ValidationServerConfig {
4545 authRequired ?: boolean ;
4646 metadataLocation ?: string ; // Location for protected resource metadata
4747 authServerMetadataLocation ?: string ; // Location for auth server metadata (passed to mock auth server)
48+ includeWwwAuthenticate ?: boolean ; // Whether to include resource_metadata in WWW-Authenticate header
4849}
You can’t perform that action at this time.
0 commit comments