kind: ConfigMap
apiVersion: v1
metadata:
  name: "{{name}}-keycloak-config"
  namespace: '{{ meta.namespace }}'
  labels:
    app: "{{name}}"
    container: keycloak
    group: microcks
data:
  microcks-realm.json: |-
    {
      "id": "microcks",
      "realm": "microcks",
      "displayName": "Microcks",
      "notBefore": 0,
      "revokeRefreshToken": false,
      "refreshTokenMaxReuse": 0,
      "accessTokenLifespan": 300,
      "accessTokenLifespanForImplicitFlow": 900,
      "ssoSessionIdleTimeout": 1800,
      "ssoSessionMaxLifespan": 36000,
      "offlineSessionIdleTimeout": 2592000,
      "accessCodeLifespan": 60,
      "accessCodeLifespanUserAction": 300,
      "accessCodeLifespanLogin": 1800,
      "actionTokenGeneratedByAdminLifespan": 43200,
      "actionTokenGeneratedByUserLifespan": 300,
      "enabled": true,
      "sslRequired": "external",
      "registrationAllowed": false,
      "registrationEmailAsUsername": false,
      "rememberMe": false,
      "verifyEmail": false,
      "loginWithEmailAllowed": true,
      "duplicateEmailsAllowed": false,
      "resetPasswordAllowed": false,
      "editUsernameAllowed": false,
      "bruteForceProtected": false,
      "permanentLockout": false,
      "maxFailureWaitSeconds": 900,
      "minimumQuickLoginWaitSeconds": 60,
      "waitIncrementSeconds": 60,
      "quickLoginCheckMilliSeconds": 1000,
      "maxDeltaTimeSeconds": 43200,
      "failureFactor": 30,
      "users" : [
        {
          "username" : "user",
          "enabled": true,
          "credentials" : [
            { "type" : "password",
              "value" : "microcks123" }
          ],
          "realmRoles": [],
          "applicationRoles": {
            "microcks-app": [ "user" ]
          }
        },
        {
          "username" : "manager",
          "enabled": true,
          "credentials" : [
            { "type" : "password",
              "value" : "microcks123" }
          ],
          "realmRoles": [],
          "applicationRoles": {
            "microcks-app": [ "user", "manager" ]
          }
        },
        {
          "username" : "admin",
          "enabled": true,
          "credentials" : [
            { "type" : "password",
              "value" : "microcks123" }
          ],
          "realmRoles": [],
          "applicationRoles": {
            "realm-management": [ "manage-users", "manage-clients" ],
            "account": [ "manage-account" ],
            "microcks-app": [ "user", "manager", "admin" ]
          }
        }
      ],
      "roles": {
        "realm": [],
        "client": {
          "microcks-app": [
            {
              "name": "user",
              "composite": false,
              "clientRole": true,
              "containerId": "microcks"
            },
            {
              "name": "admin",
              "composite": false,
              "clientRole": true,
              "containerId": "microcks"
            },
            {
              "name": "manager",
              "composite": false,
              "clientRole": true,
              "containerId": "microcks"
            }
          ]
        }
      },
      "defaultRoles": [ ],
      "requiredCredentials": [ "password" ],
      "scopeMappings": [],
      "clientScopeMappings": {
        "microcks-app": [
          {
            "client": "microcks-app-js",
            "roles": [
              "manager",
              "admin",
              "user"
            ]
          }
        ],
        "realm-management": [
          {
            "client": "microcks-app-js",
            "roles": [
              "manage-users",
              "manage-clients"
            ]
          }
        ]
      },
      "applications": [
        {
          "name": "microcks-app",
          "enabled": true,
          "bearerOnly": true,
          "defaultRoles": [
            "user"
          ]
        },
        {
          "name": "microcks-app-js",
          "enabled": true,
          "publicClient": true,
          "webOrigins": [
            "+"
          ],
          "redirectUris": [
            "https://{{microcks.url|default(microcks_url)}}/*"
          ],
          "fullScopeAllowed": false
        },
        {
          "name": "{{keycloak.serviceAccount|default(keycloak.service_account)}}",
          "secret": "{{keycloak.serviceAccountCredentials|default(keycloak.service_account_credentials)}}",
          "enabled": true,
          "bearerOnly": false,
          "publicClient": false,
          "standardFlowEnabled": false,
          "directAccessGrantsEnabled": true,
          "serviceAccountsEnabled": true,
          "clientAuthenticatorType": "client-secret"
        }
      ],
      "identityProviders": [
      ],
      "keycloakVersion": "10.0.1"
    }
