openapi: 3.0.0

info:
  version: '1.0.0.alpha-2'
  title: 'Nhss_imsUEAU'
  description: |
    Nhss UE Authentication Service for IMS.
    © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC).
    All rights reserved.

externalDocs:
  description: 3GPP TS 29.562 HSS Services for Interworking with IMS, version 16.0.0
  url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.562/'

servers:
  - url: '{apiRoot}/nhss-ims-ueau/v1'
    variables:
      apiRoot:
        default: https://example.com
        description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501.

security:
  - oAuth2ClientCredentials:
    - nhss-ims-ueau
  - {}

paths:

  /{impi}/security-information/generate-sip-auth-data:
    post:
      summary: Generate authentication data for the UE based on the Auth-Scheme provided
      operationId: GenerateSipAuthData
      tags:
        - Generate Auth Data
      parameters:
        - name: impi
          in: path
          description: IMS Private Identity for the UE (IMPI)
          required: true
          schema:
            $ref: '#/components/schemas/Impi'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SipAuthenticationInfoRequest'
        required: true
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SipAuthenticationInfoResult'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails'
        '404':
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails'
        '405':
          $ref: 'TS29571_CommonData.yaml#/components/responses/405'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '501':
          description: Not implemented
          content:
            application/problem+json:
              schema:
                $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        '504':
          description: Gateway timeout
          content:
            application/problem+json:
              schema:
                $ref: 'TS29571_CommonData.yaml#/components/schemas/ProblemDetails'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'

components:
  schemas:

# COMPLEX TYPES:

    SipAuthenticationInfoRequest:
      type: object
      required:
        - sipAuthenticationScheme
      properties:
        sipAuthenticationScheme:
          $ref: '#/components/schemas/SipAuthenticationScheme'
        sipNumberAuthItems:
          $ref: '#/components/schemas/SipNumberAuthItems'
        resynchronizationInfo:
          $ref: '#/components/schemas/ResynchronizationInfo'

    ResynchronizationInfo:
      type: object
      required:
        - rand
        - auts
      properties:
        rand:
          $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/Rand'
        auts:
          $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/Auts'

    SipAuthenticationInfoResult:
      type: object
      required:
        - impi
      properties:
        impi:
          $ref: '#/components/schemas/Impi'
        3gAkaAvs:
          type: array
          items:
            $ref: '#/components/schemas/3GAkaAv'
          minItems: 1
        digestAuth:
          $ref: '#/components/schemas/DigestAuthentication'
        lineIdentifierList:
          type: array
          items:
            $ref: '#/components/schemas/LineIdentifier'
          minItems: 1
        ipAddress:
          $ref: '#/components/schemas/IpAddress'

    3GAkaAv:
      type: object
      required:
        - rand
        - xres
        - autn
        - ck
        - ik
      properties:
        rand:
          $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/Rand'
        xres:
          $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/Xres'
        autn:
          $ref: 'TS29503_Nudm_UEAU.yaml#/components/schemas/Autn'
        ck:
          $ref: '#/components/schemas/Ck'
        ik:
          $ref: '#/components/schemas/Ik'

    DigestAuthentication:
      type: object
      required:
        - digestRealm
        - digestAlgorithm
        - digestQop
        - ha1
      properties:
        digestRealm:
          type: string
        digestAlgorithm:
          $ref: '#/components/schemas/SipDigestAlgorithm'
        digestQop:
          $ref: '#/components/schemas/SipDigestQop'
        ha1:
          type: string

    IpAddress:
      type: object
      oneOf:
        - required:
          - ipv4Addr
        - required:
          - ipv6Addr
        - required:
          - ipv6Prefix
      properties:
        ipv4Addr:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv4Addr'
        ipv6Addr:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Addr'
        ipv6Prefix:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Ipv6Prefix'

# SIMPLE TYPES:

    SipNumberAuthItems:
      type: integer
      minimum: 1

    Impi:
      type: string

    Ck:
      type: string
      pattern: '^[A-Fa-f0-9]{32}$'

    Ik:
      type: string
      pattern: '^[A-Fa-f0-9]{32}$'

    LineIdentifier:
      type: string

# ENUMS:

    SipAuthenticationScheme:
      anyOf:
        - type: string
          enum:
          - DIGEST-AKAV1-MD5
          - DIGEST-HTTP
          - NBA
          - GIBA
          - UNKNOWN
        - type: string

    SipDigestAlgorithm:
      anyOf:
        - type: string
          enum:
          - MD5
          - MD5_SESS
        - type: string

    SipDigestQop:
      anyOf:
        - type: string
          enum:
          - AUTH
          - AUTH_INT
        - type: string
