본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Basic Auth 플러그인 OpenAPI 명세

원문 보기 위키 갱신

Basic Auth 플러그인 OpenAPI 명세 (Basic Auth Plugin OpenAPI Specification)

이 문서는 Kong의 Basic Auth 플러그인 API를 위한 OpenAPI 사양을 담고 있어요. 자격 증명을 조회할 때 쓰는 경로 파라미터와 페이지네이션 파라미터, 401 인증 오류 응답 같은 재사용 가능한 컴포넌트들이 YAML 스키마로 정의되어 있어요. Basic Auth 자격 증명 객체의 구조와 username, password 같은 필수 필드도 함께 확인할 수 있어요

출처: 문서

본문

---
components:
  parameters:
    BasicAuthId:
      description: ID of the Basic-auth credential to lookup
      example: 80db1b58-ca7c-4d21-b92a-64eb07725872
      in: path
      name: BasicAuthId
      required: true
      schema:
        type: string
    PaginationOffset:
      allowEmptyValue: true
      description: Offset from which to return the next set of resources. Use the
        value of the 'offset' field from the response of a list operation as input
        here to paginate through all the resources
      in: query
      name: offset
      schema:
        type: string
    PaginationSize:
      description: Number of resources to be returned.
      in: query
      name: size
      schema:
        default: 100
        maximum: 1000
        minimum: 1
        type: integer
    PaginationTagsFilter:
      allowEmptyValue: true
      description: A list of tags to filter the list of resources on. Multiple tags
        can be concatenated using ',' to mean AND or using '/' to mean OR.
      example: tag1,tag2
      in: query
      name: tags
      schema:
        type: string
  responses:
    HTTP401Error:
      content:
        application/json:
          examples:
            DuplicateApiKey:
              summary: Duplicate API key found
              value:
                message: Duplicate API key found
                status: 401
            InvalidAuthCred:
              summary: Invalid authentication credentials
              value:
                message: Unauthorized
                status: 401
            NoAPIKey:
              summary: No API key found
              value:
                message: No API key found in request
                status: 401
          schema:
            "$ref": "#/components/schemas/GatewayUnauthorizedError"
      description: Unauthorized
  schemas:
    BasicAuth:
      additionalProperties: false
      example:
        consumer:
          id: 84a73fb8-50fc-44a7-a4d5-aa17728ee83f
        id: b2f34145-0343-41a4-9602-4c69dec2f269
        password: hashedsoopersecretvalue
        username: darius
      properties:
        consumer:
          nullable: true
          properties:
            id:
              type: string
          type: object
          x-foreign: true
        created_at:
          description: Unix epoch when the resource was created.
          nullable: true
          type: integer
        id:
          nullable: true
          type: string
        password:
          type: string
        tags:
          items:
            type: string
          type: array
        username:
          type: string
      required:
      - username
      - password
      type: object
    GatewayUnauthorizedError:
      properties:
        message:
          type: string
        status:
          type: integer
      required:
      - message
      - status
      type: object
    PaginationNextResponse:
      description: URI to the next page (may be null)
      type: string
    PaginationOffsetResponse:
      description: Offset is used to paginate through the API. Provide this value
        to the next list operation to fetch the next page
      type: string
externalDocs:
  description: Basic Auth Plugin API Specification
  url: https://developer.konghq.com
