{
  "realm": "dev",
  "enabled": true,
  "sslRequired": "none",
  "registrationAllowed": false,
  "roles": {
    "realm": [
      {
        "name": "agent-chat-user",
        "description": "Grants access to the agent.chat scope"
      },
      {
        "name": "expenses-viewer",
        "description": "Grants access to the expenses.view scope"
      },
      {
        "name": "expenses-approver",
        "description": "Grants access to the expenses.approve scope"
      }
    ]
  },
  "scopeMappings": [
    {
      "clientScope": "agent.chat",
      "roles": ["agent-chat-user"]
    },
    {
      "clientScope": "expenses.view",
      "roles": ["expenses-viewer"]
    },
    {
      "clientScope": "expenses.approve",
      "roles": ["expenses-approver"]
    }
  ],
  "clientScopes": [
    {
      "name": "openid",
      "description": "OpenID Connect scope",
      "protocol": "openid-connect",
      "attributes": {
        "include.in.token.scope": "true"
      },
      "protocolMappers": [
        {
          "name": "sub",
          "protocol": "openid-connect",
          "protocolMapper": "oidc-sub-mapper",
          "config": {
            "introspection.token.claim": "true",
            "access.token.claim": "true"
          }
        }
      ]
    },
    {
      "name": "profile",
      "description": "OpenID Connect profile scope",
      "protocol": "openid-connect",
      "attributes": {
        "include.in.token.scope": "true"
      },
      "protocolMappers": [
        {
          "name": "preferred_username",
          "protocol": "openid-connect",
          "protocolMapper": "oidc-usermodel-attribute-mapper",
          "config": {
            "user.attribute": "username",
            "claim.name": "preferred_username",
            "jsonType.label": "String",
            "id.token.claim": "true",
            "access.token.claim": "true",
            "userinfo.token.claim": "true"
          }
        },
        {
          "name": "given_name",
          "protocol": "openid-connect",
          "protocolMapper": "oidc-usermodel-attribute-mapper",
          "config": {
            "user.attribute": "firstName",
            "claim.name": "given_name",
            "jsonType.label": "String",
            "id.token.claim": "true",
            "access.token.claim": "true",
            "userinfo.token.claim": "true"
          }
        },
        {
          "name": "family_name",
          "protocol": "openid-connect",
          "protocolMapper": "oidc-usermodel-attribute-mapper",
          "config": {
            "user.attribute": "lastName",
            "claim.name": "family_name",
            "jsonType.label": "String",
            "id.token.claim": "true",
            "access.token.claim": "true",
            "userinfo.token.claim": "true"
          }
        }
      ]
    },
    {
      "name": "email",
      "description": "OpenID Connect email scope",
      "protocol": "openid-connect",
      "attributes": {
        "include.in.token.scope": "true"
      }
    },
    {
      "name": "agent.chat",
      "description": "Allows chatting with the agent",
      "protocol": "openid-connect",
      "attributes": {
        "include.in.token.scope": "true",
        "display.on.consent.screen": "true"
      }
    },
    {
      "name": "expenses.view",
      "description": "Allows viewing pending expenses",
      "protocol": "openid-connect",
      "attributes": {
        "include.in.token.scope": "true",
        "display.on.consent.screen": "true"
      }
    },
    {
      "name": "expenses.approve",
      "description": "Allows approving pending expenses",
      "protocol": "openid-connect",
      "attributes": {
        "include.in.token.scope": "true",
        "display.on.consent.screen": "true"
      }
    },
    {
      "name": "agent-service-audience",
      "description": "Adds the agent-service audience to access tokens",
      "protocol": "openid-connect",
      "attributes": {
        "include.in.token.scope": "false",
        "display.on.consent.screen": "false"
      },
      "protocolMappers": [
        {
          "name": "agent-service-audience-mapper",
          "protocol": "openid-connect",
          "protocolMapper": "oidc-audience-mapper",
          "config": {
            "included.client.audience": "agent-service",
            "id.token.claim": "false",
            "access.token.claim": "true"
          }
        }
      ]
    }
  ],
  "clients": [
    {
      "clientId": "agent-service",
      "enabled": true,
      "publicClient": false,
      "secret": "agent-service-secret",
      "directAccessGrantsEnabled": true,
      "serviceAccountsEnabled": false,
      "standardFlowEnabled": false,
      "protocol": "openid-connect"
    },
    {
      "clientId": "web-client",
      "enabled": true,
      "publicClient": true,
      "directAccessGrantsEnabled": true,
      "standardFlowEnabled": true,
      "fullScopeAllowed": false,
      "protocol": "openid-connect",
      "redirectUris": [
        "http://localhost:8080/*"
      ],
      "webOrigins": [
        "http://localhost:8080"
      ],
      "defaultClientScopes": [
        "openid",
        "profile",
        "email",
        "agent-service-audience"
      ],
      "optionalClientScopes": [
        "agent.chat",
        "expenses.view",
        "expenses.approve"
      ]
    }
  ],
  "users": [
    {
      "username": "testuser",
      "enabled": true,
      "email": "testuser@example.com",
      "firstName": "Test",
      "lastName": "User",
      "realmRoles": ["agent-chat-user", "expenses-viewer", "expenses-approver"],
      "credentials": [
        {
          "type": "password",
          "value": "password",
          "temporary": false
        }
      ]
    },
    {
      "username": "viewer",
      "enabled": true,
      "email": "viewer@example.com",
      "firstName": "View",
      "lastName": "Only",
      "realmRoles": ["agent-chat-user", "expenses-viewer"],
      "credentials": [
        {
          "type": "password",
          "value": "password",
          "temporary": false
        }
      ]
    }
  ]
}
