# UserPoolIdentityProviderSamlProps

Properties to initialize UserPoolIdentityProviderSaml.

Extends: [UserPoolIdentityProviderProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPoolIdentityProviderProps.html)
Used as props by: [UserPoolIdentityProviderSaml](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPoolIdentityProviderSaml.html)

- Source: [`aws-cognito/lib/user-pool-idps/saml.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/saml.ts#L14)
- Type last changed: v2.138.0 · 18 Apr 2024

## Example

TypeScript:

```ts
const userpool = new cognito.UserPool(this, 'Pool');

// specify the metadata as a file content
new cognito.UserPoolIdentityProviderSaml(this, 'userpoolIdpFile', {
  userPool: userpool,
  metadata: cognito.UserPoolIdentityProviderSamlMetadata.file('my-file-contents'),
  // Whether to require encrypted SAML assertions from IdP
  encryptedResponses: true,
  // The signing algorithm for the SAML requests
  requestSigningAlgorithm: cognito.SigningAlgorithm.RSA_SHA256,
  // Enable IdP initiated SAML auth flow
  idpInitiated: true,
});

// specify the metadata as a URL
new cognito.UserPoolIdentityProviderSaml(this, 'userpoolidpUrl', {
  userPool: userpool,
  metadata: cognito.UserPoolIdentityProviderSamlMetadata.url('https://my-metadata-url.com'),
});
```

Python:

```python
userpool = cognito.UserPool(self, "Pool")

# specify the metadata as a file content
cognito.UserPoolIdentityProviderSaml(self, "userpoolIdpFile",
    user_pool=userpool,
    metadata=cognito.UserPoolIdentityProviderSamlMetadata.file("my-file-contents"),
    # Whether to require encrypted SAML assertions from IdP
    encrypted_responses=True,
    # The signing algorithm for the SAML requests
    request_signing_algorithm=cognito.SigningAlgorithm.RSA_SHA256,
    # Enable IdP initiated SAML auth flow
    idp_initiated=True
)

# specify the metadata as a URL
cognito.UserPoolIdentityProviderSaml(self, "userpoolidpUrl",
    user_pool=userpool,
    metadata=cognito.UserPoolIdentityProviderSamlMetadata.url("https://my-metadata-url.com")
)
```

Java:

```java
UserPool userpool = new UserPool(this, "Pool");

// specify the metadata as a file content
// specify the metadata as a file content
UserPoolIdentityProviderSaml.Builder.create(this, "userpoolIdpFile")
        .userPool(userpool)
        .metadata(UserPoolIdentityProviderSamlMetadata.file("my-file-contents"))
        // Whether to require encrypted SAML assertions from IdP
        .encryptedResponses(true)
        // The signing algorithm for the SAML requests
        .requestSigningAlgorithm(SigningAlgorithm.RSA_SHA256)
        // Enable IdP initiated SAML auth flow
        .idpInitiated(true)
        .build();

// specify the metadata as a URL
// specify the metadata as a URL
UserPoolIdentityProviderSaml.Builder.create(this, "userpoolidpUrl")
        .userPool(userpool)
        .metadata(UserPoolIdentityProviderSamlMetadata.url("https://my-metadata-url.com"))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var userpool = new UserPool(this, "Pool");

// specify the metadata as a file content
// specify the metadata as a file content
new UserPoolIdentityProviderSaml(this, "userpoolIdpFile", new UserPoolIdentityProviderSamlProps {
    UserPool = userpool,
    Metadata = UserPoolIdentityProviderSamlMetadata.File("my-file-contents"),
    // Whether to require encrypted SAML assertions from IdP
    EncryptedResponses = true,
    // The signing algorithm for the SAML requests
    RequestSigningAlgorithm = SigningAlgorithm.RSA_SHA256,
    // Enable IdP initiated SAML auth flow
    IdpInitiated = true
});

// specify the metadata as a URL
// specify the metadata as a URL
new UserPoolIdentityProviderSaml(this, "userpoolidpUrl", new UserPoolIdentityProviderSamlProps {
    UserPool = userpool,
    Metadata = UserPoolIdentityProviderSamlMetadata.Url("https://my-metadata-url.com")
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
userpool := cognito.NewUserPool(this, jsii.String("Pool"))

// specify the metadata as a file content
// specify the metadata as a file content
cognito.NewUserPoolIdentityProviderSaml(this, jsii.String("userpoolIdpFile"), &UserPoolIdentityProviderSamlProps{
	UserPool: userpool,
	Metadata: cognito.UserPoolIdentityProviderSamlMetadata_File(jsii.String("my-file-contents")),
	// Whether to require encrypted SAML assertions from IdP
	EncryptedResponses: jsii.Boolean(true),
	// The signing algorithm for the SAML requests
	RequestSigningAlgorithm: cognito.SigningAlgorithm_RSA_SHA256,
	// Enable IdP initiated SAML auth flow
	IdpInitiated: jsii.Boolean(true),
})

// specify the metadata as a URL
// specify the metadata as a URL
cognito.NewUserPoolIdentityProviderSaml(this, jsii.String("userpoolidpUrl"), &UserPoolIdentityProviderSamlProps{
	UserPool: userpool,
	Metadata: cognito.UserPoolIdentityProviderSamlMetadata_Url(jsii.String("https://my-metadata-url.com")),
})
```

## Properties

- `attributeMapping`: [AttributeMapping](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.AttributeMapping.html) — Mapping attributes from the identity provider to standard and custom attributes of the user pool.

  **Default:** no attribute mapping

- `encryptedResponses`: boolean = false — Whether to require encrypted SAML assertions from IdP.

- `identifiers`: string[] — Identifiers.

  **Default:** no identifiers used

  Identifiers can be used to redirect users to the correct IdP in multitenant apps.

- `idpInitiated`: boolean = false — Whether to enable IdP-initiated SAML auth flows.

- `idpSignout`: boolean = false — Whether to enable the "Sign-out flow" feature.

- `metadata`: [UserPoolIdentityProviderSamlMetadata](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPoolIdentityProviderSamlMetadata.html) (required) — The SAML metadata.

- `name`: string — The name of the provider.

  **Default:** the unique ID of the construct

  Must be between 3 and 32 characters.

- `requestSigningAlgorithm`: [SigningAlgorithm](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.SigningAlgorithm.html) — The signing algorithm for SAML requests.

  **Default:** don't sign requests

- `userPool`: [IUserPool](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.IUserPool.html) (required) — The user pool to which this construct provides identities.
