|
| 1 | +Resources: |
| 2 | + MyApiWithCognitoAuth: |
| 3 | + Type: AWS::Serverless::Api |
| 4 | + Properties: |
| 5 | + StageName: Prod |
| 6 | + Auth: |
| 7 | + DefaultAuthorizer: !Ref AWS::NoValue |
| 8 | + Authorizers: |
| 9 | + MyCognitoAuth: |
| 10 | + UserPoolArn: !GetAtt MyUserPool.Arn |
| 11 | + |
| 12 | + MyApiWithLambdaTokenAuth: |
| 13 | + Type: AWS::Serverless::Api |
| 14 | + Properties: |
| 15 | + StageName: Prod |
| 16 | + Auth: |
| 17 | + DefaultAuthorizer: !Ref AWS::NoValue |
| 18 | + Authorizers: |
| 19 | + MyLambdaTokenAuth: |
| 20 | + FunctionArn: !GetAtt MyAuthFn.Arn |
| 21 | + |
| 22 | + MyApiWithLambdaRequestAuth: |
| 23 | + Type: AWS::Serverless::Api |
| 24 | + Properties: |
| 25 | + StageName: Prod |
| 26 | + Auth: |
| 27 | + DefaultAuthorizer: !Ref AWS::NoValue |
| 28 | + Authorizers: |
| 29 | + MyLambdaRequestAuth: |
| 30 | + FunctionPayloadType: REQUEST |
| 31 | + FunctionArn: !GetAtt MyAuthFn.Arn |
| 32 | + Identity: |
| 33 | + Headers: |
| 34 | + - Authorization1 |
| 35 | + MyAuthFn: |
| 36 | + Type: AWS::Serverless::Function |
| 37 | + Properties: |
| 38 | + CodeUri: s3://bucket/key |
| 39 | + Handler: index.handler |
| 40 | + Runtime: nodejs12.x |
| 41 | + MyFn: |
| 42 | + Type: AWS::Serverless::Function |
| 43 | + Properties: |
| 44 | + CodeUri: s3://bucket/key |
| 45 | + Handler: index.handler |
| 46 | + Runtime: nodejs12.x |
| 47 | + Events: |
| 48 | + CognitoNoAuth: |
| 49 | + Type: Api |
| 50 | + Properties: |
| 51 | + RestApiId: !Ref MyApiWithCognitoAuth |
| 52 | + Method: get |
| 53 | + Path: /cognito/no-auth |
| 54 | + CognitoNoAuthAnyMethod: |
| 55 | + Type: Api |
| 56 | + Properties: |
| 57 | + RestApiId: !Ref MyApiWithCognitoAuth |
| 58 | + Method: any |
| 59 | + Path: /cognito/any/no-auth |
| 60 | + Cognito: |
| 61 | + Type: Api |
| 62 | + Properties: |
| 63 | + RestApiId: !Ref MyApiWithCognitoAuth |
| 64 | + Method: get |
| 65 | + Path: /any/cognito |
| 66 | + Auth: |
| 67 | + Authorizer: MyCognitoAuth |
| 68 | + CognitoAnyMethod: |
| 69 | + Type: Api |
| 70 | + Properties: |
| 71 | + RestApiId: !Ref MyApiWithCognitoAuth |
| 72 | + Method: any |
| 73 | + Path: /any/cognito |
| 74 | + Auth: |
| 75 | + Authorizer: MyCognitoAuth |
| 76 | + LambdaTokenNoAuth: |
| 77 | + Type: Api |
| 78 | + Properties: |
| 79 | + RestApiId: !Ref MyApiWithLambdaTokenAuth |
| 80 | + Method: get |
| 81 | + Path: /lambda-token/no-auth |
| 82 | + LambdaTokenNoAuthAnyMethod: |
| 83 | + Type: Api |
| 84 | + Properties: |
| 85 | + RestApiId: !Ref MyApiWithLambdaTokenAuth |
| 86 | + Method: any |
| 87 | + Path: /lambda-token/any/no-auth |
| 88 | + LambdaToken: |
| 89 | + Type: Api |
| 90 | + Properties: |
| 91 | + RestApiId: !Ref MyApiWithLambdaTokenAuth |
| 92 | + Method: get |
| 93 | + Path: /lambda-token |
| 94 | + Auth: |
| 95 | + Authorizer: MyLambdaTokenAuth |
| 96 | + LambdaTokenAnyMethod: |
| 97 | + Type: Api |
| 98 | + Properties: |
| 99 | + RestApiId: !Ref MyApiWithLambdaTokenAuth |
| 100 | + Method: any |
| 101 | + Path: /any/lambda-token |
| 102 | + Auth: |
| 103 | + Authorizer: MyLambdaTokenAuth |
| 104 | + LambdaRequestNoAuth: |
| 105 | + Type: Api |
| 106 | + Properties: |
| 107 | + RestApiId: !Ref MyApiWithLambdaRequestAuth |
| 108 | + Method: get |
| 109 | + Path: /lambda-request/no-auth |
| 110 | + LambdaRequestNoAuthAnyMethod: |
| 111 | + Type: Api |
| 112 | + Properties: |
| 113 | + RestApiId: !Ref MyApiWithLambdaRequestAuth |
| 114 | + Method: any |
| 115 | + Path: /lambda-request/any/no-auth |
| 116 | + LambdaRequest: |
| 117 | + Type: Api |
| 118 | + Properties: |
| 119 | + RestApiId: !Ref MyApiWithLambdaRequestAuth |
| 120 | + Method: get |
| 121 | + Path: /lambda-request |
| 122 | + Auth: |
| 123 | + Authorizer: MyLambdaRequestAuth |
| 124 | + LambdaRequestAnyMethod: |
| 125 | + Type: Api |
| 126 | + Properties: |
| 127 | + RestApiId: !Ref MyApiWithLambdaRequestAuth |
| 128 | + Method: any |
| 129 | + Path: /any/lambda-request |
| 130 | + Auth: |
| 131 | + Authorizer: MyLambdaRequestAuth |
| 132 | + MyUserPool: |
| 133 | + Type: AWS::Cognito::UserPool |
| 134 | + Properties: |
| 135 | + UserPoolName: UserPoolName |
| 136 | + Policies: |
| 137 | + PasswordPolicy: |
| 138 | + MinimumLength: 8 |
| 139 | + UsernameAttributes: |
| 140 | + - email |
| 141 | + Schema: |
| 142 | + - AttributeDataType: String |
| 143 | + Name: email |
| 144 | + Required: false |
0 commit comments