openapi: 3.0.0

info:
  version: '1.0.2'
  title: 'Nhss_imsUEAU'
  description: |
    Nhss UE Authentication Service for IMS.
    © 2021, 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.5.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
      security:
        - {}
        - oAuth2ClientCredentials:
          - nhss-ims-ueau
        - oAuth2ClientCredentials:
          - nhss-ims-ueau
          - nhss-ims-ueau:generate-sip-auth-data:invoke
      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'
        '307':
          $ref: 'TS29571_CommonData.yaml#/components/responses/307'
        '308':
          $ref: 'TS29571_CommonData.yaml#/components/responses/308'
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '405':
          $ref: 'TS29571_CommonData.yaml#/components/responses/405'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '501':
          $ref: 'TS29571_CommonData.yaml#/components/responses/501'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        '504':
          $ref: 'TS29571_CommonData.yaml#/components/responses/504'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'

components:

  securitySchemes:
    oAuth2ClientCredentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: '{nrfApiRoot}/oauth2/token'
          scopes:
            nhss-ims-ueau: Access to the Nhss IMS UE Authentication API
            nhss-ims-ueau:generate-sip-auth-data:invoke: Access to invoke the Generate SIP Auth Data custom operation

  schemas:

# COMPLEX TYPES:

    SipAuthenticationInfoRequest:
      type: object
      required:
        - cscfServerName
        - sipAuthenticationScheme
      properties:
        cscfServerName:
          type: string
        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
