All files / schemas/oauth-dyn-reg metadata.schema.cts

100% Statements 218/218
100% Branches 0/0
100% Functions 0/0
100% Lines 218/218

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 2191x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * @license
 * Copyright 2022 Open Ag Data Alliance
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 */
 
import type { JSONSchema8 as Schema } from 'jsonschema8';
 
const schema: Schema = {
  $id: 'https://formats.openag.io/oauth-dyn-reg/metadata.schema.json',
  $schema: 'http://json-schema.org/draft-07/schema#',
  title: 'application/vnd.oada.oauth-dny-reg.register-response.1+json',
  description:
    '@see {@link https://datatracker.ietf.org/doc/html/rfc7591#section-2 Client Metadata}',
  properties: {
    client_id: {
      type: 'string',
    },
    client_id_issued_at: {
      type: 'number',
    },
    redirect_uris: {
      type: 'array',
      description:
        'Array of redirection URI strings for use in redirect-based flows such as the authorization code and implicit flows. As required by Section 2 of OAuth 2.0 [RFC6749], clients using flows with redirection MUST register their redirection URI values. Authorization servers that support dynamic registration for redirect-based flows MUST implement support for this metadata value.',
      minItems: 1,
      uniqueItems: true,
      items: {
        type: 'string',
        format: 'uri',
      },
    },
    token_endpoint_auth_method: {
      type: 'string',
      description:
        'String indicator of the requested authentication method for the token endpoint',
      oneOf: [
        {
          const: 'none',
          description:
            'The client is a public client as defined in OAuth 2.0, Section 2.1, and does not have a client secret',
        },
        {
          const: 'client_secret_post',
          description:
            'The client uses the HTTP POST parameters as defined in OAuth 2.0, Section 2.3.1',
        },
        {
          const: 'clinet_secret_basic',
          description:
            'The client uses HTTP Basic as defined in OAuth 2.0, Section 2.3.1',
        },
      ],
    },
    grant_types: {
      type: 'array',
      description:
        'Array of OAuth 2.0 grant type strings that the client can use at the token endpoint',
      minItems: 1,
      uniqueItems: true,
      items: {
        type: 'string',
        oneOf: [
          {
            const: 'authorization_code',
            description:
              'The authorization code grant type defined in OAuth 2.0, Section 4.1',
          },
          {
            const: 'implicit',
            description:
              'The implicit grant type defined in OAuth 2.0, Section 4.2',
          },
          {
            const: 'password',
            description:
              'The resource owner password credentials grant type defined in OAuth 2.0, Section 4.3',
          },
          {
            const: 'client_credentials',
            description:
              'The client credentials grant type in OAuth 2.0, Section 4.4',
          },
          {
            const: 'refresh_token',
            description:
              'The resource owner password credentials grant type defined in OAuth 2.0, Section 6',
          },
          {
            const: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
            description:
              'The JWT Bearer Token Grant Type defined in OAuth JWT Bearer Token Profiles [RFC7523]',
          },
          {
            const: 'urn:ietf:params:oauth:grant-type:saml2-bearer',
            description:
              'The SAML2 Bearer Token Grant Type defined in OAuth SAML 2 Bearer Token Profiles [RFC7522]',
          },
        ],
      },
    },
    response_types: {
      type: 'array',
      description:
        'Array of the OAuth 2.0 response type strings that the client can use at the authorization endpoint',
      minItems: 1,
      uniqueItems: true,
      items: {
        type: 'string',
      },
    },
    client_name: {
      type: 'string',
      description:
        'Human-readable string name of the client to be presented to the end-user during authorization',
    },
    client_url: {
      type: 'string',
      description:
        'URL string of a web page providing information about the client',
      format: 'uri',
    },
    logo_uri: {
      type: 'string',
      description: 'URL string that references a logo for the client',
      format: 'uri',
    },
    scope: {
      type: 'string',
      description: 'URL string that references a logo for the client',
    },
    contacts: {
      type: 'array',
      description:
        'Array of strings representing ways to contact people responsible for this client, typically email addresses',
      items: {
        type: 'string',
      },
    },
    tos_uri: {
      type: 'string',
      description:
        'URL string that points to a human-readable terms of service document for the client that describes a contractual relationship between the end-user and the client that the end-user accepts when authorizing the client',
      format: 'uri',
    },
    policy_uri: {
      type: 'string',
      description:
        'URL string that points to a human-readable privacy policy document that describes how the deployment organization collects, uses, retains, and discloses personal data',
      format: 'uri',
    },
    jwks_uri: {
      type: 'string',
      description:
        "URL string referencing the client's JSON Web Key (JWK) Set [RFC7517] document, which contains the client's public keys",
      format: 'uri',
    },
    jwks: {
      type: 'object',
      description:
        "Client's JSON Web Key Set [RFC7517] document value, which contains the client's public keys",
      properties: {
        keys: {
          type: 'array',
          items: {
            $comment: 'FIXME: Add JWK schema?',
            type: 'object',
          },
        },
      },
      required: ['keys'],
    },
    software_id: {
      type: 'string',
      description:
        'A unique identifier string (e.g., a Universally Unique Identifier (UUID)) assigned by the client developer or software publisher used by registration endpoints to identify the client software to be dynamically registered',
    },
    software_version: {
      type: 'string',
      description:
        'A version identifier string for the client software identified by "software_id"',
    },
    software_statement: {
      type: 'string',
      description:
        '@see {@link https://datatracker.ietf.org/doc/html/rfc7591#section-2.3 Software Statement}',
    },
  },
  type: 'object',
  examples: [
    {
      client_id: '3klaxu838akahf38acucaix73',
      client_id_issued_at: 1_418_423_102,
      software_version: '1.0-ga',
      scopes: 'read:planting.prescriptions write:fields',
      redirect_uris: [
        'https://client.example.com/callback',
        'https://client.example.com/cb',
      ],
      token_endpoint_auth_method:
        'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
      grant_types: ['implicit', 'authorization_code', 'refresh_token'],
      response_types: ['token', 'code'],
      client_name: 'Example OADA Client',
      client_uri: 'http://example.com',
      logo_uri: 'http://example.com/logo.png',
      contacts: ['Clint Client <cclient@example.com>'],
      tos_uri: 'http://example.com/tos.html',
      policy_uri: 'http://example.com/policy.html',
      software_id: 'djxkjau3n937xz7jakl3',
      registration_provider: 'registration.example.com',
    },
  ],
};
export = schema;