@@ -5,7 +5,6 @@ import { createServer } from './helpers/createServer.js';
55import { ServerLifecycle } from './helpers/serverLifecycle.js' ;
66
77export class AuthBasicMetadataVar1Scenario implements Scenario {
8- // TODO: name should match what we put in the scenario map
98 name = 'auth/basic-metadata-var1' ;
109 description =
1110 'Tests Basic OAuth flow with DCR, PRM at root location, OAuth metadata at OpenID discovery path, and no scopes required' ;
@@ -151,3 +150,65 @@ export class AuthBasicMetadataVar2Scenario implements Scenario {
151150 return this . checks ;
152151 }
153152}
153+
154+ export class AuthBasicMetadataVar3Scenario implements Scenario {
155+ name = 'auth/basic-metadata-var3' ;
156+ description =
157+ 'Tests Basic OAuth flow with DCR, PRM at custom location listed in WWW-Authenticate header, OAuth metadata is at nested OpenID discovery path, and no scopes required' ;
158+ private authServer = new ServerLifecycle ( ) ;
159+ private server = new ServerLifecycle ( ) ;
160+ private checks : ConformanceCheck [ ] = [ ] ;
161+
162+ async start ( ) : Promise < ScenarioUrls > {
163+ this . checks = [ ] ;
164+
165+ const authApp = createAuthServer ( this . checks , this . authServer . getUrl , {
166+ metadataPath : '/tenant1/.well-known/openid-configuration' ,
167+ isOpenIdConfiguration : true ,
168+ routePrefix : '/tenant1'
169+ } ) ;
170+ await this . authServer . start ( authApp ) ;
171+
172+ const app = createServer (
173+ this . checks ,
174+ this . server . getUrl ,
175+ this . authServer . getUrl ,
176+ {
177+ // This is a custom path, so unable to get via probing, it's only available
178+ // via following the `resource_metadata_url` in the WWW-Authenticate header.
179+ prmPath : '/.well-known/oauth-protected-resource'
180+ }
181+ ) ;
182+ await this . server . start ( app ) ;
183+
184+ return { serverUrl : `${ this . server . getUrl ( ) } /mcp` } ;
185+ }
186+
187+ async stop ( ) {
188+ await this . authServer . stop ( ) ;
189+ await this . server . stop ( ) ;
190+ }
191+
192+ getChecks ( ) : ConformanceCheck [ ] {
193+ const expectedSlugs = [
194+ 'authorization-server-metadata' ,
195+ 'client-registration' ,
196+ 'authorization-request' ,
197+ 'token-request'
198+ ] ;
199+
200+ for ( const slug of expectedSlugs ) {
201+ if ( ! this . checks . find ( ( c ) => c . id === slug ) ) {
202+ this . checks . push ( {
203+ id : slug ,
204+ name : `Expected Check Missing: ${ slug } ` ,
205+ description : `Expected Check Missing: ${ slug } ` ,
206+ status : 'FAILURE' ,
207+ timestamp : new Date ( ) . toISOString ( )
208+ } ) ;
209+ }
210+ }
211+
212+ return this . checks ;
213+ }
214+ }
0 commit comments