> **Experimental**
>
> `@aws-cdk/aws-msk-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# SaslAuthProps

SASL authentication properties.

Used as argument in: [ClientAuthentication.sasl](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-msk-alpha.ClientAuthentication.html#sasl)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/cluster.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-msk-alpha/lib/cluster.ts#L386)

## Example

TypeScript:

```ts
declare const vpc: ec2.Vpc;
const cluster = new msk.Cluster(this, 'cluster', {
  clusterName: 'myCluster',
  kafkaVersion: msk.KafkaVersion.V4_1_X_KRAFT,
  vpc,
  encryptionInTransit: {
    clientBroker: msk.ClientBrokerEncryption.TLS,
  },
  clientAuthentication: msk.ClientAuthentication.sasl({
    scram: true,
  }),
});
```

Python:

```python
# vpc: ec2.Vpc

cluster = msk.Cluster(self, "cluster",
    cluster_name="myCluster",
    kafka_version=msk.KafkaVersion.V4_1_X_KRAFT,
    vpc=vpc,
    encryption_in_transit=msk.EncryptionInTransitConfig(
        client_broker=msk.ClientBrokerEncryption.TLS
    ),
    client_authentication=msk.ClientAuthentication.sasl(
        scram=True
    )
)
```

Java:

```java
Vpc vpc;

Cluster cluster = Cluster.Builder.create(this, "cluster")
        .clusterName("myCluster")
        .kafkaVersion(KafkaVersion.V4_1_X_KRAFT)
        .vpc(vpc)
        .encryptionInTransit(EncryptionInTransitConfig.builder()
                .clientBroker(ClientBrokerEncryption.TLS)
                .build())
        .clientAuthentication(ClientAuthentication.sasl(SaslAuthProps.builder()
                .scram(true)
                .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.MSK.Alpha
Vpc vpc;

var cluster = new Cluster(this, "cluster", new ClusterProps {
    ClusterName = "myCluster",
    KafkaVersion = KafkaVersion.V4_1_X_KRAFT,
    Vpc = vpc,
    EncryptionInTransit = new EncryptionInTransitConfig {
        ClientBroker = ClientBrokerEncryption.TLS
    },
    ClientAuthentication = ClientAuthentication.Sasl(new SaslAuthProps {
        Scram = true
    })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkmskalpha/v2
var vpc Vpc

cluster := msk.NewCluster(this, jsii.String("cluster"), &ClusterProps{
	ClusterName: jsii.String("myCluster"),
	KafkaVersion: msk.KafkaVersion_V4_1_X_KRAFT(),
	Vpc: Vpc,
	EncryptionInTransit: &EncryptionInTransitConfig{
		ClientBroker: msk.ClientBrokerEncryption_TLS,
	},
	ClientAuthentication: msk.ClientAuthentication_Sasl(&SaslAuthProps{
		Scram: jsii.Boolean(true),
	}),
})
```

## Properties

- `iam`: boolean = false — Enable IAM access control.

- `key`: [IKeyRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.IKeyRef.html) — KMS Key to encrypt SASL/SCRAM secrets.

  **Default:** CMK will be created with alias msk/{clusterName}/sasl/scram

  You must use a customer master key (CMK) when creating users in secrets manager.
  You cannot use a Secret with Amazon MSK that uses the default Secrets Manager encryption key.

- `scram`: boolean = false — Enable SASL/SCRAM authentication.
