swagger: '2.0'
info:
  description: >-
    This is the JWT authentication service for the Waterproofing Data (WPD) Work Packages. You can find out more about JWT
    at [https://jwt.io/](https://jwt.io/). In order to run this, you can use the
    `admin` or `client` users (password: admin and client respectively) to test
    the authorization filters. Once you have successfully logged in and obtained
    the token, you should click on the right top button `Authorize` and
    introduce it with the prefix "Bearer ".
  version: 1.0.0
  title: The authenticator for the Waterproofing Data (WPD) Work Packages
  contact:
    email: igsd@warwick.ac.uk
  license:
    name: Apache-2.0 License
    url: https://opensource.org/licenses/Apache-2.0
host: localhost:8080
basePath: /
tags:
  - name: users
    description: Operations about users
paths:
  /users/activate:
    post:
      tags:
        - users
      summary: ${UserController.activate}
      operationId: activateUsingPOST
      consumes:
        - application/json
      produces:
        - '*/*'
      parameters:
        - name: activationkey
          in: path
          description: ActivationKey
          required: false
          type: string
        - name: username
          in: path
          description: Username
          required: false
          type: string
      responses:
        '200':
          description: OK
          schema:
            type: string
        '400':
          description: Something went wrong
        '403':
          description: Access denied
        '404':
          description: The user doesn't exist
        '500':
          description: Expired or invalid JWT token
      security:
        - Authorization:
            - global
        - apiKey: []
      deprecated: false
  /users/login:
    post:
      tags:
        - users
      summary: ${UserController.signin}
      operationId: loginUsingPOST
      consumes:
        - application/json
      produces:
        - '*/*'
      parameters:
        - name: password
          in: query
          description: Password
          required: false
          type: string
          allowEmptyValue: false
        - name: username
          in: query
          description: Username
          required: false
          type: string
          allowEmptyValue: false
      responses:
        '200':
          description: OK
          schema:
            type: string
        '400':
          description: Something went wrong
        '422':
          description: Invalid username/password supplied
      security:
        - Authorization:
            - global
      deprecated: false
  /users/me:
    get:
      tags:
        - users
      summary: ${UserController.me}
      operationId: whoamiUsingGET
      produces:
        - '*/*'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/UsersResponseDTO'
        '400':
          description: Something went wrong
        '403':
          description: Access denied
        '500':
          description: Expired or invalid JWT token
      security:
        - Authorization:
            - global
        - apiKey: []
      deprecated: false
  /users/refresh:
    get:
      tags:
        - users
      summary: refresh
      operationId: refreshUsingGET
      produces:
        - '*/*'
      responses:
        '200':
          description: OK
          schema:
            type: string
      security:
        - Authorization:
            - global
      deprecated: false
  /users/signup:
    post:
      tags:
        - users
      summary: ${UserController.signup}
      operationId: signupUsingPOST
      consumes:
        - application/json
      produces:
        - '*/*'
      parameters:
        - in: body
          name: user
          description: Signup User
          required: false
          schema:
            $ref: '#/definitions/UsersRequestDTO'
      responses:
        '200':
          description: OK
          schema:
            type: string
        '400':
          description: Something went wrong
        '403':
          description: Access denied
        '422':
          description: Username is already in use
      security:
        - Authorization:
            - global
      deprecated: false
  /users/{username}:
    get:
      tags:
        - users
      summary: ${UserController.search}
      operationId: searchUsingGET
      produces:
        - '*/*'
      parameters:
        - name: username
          in: path
          description: Username
          required: false
          type: string
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/UsersResponseDTO'
        '400':
          description: Something went wrong
        '403':
          description: Access denied
        '404':
          description: The user doesn't exist
        '500':
          description: Expired or invalid JWT token
      security:
        - Authorization:
            - global
        - apiKey: []
      deprecated: false
securityDefinitions:
  Authorization:
    type: apiKey
    name: Authorization
    in: header
definitions:
  EduCemadenOrganizations:
    type: object
    properties:
      activationkey:
        type: string
      active:
        type: string
      address:
        type: string
      creation_date:
        type: string
      id:
        type: integer
        format: int32
      inep_code:
        type: string
      login:
        type: string
      name:
        type: string
      phone:
        type: string
      responsible:
        type: string
      type:
        type: string
      website:
        type: string
    title: EduCemadenOrganizations
  UsersRequestDTO:
    type: object
    properties:
      username:
        type: string
      password:
        type: string
    title: UsersRequestDTO
  UsersResponseDTO:
    type: object
    properties:
      id:
        type: integer
        format: int32
      username:
        type: string
      roles:
        type: array
        items:
          type: string
          enum:
            - ROLE_ADMIN
            - ROLE_INSTITUTION
            - ROLE_CLIENT
      eduCemadenOrganization:
        $ref: '#/definitions/EduCemadenOrganizations'
      rolesProviderActivationKeys:
        type: array
        items:
          $ref: '#/definitions/UsersRolesproviderActivationKey'
    title: UsersResponseDTO
  UsersRolesproviderActivationKey:
    type: object
    properties:
      activationkey:
        type: string
      id:
        type: integer
        format: int32
      rolesid:
        type: integer
        format: int32
      usersid:
        type: integer
        format: int32
    title: UsersRolesproviderActivationKey