AppSyncAuthProvider

class aws_cdk.aws_appsync.AppSyncAuthProvider(*, authorization_type, api_key_config=None, cognito_config=None, lambda_authorizer_config=None, open_id_connect_config=None)

Bases: object

Auth provider settings for AppSync Event APIs.

Parameters:
  • authorization_type (AppSyncAuthorizationType) – One of possible authorization types AppSync supports. Default: - AuthorizationType.API_KEY

  • api_key_config (Union[AppSyncApiKeyConfig, Dict[str, Any], None]) – If authorizationType is AuthorizationType.API_KEY, this option can be configured. Default: - name: ‘DefaultAPIKey’

  • cognito_config (Union[AppSyncCognitoConfig, Dict[str, Any], None]) – If authorizationType is AuthorizationType.USER_POOL, this option is required. Default: - none

  • lambda_authorizer_config (Union[AppSyncLambdaAuthorizerConfig, Dict[str, Any], None]) – If authorizationType is AuthorizationType.LAMBDA, this option is required. Default: - none

  • open_id_connect_config (Union[AppSyncOpenIdConnectConfig, Dict[str, Any], None]) – If authorizationType is AuthorizationType.OIDC, this option is required. Default: - none

See:

https://docs.aws.amazon.com/appsync/latest/eventapi/configure-event-api-auth.html

ExampleMetadata:

infused

Example:

import aws_cdk.aws_logs as logs


api_key_provider = appsync.AppSyncAuthProvider(
    authorization_type=appsync.AppSyncAuthorizationType.API_KEY
)

api = appsync.EventApi(self, "api",
    api_name="Api",
    owner_contact="OwnerContact",
    authorization_config=appsync.EventApiAuthConfig(
        auth_providers=[api_key_provider
        ],
        connection_auth_mode_types=[appsync.AppSyncAuthorizationType.API_KEY
        ],
        default_publish_auth_mode_types=[appsync.AppSyncAuthorizationType.API_KEY
        ],
        default_subscribe_auth_mode_types=[appsync.AppSyncAuthorizationType.API_KEY
        ]
    ),
    log_config=appsync.AppSyncLogConfig(
        field_log_level=appsync.AppSyncFieldLogLevel.INFO,
        retention=logs.RetentionDays.ONE_WEEK
    )
)

api.add_channel_namespace("default")

Attributes

api_key_config

If authorizationType is AuthorizationType.API_KEY, this option can be configured.

Default:
  • name: ‘DefaultAPIKey’

authorization_type

One of possible authorization types AppSync supports.

Default:
  • AuthorizationType.API_KEY

cognito_config

If authorizationType is AuthorizationType.USER_POOL, this option is required.

Default:
  • none

lambda_authorizer_config

If authorizationType is AuthorizationType.LAMBDA, this option is required.

Default:
  • none

open_id_connect_config

If authorizationType is AuthorizationType.OIDC, this option is required.

Default:
  • none