{
  "$id": "http://express-gateway.io/models/credentials.json",
  "type": "object",
  "definitions": {
    "credentialBase": {
      "type": "object",
      "properties": {
        "autoGeneratePassword": {
          "type": "boolean",
          "default": true
        },
        "scopes": {
          "type": [
            "string",
            "array"
          ],
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "autoGeneratePassword"
      ]
    }
  },
  "properties": {
    "basic-auth": {
      "allOf": [
        {
          "$ref": "#/definitions/credentialBase"
        },
        {
          "type": "object",
          "properties": {
            "passwordKey": {
              "type": "string",
              "default": "password"
            }
          },
          "required": [
            "passwordKey"
          ]
        }
      ]
    },
    "key-auth": {
      "type": "object",
      "properties": {
        "scopes": {
          "type": [
            "string",
            "array"
          ],
          "items": {
            "type": "string"
          }
        }
      }
    },
    "jwt": {
      "type": "object",
      "properties": {}
    },
    "oauth2": {
      "allOf": [
        {
          "$ref": "#/definitions/credentialBase"
        },
        {
          "type": "object",
          "properties": {
            "passwordKey": {
              "type": "string",
              "default": "secret"
            }
          },
          "required": [
            "passwordKey"
          ]
        }
      ]
    }
  }
}
