swagger: '2.0'
info:
  version: 13.39.5
  title: FIMS API
  description: Federated Identity Management System API for user authentication.
host: localhost
basePath: /fims/api/v1
schemes:
  - https
security:
  - Bearer: []
paths:
  /user:
    x-swagger-router-controller: SSOController
    get:
      operationId: getUserForFIMS
      summary: Get user's data
      description: Returns the user data needed by FIMS backend.
      responses:
        '200':
          description: Found.
          schema:
            $ref: '#/definitions/FIMSUser'
          examples:
            application/json:
              name: Name
              family_name: Surname
              fiscal_code: AAABBB01C02D123Z
              auth_time: 1648474413
              acr: https://www.spid.gov.it/SpidL2
              email: email@test.com
              date_of_birth: '2002-01-01'
        '400':
          description: Validation error
          schema:
            $ref: '#/definitions/ProblemJson'
        '401':
          description: Token null or expired.
        '404':
          description: User not found
          schema:
            $ref: '#/definitions/ProblemJson'
        '429':
          description: Too may requests
        '500':
          description: There was an error in retrieving the user data.
          schema:
            $ref: '#/definitions/ProblemJson'
definitions:
  FederatedUser:
    title: Federated user
    description: User data needed by federated applications.
    allOf:
      - type: object
        properties:
          name:
            type: string
          family_name:
            type: string
        required:
          - name
          - family_name
      - title: Federated user
        description: User data needed by federated applications.
        type: object
        properties:
          fiscal_code:
            $ref: '#/definitions/FiscalCode'
        required:
          - fiscal_code
  FIMSUser:
    allOf:
      - type: object
        properties:
          date_of_birth:
            type: string
            format: date
          email:
            type: string
            format: email
            example: foobar@example.com
          auth_time:
            type: number
          acr:
            $ref: '#/definitions/SpidLevel'
        required:
          - date_of_birth
          - auth_time
          - acr
      - $ref: '#/definitions/FederatedUser'
  ProblemJson:
    type: object
    properties:
      type:
        type: string
        format: uri
        description: |-
          An absolute URI that identifies the problem type. When dereferenced,
          it SHOULD provide human-readable documentation for the problem type
          (e.g., using HTML).
        default: about:blank
        example: https://example.com/problem/constraint-violation
      title:
        type: string
        description: |-
          A short, summary of the problem type. Written in english and readable
          for engineers (usually not suited for non technical stakeholders and
          not localized); example: Service Unavailable
      status:
        type: integer
        format: int32
        description: >-
          The HTTP status code generated by the origin server for this
          occurrence of the problem.
        minimum: 100
        maximum: 600
        exclusiveMaximum: true
        example: 200
      detail:
        type: string
        description: |-
          A human readable explanation specific to this occurrence of the
          problem.
        example: There was an error processing the request
      instance:
        type: string
        format: uri
        description: >-
          An absolute URI that identifies the specific occurrence of the
          problem.

          It may or may not yield further information if dereferenced.
  FiscalCode:
    type: string
    description: User's fiscal code.
    format: FiscalCode
    x-import: '@pagopa/ts-commons/lib/strings'
    example: SPNDNL80R13C555X
  SpidLevel:
    type: string
    description: A SPID level.
    x-extensible-enum:
      - https://www.spid.gov.it/SpidL1
      - https://www.spid.gov.it/SpidL2
      - https://www.spid.gov.it/SpidL3
responses: {}
parameters: {}
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  Bearer:
    type: apiKey
    name: Authorization
    in: header
