MutualAuthenticationMode Enum
The client certificate handling method.
| Source | aws-elasticloadbalancingv2/lib/alb/application-listener.ts |
|---|---|
| Type last changed |
Example
ts
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
declare const certificate: acm.Certificate;
declare const lb: elbv2.ApplicationLoadBalancer;
declare const bucket: s3.Bucket;
const trustStore = new elbv2.TrustStore(this, 'Store', {
bucket,
key: 'rootCA_cert.pem',
});
lb.addListener('Listener', {
port: 443,
protocol: elbv2.ApplicationProtocol.HTTPS,
certificates: [certificate],
// mTLS settings
mutualAuthentication: {
advertiseTrustStoreCaNames: true,
ignoreClientCertificateExpiry: false,
mutualAuthenticationMode: elbv2.MutualAuthenticationMode.VERIFY,
trustStore,
},
defaultAction: elbv2.ListenerAction.fixedResponse(200,
{ contentType: 'text/plain', messageBody: 'Success mTLS' }),
});
python
import aws_cdk.aws_certificatemanager as acm
# certificate: acm.Certificate
# lb: elbv2.ApplicationLoadBalancer
# bucket: s3.Bucket
trust_store = elbv2.TrustStore(self, "Store",
bucket=bucket,
key="rootCA_cert.pem"
)
lb.add_listener("Listener",
port=443,
protocol=elbv2.ApplicationProtocol.HTTPS,
certificates=[certificate],
# mTLS settings
mutual_authentication=elbv2.MutualAuthentication(
advertise_trust_store_ca_names=True,
ignore_client_certificate_expiry=False,
mutual_authentication_mode=elbv2.MutualAuthenticationMode.VERIFY,
trust_store=trust_store
),
default_action=elbv2.ListenerAction.fixed_response(200, content_type="text/plain", message_body="Success mTLS")
)
java
import software.amazon.awscdk.services.certificatemanager.*;
Certificate certificate;
ApplicationLoadBalancer lb;
Bucket bucket;
TrustStore trustStore = TrustStore.Builder.create(this, "Store")
.bucket(bucket)
.key("rootCA_cert.pem")
.build();
lb.addListener("Listener", BaseApplicationListenerProps.builder()
.port(443)
.protocol(ApplicationProtocol.HTTPS)
.certificates(List.of(certificate))
// mTLS settings
.mutualAuthentication(MutualAuthentication.builder()
.advertiseTrustStoreCaNames(true)
.ignoreClientCertificateExpiry(false)
.mutualAuthenticationMode(MutualAuthenticationMode.VERIFY)
.trustStore(trustStore)
.build())
.defaultAction(ListenerAction.fixedResponse(200, FixedResponseOptions.builder().contentType("text/plain").messageBody("Success mTLS").build()))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.CertificateManager;
Certificate certificate;
ApplicationLoadBalancer lb;
Bucket bucket;
var trustStore = new TrustStore(this, "Store", new TrustStoreProps {
Bucket = bucket,
Key = "rootCA_cert.pem"
});
lb.AddListener("Listener", new BaseApplicationListenerProps {
Port = 443,
Protocol = ApplicationProtocol.HTTPS,
Certificates = new [] { certificate },
// mTLS settings
MutualAuthentication = new MutualAuthentication {
AdvertiseTrustStoreCaNames = true,
IgnoreClientCertificateExpiry = false,
MutualAuthenticationMode = MutualAuthenticationMode.VERIFY,
TrustStore = trustStore
},
DefaultAction = ListenerAction.FixedResponse(200, new FixedResponseOptions { ContentType = "text/plain", MessageBody = "Success mTLS" })
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import acm "github.com/aws/aws-cdk-go/awscdk"
var certificate Certificate
var lb ApplicationLoadBalancer
var bucket Bucket
trustStore := elbv2.NewTrustStore(this, jsii.String("Store"), &TrustStoreProps{
Bucket: Bucket,
Key: jsii.String("rootCA_cert.pem"),
})
lb.AddListener(jsii.String("Listener"), &BaseApplicationListenerProps{
Port: jsii.Number(443),
Protocol: elbv2.ApplicationProtocol_HTTPS,
Certificates: []IListenerCertificate{
certificate,
},
// mTLS settings
MutualAuthentication: &MutualAuthentication{
AdvertiseTrustStoreCaNames: jsii.Boolean(true),
IgnoreClientCertificateExpiry: jsii.Boolean(false),
MutualAuthenticationMode: elbv2.MutualAuthenticationMode_VERIFY,
TrustStore: *TrustStore,
},
DefaultAction: elbv2.ListenerAction_FixedResponse(jsii.Number(200), &FixedResponseOptions{
ContentType: jsii.String("text/plain"),
MessageBody: jsii.String("Success mTLS"),
}),
})
Members
| Member | Description |
|---|---|
OFF | Off. |
PASS_THROUGH | Application Load Balancer sends the whole client certificate chain to the target using HTTP headers. |
VERIFY | Application Load Balancer performs X.509 client certificate authentication for clients when a load balancer negotiates TLS connections. |
Referenced by
MutualAuthentication.mutualAuthenticationModemutual_authentication_modemutualAuthenticationModeMutualAuthenticationModeMutualAuthenticationMode