Interface IAuthorizationMode
Interface to specify default or additional authorization(s).
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IAuthorizationMode
Syntax (vb)
Public Interface IAuthorizationMode
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.AppSync;
var api = new GraphqlApi(this, "api", new GraphqlApiProps {
Name = "api",
Definition = Definition.FromFile("schema.graphql"),
AuthorizationConfig = new AuthorizationConfig {
DefaultAuthorization = new AuthorizationMode { AuthorizationType = AuthorizationType.IAM }
}
});
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Hours(1))
});
rule.AddTarget(new AppSync(api, new AppSyncGraphQLApiProps {
GraphQLOperation = "mutation Publish($message: String!){ publish(message: $message) { message } }",
Variables = RuleTargetInput.FromObject(new Dictionary<string, string> {
{ "message", "hello world" }
})
}));
Synopsis
Properties
| ApiKeyConfig | If authorizationType is |
| AuthorizationType | One of possible four values AppSync supports. |
| LambdaAuthorizerConfig | If authorizationType is |
| OpenIdConnectConfig | If authorizationType is |
| UserPoolConfig | If authorizationType is |
Properties
ApiKeyConfig
If authorizationType is AuthorizationType.API_KEY, this option can be configured.
IApiKeyConfig? ApiKeyConfig { get; }
Property Value
Remarks
Default: - name: 'DefaultAPIKey' | description: 'Default API Key created by CDK'
AuthorizationType
One of possible four values AppSync supports.
AuthorizationType AuthorizationType { get; }
Property Value
Remarks
Default: - AuthorizationType.API_KEY
See: https://docs.aws.amazon.com/appsync/latest/devguide/security.html
LambdaAuthorizerConfig
If authorizationType is AuthorizationType.LAMBDA, this option is required.
ILambdaAuthorizerConfig? LambdaAuthorizerConfig { get; }
Property Value
Remarks
Default: - none
OpenIdConnectConfig
If authorizationType is AuthorizationType.OIDC, this option is required.
IOpenIdConnectConfig? OpenIdConnectConfig { get; }
Property Value
Remarks
Default: - none
UserPoolConfig
If authorizationType is AuthorizationType.USER_POOL, this option is required.
IUserPoolConfig? UserPoolConfig { get; }
Property Value
Remarks
Default: - none