openapi: 3.0.1
paths:
  /login/can-login:
    post:
      operationId: canLogin
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CanLoginRequest'
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /login/can-reset-password:
    post:
      operationId: canResetPassword
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CanResetPasswordRequest'
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /login/changelanguage:
    post:
      operationId: changeLanguage
      requestBody:
        content:
          '*/*':
            schema:
              type: string
      responses:
        default:
          description: default response
          content:
            '*/*': {}
  /login/change-password:
    post:
      summary: changes the password of a logged in user
      description: changes the password (necessary if login returns forcePasswordChange=true)
      operationId: relogin
      parameters:
      - name: accessToken
        in: header
        schema:
          type: string
      - name: Authorization
        in: header
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChangePasswordRequest'
      responses:
        "200":
          description: ok
        "500":
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangePasswordErrorResponse'
  /login/login:
    post:
      summary: login with a token or username and password
      description: the token from the can-login endpoint or a username and password
        must be provided. If the login is successful an access token and a refresh
        token will be returned
      operationId: login
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
      responses:
        "200":
          description: ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
        "500":
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginErrorResponse'
  /login/relogin:
    post:
      summary: relogin with a refresh token
      description: returns a new access token and a new refresh token for a valid
        refresh token
      operationId: relogin_1
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReLoginRequest'
      responses:
        "200":
          description: ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
        "500":
          description: error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginErrorResponse'
  /login/reset-password:
    post:
      operationId: resetPassword
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPasswordRequest'
      responses:
        default:
          description: default response
          content:
            application/json: {}
  /login/send-reset-password-email:
    post:
      operationId: sendResetPassordEmail
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendResetPasswordEmailRequest'
      responses:
        default:
          description: default response
          content:
            application/json: {}
components:
  schemas:
    CanLoginRequest:
      type: object
      properties:
        userName:
          type: string
    CanResetPasswordRequest:
      type: object
      properties:
        userName:
          type: string
        zipCode:
          type: string
    ChangePasswordErrorResponse:
      type: object
      properties:
        reason:
          type: string
          enum:
          - TOKEN_EXPIRED
          - INVALID_OLD_PASSWORD
          - PW_DOES_NOT_MATCH_GUIDELINES
          - INTERNAL_OR_UNKNOWN_ERROR
    ChangePasswordRequest:
      type: object
      properties:
        oldPassword:
          type: string
        newPassword:
          type: string
    LoginResponse:
      type: object
      properties:
        accessToken:
          type: string
          description: the access token for further requests
          example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
        refreshToken:
          type: string
          description: the refresh token to get a new access token
          example: dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4
        role:
          type: string
        permissions:
          type: array
          items:
            type: string
        language:
          type: string
        actorName:
          type: string
        displayName:
          type: string
        userName:
          type: string
        ssoToken:
          type: string
        forcePasswordChange:
          type: boolean
          description: "if true, the user must change the password with change-password"
    LoginErrorResponse:
      type: object
      properties:
        reason:
          type: string
          enum:
          - TOKEN_EXPIRED
          - PASSWORD_MISMATCH
          - INTERNAL_OR_UNKNOWN_ERROR
    LoginRequest:
      type: object
      properties:
        userExistToken:
          type: string
        userID:
          type: string
        password:
          type: string
        deviceId:
          type: string
    ReLoginRequest:
      type: object
      properties:
        refreshToken:
          type: string
    ResetPasswordRequest:
      type: object
      properties:
        resetPasswordToken:
          type: string
        newPassword:
          type: string
    SendResetPasswordEmailRequest:
      type: object
      properties:
        userExistToken:
          type: string
