@@ -88,7 +88,7 @@ export class Api {
8888 merge ( endpointResource . Properties , {
8989 AdditionalAuthenticationProviders :
9090 this . config . additionalAuthentications ?. map ( ( provider ) =>
91- this . compileAuthenticationProvider ( provider ) ,
91+ this . compileAuthenticationProvider ( provider , true ) ,
9292 ) ,
9393 } ) ;
9494 }
@@ -411,14 +411,18 @@ export class Api {
411411 } ;
412412 }
413413
414- getUserPoolConfig ( auth : CognitoAuth ) {
414+ getUserPoolConfig ( auth : CognitoAuth , isAdditionalAuth = false ) {
415415 const userPoolConfig = {
416416 AwsRegion : auth . config . awsRegion || { 'Fn::Sub' : '${AWS::Region}' } ,
417417 UserPoolId : auth . config . userPoolId ,
418418 AppIdClientRegex : auth . config . appIdClientRegex ,
419- // Default action is the one passed in the config
420- // or 'ALLOW'
421- DefaultAction : auth . config . defaultAction || 'ALLOW' ,
419+ ...( ! isAdditionalAuth
420+ ? {
421+ // Default action is the one passed in the config
422+ // or 'ALLOW'
423+ DefaultAction : auth . config . defaultAction || 'ALLOW' ,
424+ }
425+ : { } ) ,
422426 } ;
423427
424428 return userPoolConfig ;
@@ -468,14 +472,16 @@ export class Api {
468472 } ) ) ;
469473 }
470474
471- compileAuthenticationProvider ( provider : Auth ) {
475+ compileAuthenticationProvider ( provider : Auth , isAdditionalAuth = false ) {
472476 const { type } = provider ;
473477 const authPrivider = {
474478 AuthenticationType : type ,
475479 } ;
476480
477481 if ( type === 'AMAZON_COGNITO_USER_POOLS' ) {
478- merge ( authPrivider , { UserPoolConfig : this . getUserPoolConfig ( provider ) } ) ;
482+ merge ( authPrivider , {
483+ UserPoolConfig : this . getUserPoolConfig ( provider , isAdditionalAuth ) ,
484+ } ) ;
479485 } else if ( type === 'OPENID_CONNECT' ) {
480486 merge ( authPrivider , {
481487 OpenIDConnectConfig : this . getOpenIDConnectConfig ( provider ) ,
0 commit comments