info:
  contact:
    email: support@konghq.com
    name: Kong Inc
    url: https://konghq.com
  description: |-
    API for managing Basic Auth credentials and tokens in Kong Gateway.
    You can lean more about Kong Gateway at [developer.konghq.com](https://developer.konghq.com).
    Give Kong a star at [Kong/kong](https://github.com/kong/kong) repository.
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  title: Basic Auth Plugin API
  version: 0.0.1
openapi: 3.0.0
paths:
  "/basic-auths":
    get:
      description: List all Basic-auth credentials
      operationId: list-basic-auth
      parameters:
      - "$ref": "#/components/parameters/PaginationSize"
      - "$ref": "#/components/parameters/PaginationOffset"
      - "$ref": "#/components/parameters/PaginationTagsFilter"
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    items:
                      "$ref": "#/components/schemas/BasicAuth"
                    type: array
                  next:
                    "$ref": "#/components/schemas/PaginationNextResponse"
                  offset:
                    "$ref": "#/components/schemas/PaginationOffsetResponse"
                type: object
          description: A successful response listing Basic-auth credentials
        '401':
          "$ref": "#/components/responses/HTTP401Error"
      summary: List all Basic-auth credentials
      tags:
      - Basic-auth credentials
    post:
      description: Create a new Basic-auth credential
      operationId: create-basic-auth
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/BasicAuth"
        description: Description of the new Basic-auth credential for creation
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/BasicAuth"
          description: Successfully created Basic-auth credential
        '401':
          "$ref": "#/components/responses/HTTP401Error"
      summary: Create a new Basic-auth credential
      tags:
      - Basic-auth credentials
  "/basic-auths/{BasicAuthId}":
    delete:
      description: Delete a Basic-auth credential
      operationId: delete-basic-auth
      parameters:
      - "$ref": "#/components/parameters/BasicAuthId"
      responses:
        '204':
          description: Successfully deleted Basic-auth credential or the resource
            didn't exist
        '401':
          "$ref": "#/components/responses/HTTP401Error"
      summary: Delete a Basic-auth credential
      tags:
      - Basic-auth credentials
    get:
      description: Get a Basic-auth credential using ID.
      operationId: get-basic-auth
      responses:
        '200':
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/BasicAuth"
          description: Successfully fetched Basic-auth credential
        '401':
          "$ref": "#/components/responses/HTTP401Error"
        '404':
          description: Resource does not exist
      summary: Fetch a Basic-auth credential
      tags:
      - Basic-auth credentials
    parameters:
    - "$ref": "#/components/parameters/BasicAuthId"
    patch:
      description: Update a Basic-auth credential
      operationId: update-basic-auth
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/BasicAuth"
        description: Fields of the Basic-auth credential that need to be updated
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/BasicAuth"
          description: Successfully updated Basic-auth credential
        '401':
          "$ref": "#/components/responses/HTTP401Error"
        '404':
          description: Resource does not exist
      summary: Update a Basic-auth credential
      tags:
      - Basic-auth credentials
    put:
      description: Create or Update Basic-auth credential using ID.
      operationId: upsert-basic-auth
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/BasicAuth"
        description: Description of the Basic-auth credential
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/BasicAuth"
          description: Successfully upserted Basic-auth credential
        '401':
          "$ref": "#/components/responses/HTTP401Error"
      summary: Upsert a Basic-auth credential
      tags:
      - Basic-auth credentials
  "/{workspace}/basic-auths":
    get:
      description: List all Basic-auth credentials in a workspace
      operationId: list-basic-auth-in-workspace
      parameters:
      - "$ref": "#/components/parameters/PaginationSize"
      - "$ref": "#/components/parameters/PaginationOffset"
      - "$ref": "#/components/parameters/PaginationTagsFilter"
      - description: Name or ID of workspace
        example: team-a
        in: path
        name: workspace
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    items:
                      "$ref": "#/components/schemas/BasicAuth"
                    type: array
                  next:
                    "$ref": "#/components/schemas/PaginationNextResponse"
                  offset:
                    "$ref": "#/components/schemas/PaginationOffsetResponse"
                type: object
          description: A successful response listing Basic-auth credentials
        '401':
          "$ref": "#/components/responses/HTTP401Error"
      summary: List all Basic-auth credentials in a workspace
      tags:
      - Basic-auth credentials
    post:
      description: Create a new Basic-auth credential in a workspace
      operationId: create-basic-auth-in-workspace
      parameters:
      - description: Name or ID of workspace
        example: team-a
        in: path
        name: workspace
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/BasicAuth"
        description: Description of the new Basic-auth credential for creation
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/BasicAuth"
          description: Successfully created Basic-auth credential
        '401':
          "$ref": "#/components/responses/HTTP401Error"
      summary: Create a new Basic-auth credential in a workspace
      tags:
      - Basic-auth credentials
  "/{workspace}/basic-auths/{BasicAuthId}":
    delete:
      description: Delete a Basic-auth credential in a workspace
      operationId: delete-basic-auth-in-workspace
      parameters:
      - "$ref": "#/components/parameters/BasicAuthId"
      - description: Name or ID of workspace
        example: team-a
        in: path
        name: workspace
        required: true
        schema:
          type: string
      responses:
        '204':
          description: Successfully deleted Basic-auth credential or the resource
            didn't exist
        '401':
          "$ref": "#/components/responses/HTTP401Error"
      summary: Delete a Basic-auth credential in a workspace
      tags:
      - Basic-auth credentials
    get:
      description: Get a Basic-auth credential using ID in a workspace.
      operationId: get-basic-auth-in-workspace
      parameters:
      - description: Name or ID of workspace
        example: team-a
        in: path
        name: workspace
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/BasicAuth"
          description: Successfully fetched Basic-auth credential
        '401':
          "$ref": "#/components/responses/HTTP401Error"
        '404':
          description: Resource does not exist
      summary: Fetch a Basic-auth credential in a workspace
      tags:
      - Basic-auth credentials
    parameters:
    - "$ref": "#/components/parameters/BasicAuthId"
    patch:
      description: Update a Basic-auth credential in a workspace
      operationId: update-basic-auth-in-workspace
      parameters:
      - description: Name or ID of workspace
        example: team-a
        in: path
        name: workspace
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/BasicAuth"
        description: Fields of the Basic-auth credential that need to be updated
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/BasicAuth"
          description: Successfully updated Basic-auth credential
        '401':
          "$ref": "#/components/responses/HTTP401Error"
        '404':
          description: Resource does not exist
      summary: Update a Basic-auth credential in a workspace
      tags:
      - Basic-auth credentials
    put:
      description: Create or Update Basic-auth credential using ID in a workspace.
      operationId: upsert-basic-auth-in-workspace
      parameters:
      - description: Name or ID of workspace
        example: team-a
        in: path
        name: workspace
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/BasicAuth"
        description: Description of the Basic-auth credential
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/BasicAuth"
          description: Successfully upserted Basic-auth credential
        '401':
          "$ref": "#/components/responses/HTTP401Error"
      summary: Upsert a Basic-auth credential in a workspace
      tags:
      - Basic-auth credentials
servers:
- description: Default Admin API URL
  url: "{protocol}://{hostname}:{port}{path}"
  variables:
    hostname:
      default: localhost
      description: Hostname for Kong's Admin API
    path:
      default: "/"
      description: Base path for Kong's Admin API
    port:
      default: '8001'
      description: Port for Kong's Admin API
    protocol:
      default: http
      description: Protocol for requests to Kong's Admin API
      enum:
      - http
      - https
tags:
- name: Basic-auth credentials

관련 자료

더 알아보기 (Learn more)

  • Kong 개발자 포털에서 다른 가이드와 레퍼런스 문서를 함께 살펴보세요 — developer.konghq.com
  • Basic Auth 플러그인을 실제로 설정하고 사용하는 방법을 단계별로 익혀 보세요 — Basic Auth how-to guides