# Copyright 2021 - 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.

openapi: 3.1.0
info:
  title: ppwcode STS with RAA
  description: >-
    Spec for an OAuth2 Secure Token Service (STS), according to [RFC 6749](https://tools.ietf.org/html/rfc6749),
    extended with support for Resource Action Authorization (RAA) version 2.

    To learn about OAuth2, we found ["OAuth 2.0 Simplified" by Aaron Parecki](https://www.oauth.com/) to be a very good
    resource.
  version: 1.0.0
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  contact:
    name: PeopleWare n.v.
    email: info@peopleware.be
    url: 'https://www.peopleware.be/'
servers:
  - url: 'https://www.ppwcode.org/openapi/common/stsWithRAA'
    description: Dummy endpoint. There is nothing here.
security:
  - public: []
paths:
  /token:
    $ref: '../sts/token/resource.yaml'
  '/.well-known/jwks.json':
    $ref: '../sts/JWKS/JWKSResource.yaml'
  /jwt:
    $ref: 'JWT/RAAJWTClaimSetResource.yaml'
components:
  securitySchemes:
    public:
      type: http
      scheme: none
  schemas:
    # Token requests bodies listed explicitly here as workaround for https://github.com/Redocly/redoc/issues/862#issuecomment-491631228
    # This is actually used in `../sts/RequestBody.yaml`.
    authorization_code:
      $ref: '../sts/token/request/AuthorizationCodeRequestBody.yaml'
    client_credentials:
      $ref: '../sts/token/request/ClientCredentialsRequestBody.yaml'
    refresh_token:
      $ref: '../sts/token/request/RefreshTokenRequestBody.yaml'
    password:
      $ref: '../sts/token/request/ROPCRequestBody.yaml'
    RSA:
      $ref: '../sts/JWKS/RSAJWK.yaml'
    EC:
      $ref: '../sts/JWKS/ECJWK.yaml'
# MUDO add mode to request parameters, either in the token request body, or as header
# TODO can we add flowId too? as header?
