{
  "openapi": "3.0.4",
  "info": {
    "title": "Taxcom Auth",
    "description": "Сервис аутентификации",
    "contact": {
      "name": "Документация",
      "url": "https://dev.taxcom.ru/wiki/pages/viewpage.action?pageId=220810588"
    },
    "version": "1.0.1"
  },
  "paths": {
    "/api/v1/auth": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Получение токена аутентификации",
        "description": "Получение токена аутентификации.",
        "operationId": "getAuth",
        "responses": {
          "200": {
            "description": "Токен доступа",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedResponse"
                },
                "example": {"error":"Неверная пара логин/пароль","details":"Ошибка проверки цепочки доверия сертификата"}
              }
            }
          },
          "500": {
            "description": "Что-то пошло не так",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "Что-то пошло не так"
                }
              }
            }
          }
        },
        "security": [
          {
            "mailBoxPass": [ ]
          }
        ]
      }
    },
    "/.well-known/jwks.json": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Получает список используемых ключей",
        "description": "Получает список публичных ключей в формате JWKS для проверки подписи токенов.",
        "operationId": "getJwks",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JwksDto"
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "mailBoxPass": [ ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "AuthResponse": {
        "required": [
          "access_token"
        ],
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "JwkRsaDto": {
        "type": "object",
        "properties": {
          "kty": {
            "type": "string",
            "nullable": true
          },
          "alg": {
            "type": "string",
            "nullable": true
          },
          "x5t": {
            "type": "string",
            "nullable": true
          },
          "n": {
            "type": "string",
            "nullable": true
          },
          "e": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "JwksDto": {
        "type": "object",
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JwkRsaDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UnauthorizedResponse": {
        "required": [
          "error"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "details": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "mailBoxPass": {
        "type": "http",
        "scheme": "basic"
      }
    }
  }
}