Class AppSyncAuthProvider
Auth provider settings for AppSync Event APIs.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AppSyncAuthProvider : IAppSyncAuthProvider
Syntax (vb)
Public Class AppSyncAuthProvider Implements IAppSyncAuthProvider
Remarks
See: https://docs.aws.amazon.com/appsync/latest/eventapi/configure-event-api-auth.html
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Logs;
var apiKeyProvider = new AppSyncAuthProvider {
AuthorizationType = AppSyncAuthorizationType.API_KEY
};
var api = new EventApi(this, "api", new EventApiProps {
ApiName = "Api",
OwnerContact = "OwnerContact",
AuthorizationConfig = new EventApiAuthConfig {
AuthProviders = new [] { apiKeyProvider },
ConnectionAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY },
DefaultPublishAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY },
DefaultSubscribeAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY }
},
LogConfig = new AppSyncLogConfig {
FieldLogLevel = AppSyncFieldLogLevel.INFO,
Retention = RetentionDays.ONE_WEEK
}
});
api.AddChannelNamespace("default");
Synopsis
Constructors
| AppSyncAuthProvider() | Auth provider settings for AppSync Event APIs. |
Properties
| ApiKeyConfig | If authorizationType is |
| AuthorizationType | One of possible authorization types AppSync supports. |
| CognitoConfig | If authorizationType is |
| LambdaAuthorizerConfig | If authorizationType is |
| OpenIdConnectConfig | If authorizationType is |
Constructors
AppSyncAuthProvider()
Auth provider settings for AppSync Event APIs.
public AppSyncAuthProvider()
Remarks
See: https://docs.aws.amazon.com/appsync/latest/eventapi/configure-event-api-auth.html
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Logs;
var apiKeyProvider = new AppSyncAuthProvider {
AuthorizationType = AppSyncAuthorizationType.API_KEY
};
var api = new EventApi(this, "api", new EventApiProps {
ApiName = "Api",
OwnerContact = "OwnerContact",
AuthorizationConfig = new EventApiAuthConfig {
AuthProviders = new [] { apiKeyProvider },
ConnectionAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY },
DefaultPublishAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY },
DefaultSubscribeAuthModeTypes = new [] { AppSyncAuthorizationType.API_KEY }
},
LogConfig = new AppSyncLogConfig {
FieldLogLevel = AppSyncFieldLogLevel.INFO,
Retention = RetentionDays.ONE_WEEK
}
});
api.AddChannelNamespace("default");
Properties
ApiKeyConfig
If authorizationType is AuthorizationType.API_KEY, this option can be configured.
public IAppSyncApiKeyConfig? ApiKeyConfig { get; set; }
Property Value
Remarks
Default: - name: 'DefaultAPIKey'
AuthorizationType
One of possible authorization types AppSync supports.
public AppSyncAuthorizationType AuthorizationType { get; set; }
Property Value
Remarks
Default: - AuthorizationType.API_KEY
CognitoConfig
If authorizationType is AuthorizationType.USER_POOL, this option is required.
public IAppSyncCognitoConfig? CognitoConfig { get; set; }
Property Value
Remarks
Default: - none
LambdaAuthorizerConfig
If authorizationType is AuthorizationType.LAMBDA, this option is required.
public IAppSyncLambdaAuthorizerConfig? LambdaAuthorizerConfig { get; set; }
Property Value
IAppSyncLambdaAuthorizerConfig
Remarks
Default: - none
OpenIdConnectConfig
If authorizationType is AuthorizationType.OIDC, this option is required.
public IAppSyncOpenIdConnectConfig? OpenIdConnectConfig { get; set; }
Property Value
Remarks
Default: - none