hashicorp / terraform-provider-azuread

Terraform provider for Azure Active Directory
https://registry.terraform.io/providers/hashicorp/azuread/latest/docs
Mozilla Public License 2.0
417 stars 283 forks source link

Add support for token issuance policies #1364

Open smokedlinq opened 2 months ago

smokedlinq commented 2 months ago

Community Note

Description

Add support for the tokenIssuancePolicies API so that SAML applications can configure how tokens are signed. This may require the ability to create these policies to be assigned to the application as it looks like each application gets its own instance of a policies/tokenIssuancePolicies.

New or Affected Resource(s)

Potential Terraform Configuration

resource "azuread_service_principal" "example" {
  token_issuance_policy {
    signing_algorithm             = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
    token_response_signing_policy = "ResponseAndToken"
  }
}

# Alternative adding it to the saml_single_sign_on block
resource "azuread_service_principal" "example" {
  saml_single_sign_on {
    token_issuance_policy = {
      signing_algorithm             = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
      token_response_signing_policy = "ResponseAndToken"
    }
  }
}

# Alternative as a separate resource, though you can only have one I believe so this may not make sense
resource "azuread_service_principal_token_issuance_policy" "example" {
  id                            = azuread_service_principal.example.id
  signing_algorithm             = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
  token_response_signing_policy = "ResponseAndToken"
}

References