@@ -316,7 +316,7 @@ describe('SamlController', () => {
316316
317317 expect ( mockRes . status ) . toHaveBeenCalledWith ( 400 ) ;
318318 expect ( mockRes . json ) . toHaveBeenCalledWith ( {
319- error : ' SSO is not enabled for this workspace' ,
319+ error : ` SSO is not enabled for workspace: ${ testWorkspaceId } ` ,
320320 } ) ;
321321 expect ( mockRes . redirect ) . not . toHaveBeenCalled ( ) ;
322322 } ) ;
@@ -336,7 +336,7 @@ describe('SamlController', () => {
336336
337337 expect ( mockRes . status ) . toHaveBeenCalledWith ( 400 ) ;
338338 expect ( mockRes . json ) . toHaveBeenCalledWith ( {
339- error : ' SSO is not enabled for this workspace' ,
339+ error : ` SSO is not enabled for workspace: ${ testWorkspaceId } ` ,
340340 } ) ;
341341 } ) ;
342342 } ) ;
@@ -443,7 +443,7 @@ describe('SamlController', () => {
443443
444444 expect ( mockRes . status ) . toHaveBeenCalledWith ( 400 ) ;
445445 expect ( mockRes . json ) . toHaveBeenCalledWith ( {
446- error : ' SSO is not enabled for this workspace' ,
446+ error : ` SSO is not enabled for workspace: ${ testWorkspaceId } ` ,
447447 } ) ;
448448 } ) ;
449449
@@ -455,22 +455,21 @@ describe('SamlController', () => {
455455
456456 expect ( mockRes . status ) . toHaveBeenCalledWith ( 400 ) ;
457457 expect ( mockRes . json ) . toHaveBeenCalledWith ( {
458- error : ' SSO is not enabled for this workspace' ,
458+ error : ` SSO is not enabled for workspace: ${ testWorkspaceId } ` ,
459459 } ) ;
460460 } ) ;
461461
462462 it ( 'should return 400 error when SAML validation fails' , async ( ) => {
463463 const workspace = createMockWorkspace ( ) ;
464464 mockWorkspacesFactory . findById . mockResolvedValue ( workspace ) ;
465- mockSamlService . validateAndParseResponse . mockRejectedValue (
466- new Error ( 'Invalid signature' )
467- ) ;
465+ const validationError = new Error ( 'Invalid signature' ) ;
466+ mockSamlService . validateAndParseResponse . mockRejectedValue ( validationError ) ;
468467
469468 await controller . handleAcs ( mockReq as Request , mockRes as Response ) ;
470469
471470 expect ( mockRes . status ) . toHaveBeenCalledWith ( 400 ) ;
472471 expect ( mockRes . json ) . toHaveBeenCalledWith ( {
473- error : ' Invalid SAML response' ,
472+ error : ` Invalid SAML response for workspace ${ testWorkspaceId } : ${ validationError . message } ` ,
474473 } ) ;
475474 expect ( mockRes . redirect ) . not . toHaveBeenCalled ( ) ;
476475 } ) ;
@@ -487,8 +486,9 @@ describe('SamlController', () => {
487486 await controller . handleAcs ( mockReq as Request , mockRes as Response ) ;
488487
489488 expect ( mockRes . status ) . toHaveBeenCalledWith ( 400 ) ;
489+ const requestIdShort = testRequestId . slice ( 0 , 8 ) ;
490490 expect ( mockRes . json ) . toHaveBeenCalledWith ( {
491- error : ' Invalid SAML response: InResponseTo validation failed' ,
491+ error : ` Invalid SAML response: InResponseTo validation failed for workspace ${ testWorkspaceId } , request ID: ${ requestIdShort } ` ,
492492 } ) ;
493493 } ) ;
494494
0 commit comments