# Copyright 2020 - 2021 PeopleWare n.v.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

x-summary: >-
  The access token provided is expired, revoked, malformed, or invalid for other reasons
description: >-
  The returned `x-flow-id` and `x-mode` header values are the same as in the request, if they are available.


  If there is no `x-flow-id` in the request, or if it is malformed, the service generates a random UUID itself, and
  returns that. Therefor, a `401` response always has an `x-flow-id` header. (A missing `x-flow-id` in the request would
  normally result in a `400` response, but authNZ takes precedence.)


  If there is no `x-mode` in the request, or if it is malformed, no `x-mode` header is returned, since we will never
  return invalid values. (In this case, when there was a valid `authorization` token, a `403` would be returned
  instead.)
headers:
  www-authenticate:
    required: true
    schema:
      $ref: 'WWWAuthenticate.yaml'
  x-flow-id:
    required: true
    schema:
      $ref: '../id/UUID.yaml'
  x-mode:
    required: false # because 401 takes precedence over all other responses
    schema:
      $ref: '../id/mode.yaml'
  x-date:
    required: true
    schema:
      $ref: '../time/DateTime.yaml'
