@@ -31,8 +31,9 @@ export class MockAuthServer implements HttpTraceCollector {
3131 public httpTrace : HttpTrace [ ] = [ ] ;
3232 private verbose : boolean ;
3333 public issuerPath : string ;
34- public resourceParameterReceived : boolean = false ;
35- public resourceParameterValue : string | null = null ;
34+ public authResourceParameter : string | null = null ;
35+ public tokenResourceParameter : string | null = null ;
36+
3637
3738 // Store authorization requests for PKCE validation
3839 private authorizationRequests : Map < string , AuthorizationRequest > = new Map ( ) ;
@@ -43,16 +44,16 @@ export class MockAuthServer implements HttpTraceCollector {
4344 this . app = express ( ) ;
4445 this . app . use ( express . json ( ) ) ;
4546 this . app . use ( express . urlencoded ( { extended : true } ) ) ;
46-
47+
4748 // Extract issuer path from metadata location
4849 // For /.well-known/oauth-authorization-server/tenant1 -> /tenant1
4950 // For /.well-known/openid-configuration -> ''
5051 // For /tenant1/.well-known/openid-configuration -> /tenant1
5152 this . issuerPath = this . extractIssuerPath ( metadataLocation ) ;
52-
53+
5354 this . setupRoutes ( ) ;
5455 }
55-
56+
5657 private extractIssuerPath ( metadataLocation : string ) : string {
5758 // Handle different metadata location patterns
5859 if ( metadataLocation . includes ( '/.well-known/oauth-authorization-server/' ) ) {
@@ -87,7 +88,7 @@ export class MockAuthServer implements HttpTraceCollector {
8788 this . app . get ( this . metadataLocation , ( req : Request , res : Response ) => {
8889 const baseUrl = this . getUrl ( ) ;
8990 const issuer = baseUrl + this . issuerPath ;
90-
91+
9192 // Base metadata for both OAuth 2.0 and OIDC
9293 const metadata : any = {
9394 issuer : issuer ,
@@ -99,7 +100,7 @@ export class MockAuthServer implements HttpTraceCollector {
99100 code_challenge_methods_supported : [ 'S256' ] ,
100101 token_endpoint_auth_methods_supported : [ 'none' , 'client_secret_post' ]
101102 } ;
102-
103+
103104 // Add OIDC-specific fields if this is an OpenID Connect metadata endpoint
104105 if ( this . metadataLocation . includes ( 'openid-configuration' ) ) {
105106 metadata . jwks_uri = `${ baseUrl } /jwks` ;
@@ -109,7 +110,7 @@ export class MockAuthServer implements HttpTraceCollector {
109110 metadata . scopes_supported = [ 'openid' , 'profile' , 'email' ] ;
110111 metadata . claims_supported = [ 'sub' , 'name' , 'email' , 'email_verified' ] ;
111112 }
112-
113+
113114 res . json ( metadata ) ;
114115 } ) ;
115116
@@ -127,9 +128,7 @@ export class MockAuthServer implements HttpTraceCollector {
127128
128129 // Track resource parameter
129130 if ( resource ) {
130- this . resourceParameterReceived = true ;
131- this . resourceParameterValue = resource ;
132- this . log ( 'Received resource parameter:' , resource ) ;
131+ this . authResourceParameter = resource ;
133132 }
134133
135134 // Basic validation
@@ -178,15 +177,10 @@ export class MockAuthServer implements HttpTraceCollector {
178177 refresh_token,
179178 resource
180179 } = req . body ;
181-
180+
182181 // Track resource parameter in token request
183182 if ( resource ) {
184- this . resourceParameterReceived = true ;
185- // Update value if not already set or if different
186- if ( ! this . resourceParameterValue ) {
187- this . resourceParameterValue = resource ;
188- }
189- this . log ( 'Received resource parameter in token request:' , resource ) ;
183+ this . tokenResourceParameter = resource ;
190184 }
191185
192186 if ( grant_type === 'authorization_code' ) {
0 commit comments