Skip to content

Instantly share code, notes, and snippets.

@lramosduarte
Last active March 14, 2024 13:51
Show Gist options
  • Save lramosduarte/7e3eff0d2b11bb4653a8aaebfdda3b7f to your computer and use it in GitHub Desktop.
Save lramosduarte/7e3eff0d2b11bb4653a8aaebfdda3b7f to your computer and use it in GitHub Desktop.
Keycloak - OpenAPI - Mock - TokenFlow - WIP
openapi: 3.0.3
info:
title: Swagger Petstore - OpenAPI 3.0
description: |-
Keycloak mock api
Some useful links:
- [keycloak doc](https://www.keycloak.org/docs/23.0.7/authorization_services/)
- [keycloak postman collection](https://documenter.getpostman.com/view/7294517/SzmfZHnd#12b1b64f-372b-47b5-a01f-0418fd9515c4)
- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)
- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
termsOfService: http://swagger.io/terms/
contact:
email: [email protected]
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.11
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
- url: https://petstore3.swagger.io/api/v3
paths:
/realms/{realmId}/protocol/{protocol-name}/token:
post:
summary: get a token
security:
- BasicAuth: []
description: 'Get a new token'
operationId: getToken
parameters:
- name: realmId
in: path
description: ID of realmId
required: true
schema:
type: string
- name: protocol-name
in: path
description: "Protocol name(ex: openid-connect)"
required: true
schema:
type: string
requestBody:
description: Get a new token
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/Credentials'
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Token'
'401':
$ref: '#/components/schemas/UnauthorizedResponse'
components:
securitySchemes:
BasicAuth:
type: http
scheme: basic
schemas:
Credentials:
required:
- client_id
- username
- password
- grant_type
type: object
properties:
client_id:
type: string
username:
type: string
password:
type: string
grant_type:
type: string
Token:
required:
- access_token
type: object
properties:
access_token:
type: string
UnauthorizedResponse:
description: Authentication information is missing or invalid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment