Skip to content

Security

GradedJestRisk edited this page Sep 25, 2024 · 1 revision

Security

Keycloak

  security:
    oauth2:
      resourceserver:
        jwt:
          issuer-uri: http://keycloak:$PORT/auth/realms/Federation
      client:
        registration:
          $APPLICATION_NAME:
            client-id: $CLIENT_ID
            client-name: $CLIENT_NAME
            authorization-grant-type: authorization_code
            client-secret: $SECRET
            scope:
              - openid
        provider:
          $APPLICATION_NAME:
            issuer-uri: http://keycloak:$PORT/auth/realms/Federation
            logout-redirect-uri: http://$APPLICATION_NAME/logout-succesfull
            end-session-endpoint: /protocol/openid-connect/logout

Keycloak

Terraform provider https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs

Doc

standard_flow_enabled - When true, use OAuth2 Authorization Code Grant

https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs/resources/openid_client

config.tf

provider "keycloak" {
  client_id     = "terraform-configurator"
  client_secret = var.client_secret_terraform_configurator
  url           = var.keycloak_url
  base_path     = var.base_path
}

terraform {
  required_providers {
    keycloak = {
      source  = "mrparkers/keycloak"
      version = "4.1.0"
    }
  }

realm.tf

resource "keycloak_openid_client" "agent_federation_broker" {
  realm_id              = $REALM
  client_id             = $CLIENT_ID
  name                  = $CLIENT_NAME
  enabled               = true
  standard_flow_enabled = true
Clone this wiki locally