openapi: 3.0.0
info:
  title: JWT-WS-Bridge
  version: 1.0.x
  description: >-
    A service that allows access to our live websocket via a valid JWT bearer
    token
  x-logo:
    url: ../img/cognitive_logo.svg
    backgroundColor: '#FFFFFF'
    altText: Cognitive systems logo
    href: /
paths:
  /live:
    get:
      parameters:
        - name: X-Network-Id
          description: |-
            network_id included in the JWT bearer token.

             Note: this is provided by the Nginx server once auth is confirmed and cannot be directly added to the request by the user.
          in: header
          required: true
          schema:
            type: string
        - name: Authorization
          description: JWT bearer token.
          in: header
          required: true
          schema:
            type: string
      tags:
        - External
      responses:
        '200':
          description: Successful response
          content:
            application/websocket:
              schema:
                type: string
        '400':
          description: Access Forbidden, An error was encountered.
        '401':
          description: Access Forbidden, Invalid or Missing data.
      operationId: GET_live
      summary: Live
      description: >-
        Upgrades the HTTPS connection to a live web socket if the JWT bearer
        token provided is valid.
  /auth:
    get:
      tags:
        - Internal
      parameters:
        - name: Authorization
          description: JWT bearer token.
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          headers:
            X-Network-Id:
              description: network_id included in the JWT bearer token.
              schema:
                type: string
          description: Successfully logged in.
        '400':
          description: Access Forbidden, An error was encountered.
        '401':
          description: Access Forbidden, Invalid or Missing data.
      operationId: GET_auth
      summary: Auth
      description: >-
        This is an internal endpoint that is used by the Nginx server to
        authenticate requests to the service. There is no need for a user to
        call this outside of development.  

         This endpoint consumes a JWT bearer token and returns a 200 and custom header if the JWT bearer token is valid.
  /healthz:
    get:
      tags:
        - Internal
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GET_healthz'
          description: ''
      operationId: GET_healthz
      summary: healthz
      description: >-
        This endpoint is internal and is used to confirm that Nginx server has
        been started and is serving requests.
    parameters: []
components:
  schemas:
    GET_healthz:
      type: object
      properties:
        service:
          type: string
          example: jwt-ws-bridge
    GET_auth_200:
      type: object
      properties:
        loggedIn:
          type: boolean
          example: true
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      bearerFormat: JWT
x-tagGroups:
  - name: API Endpoints
    tags:
      - External
      - Internal
