# AdvancedSecurityOptions

Specifies options for fine-grained access control.

- Source: [`aws-opensearchservice/lib/domain.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts#L363)
- Type last changed: v2.92.0 · 15 Aug 2023

## Example

TypeScript:

```ts
const domain = new Domain(this, 'Domain', {
  version: EngineVersion.OPENSEARCH_1_0,
  enforceHttps: true,
  nodeToNodeEncryption: true,
  encryptionAtRest: {
    enabled: true,
  },
  fineGrainedAccessControl: {
    masterUserName: 'master-user',
    samlAuthenticationEnabled: true,
    samlAuthenticationOptions: {
      idpEntityId: 'entity-id',
      idpMetadataContent: 'metadata-content-with-quotes-escaped',
    },
  },
});
```

Python:

```python
from aws_cdk.aws_opensearchservice import EncryptionAtRestOptions, AdvancedSecurityOptions, SAMLOptionsProperty
domain = Domain(self, "Domain",
    version=EngineVersion.OPENSEARCH_1_0,
    enforce_https=True,
    node_to_node_encryption=True,
    encryption_at_rest=EncryptionAtRestOptions(
        enabled=True
    ),
    fine_grained_access_control=AdvancedSecurityOptions(
        master_user_name="master-user",
        saml_authentication_enabled=True,
        saml_authentication_options=SAMLOptionsProperty(
            idp_entity_id="entity-id",
            idp_metadata_content="metadata-content-with-quotes-escaped"
        )
    )
)
```

Java:

```java
Domain domain = Domain.Builder.create(this, "Domain")
        .version(EngineVersion.OPENSEARCH_1_0)
        .enforceHttps(true)
        .nodeToNodeEncryption(true)
        .encryptionAtRest(EncryptionAtRestOptions.builder()
                .enabled(true)
                .build())
        .fineGrainedAccessControl(AdvancedSecurityOptions.builder()
                .masterUserName("master-user")
                .samlAuthenticationEnabled(true)
                .samlAuthenticationOptions(SAMLOptionsProperty.builder()
                        .idpEntityId("entity-id")
                        .idpMetadataContent("metadata-content-with-quotes-escaped")
                        .build())
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var domain = new Domain(this, "Domain", new DomainProps {
    Version = EngineVersion.OPENSEARCH_1_0,
    EnforceHttps = true,
    NodeToNodeEncryption = true,
    EncryptionAtRest = new EncryptionAtRestOptions {
        Enabled = true
    },
    FineGrainedAccessControl = new AdvancedSecurityOptions {
        MasterUserName = "master-user",
        SamlAuthenticationEnabled = true,
        SamlAuthenticationOptions = new SAMLOptionsProperty {
            IdpEntityId = "entity-id",
            IdpMetadataContent = "metadata-content-with-quotes-escaped"
        }
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
domain := awscdk.NewDomain(this, jsii.String("Domain"), &DomainProps{
	Version: awscdk.EngineVersion_OPENSEARCH_1_0(),
	EnforceHttps: jsii.Boolean(true),
	NodeToNodeEncryption: jsii.Boolean(true),
	EncryptionAtRest: &EncryptionAtRestOptions{
		Enabled: jsii.Boolean(true),
	},
	FineGrainedAccessControl: &AdvancedSecurityOptions{
		MasterUserName: jsii.String("master-user"),
		SamlAuthenticationEnabled: jsii.Boolean(true),
		SamlAuthenticationOptions: &SAMLOptionsProperty{
			IdpEntityId: jsii.String("entity-id"),
			IdpMetadataContent: jsii.String("metadata-content-with-quotes-escaped"),
		},
	},
})
```

## Properties

- `masterUserArn`: string — ARN for the master user.

  **Default:** fine-grained access control is disabled

  Only specify this or masterUserName, but not both.

- `masterUserName`: string — Username for the master user.

  **Default:** fine-grained access control is disabled

  Only specify this or masterUserArn, but not both.

- `masterUserPassword`: [SecretValue](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.SecretValue.html) — Password for the master user.

  **Default:** A Secrets Manager generated password

  You can use `SecretValue.unsafePlainText` to specify a password in plain text or
  use `secretsmanager.Secret.fromSecretAttributes` to reference a secret in
  Secrets Manager.

- `samlAuthenticationEnabled`: boolean — True to enable SAML authentication for a domain.

  **Default:** SAML authentication is disabled. Enabled if `samlAuthenticationOptions` is set.

- `samlAuthenticationOptions`: [SAMLOptionsProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_opensearchservice.SAMLOptionsProperty.html) — Container for information about the SAML configuration for OpenSearch Dashboards.

  **Default:** no SAML authentication options

  If set, `samlAuthenticationEnabled` will be enabled.
