Swagger tweak, removing manually built postman build

This commit is contained in:
🐙PiperYxzzy
2022-05-29 19:32:00 +02:00
parent 403cc51e12
commit 10a28f4e89
5 changed files with 103 additions and 310 deletions

View File

@@ -1,295 +0,0 @@
{
"info": {
"_postman_id": "6485c58d-0675-4f5d-9eed-4c2ecd8174ae",
"name": "Prepack",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Unauthenticated",
"item": [
{
"name": "V1 Doot",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "localhost:9091/v1/doot",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"doot"
]
}
},
"response": []
},
{
"name": "V1 Signup",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"userkey\": \"newser@user.com\",\n \"password\": \"NewPass\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "localhost:9091/v1/signup",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"signup"
]
}
},
"response": []
},
{
"name": "V1 User Forgot Password",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"userkey\": \"newser@user.com\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "localhost:9091/v1/forgot",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"forgot"
]
}
},
"response": []
},
{
"name": "V1 User Reset Password",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NTE0MjYzMjYsImlhdCI6MTY1MTQyNTQyNiwicm9sZSI6InJlc2V0Iiwic3ViIjoiZDFkNDBkMmUtOTFlYy00ZTBiLWEzY2EtM2U1ZTBkNGU5MTkxIn0.NE_0oV5MGJzuQuad-TUen1c7VCfFW9t6LMJPag8XC38\",\n \"password\": \"ChangedPass\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "localhost:9091/v1/reset",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"reset"
]
}
},
"response": []
},
{
"name": "V1 User Login",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"userkey\": \"newser@user.com\",\n \"password\": \"ChangedPass\",\n \"twofactorcode\": \"393939\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "localhost:9091/v1/login",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"login"
]
}
},
"response": []
},
{
"name": "V1 User Verify",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "localhost:9091/v1/verify?verify=TOKEN",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"verify"
],
"query": [
{
"key": "verify",
"value": "TOKEN"
}
]
}
},
"response": []
},
{
"name": "V1 Admin Login",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"userkey\": \"admin@admin.invalid\",\n \"password\": \"PASS_WOOOORD\",\n \"twofactorcode\": \"057192\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "localhost:9091/v1/admin",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"admin"
]
}
},
"response": []
},
{
"name": "Fresh Admin",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"userkey\": \"admin@admin.invalid\",\n \"password\": \"q7irwc34h6rv4t34v\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "localhost:9091/{UUID}",
"host": [
"localhost"
],
"port": "9091",
"path": [
"{UUID}"
]
}
},
"response": []
}
]
},
{
"name": "/sec (User)",
"item": [
{
"name": "V1 Secured Doot",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "localhost:9091/v1/sec/doot",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"sec",
"doot"
]
}
},
"response": []
},
{
"name": "V1 Secured Doot Copy",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "localhost:9091/v1/sec/2fa-doot",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"sec",
"2fa-doot"
]
}
},
"response": []
}
]
},
{
"name": "/adm (Admin)",
"item": [
{
"name": "V1 Admin Doot",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "localhost:9091/v1/adm/doot",
"host": [
"localhost"
],
"port": "9091",
"path": [
"v1",
"adm",
"doot"
]
}
},
"response": []
}
]
}
]
}

View File

@@ -556,3 +556,11 @@ func checkTwoFactorNotReused(a *models.Auth, tfCode string) bool {
return true
}
// Secure ping functionality
// @Summary 2FA-Restricted Ping
// @Product json
// @Param twofactorcode query string true "2FA authentication code"
// @Router /sec/2fa-doot [get]
// @Success 200
func secureDootDefinition() {}

View File

@@ -18,7 +18,7 @@ const docTemplate = `{
"paths": {
"/adm/doot": {
"get": {
"summary": "Admin ming",
"summary": "Admin ping",
"parameters": [
{
"type": "string",
@@ -28,7 +28,11 @@ const docTemplate = `{
"required": true
}
],
"responses": {}
"responses": {
"200": {
"description": ""
}
}
}
},
"/admin": {
@@ -40,7 +44,7 @@ const docTemplate = `{
"produces": [
"application/json"
],
"summary": "User login",
"summary": "Admin login",
"parameters": [
{
"description": "email, password and 2FA code. 2FA code is required",
@@ -74,7 +78,11 @@ const docTemplate = `{
"/doot": {
"get": {
"summary": "Unauthenticated Ping",
"responses": {}
"responses": {
"200": {
"description": ""
}
}
}
},
"/forgot": {
@@ -182,6 +190,25 @@ const docTemplate = `{
}
}
},
"/sec/2fa-doot": {
"get": {
"summary": "2FA-Restricted Ping",
"parameters": [
{
"type": "string",
"description": "2FA authentication code",
"name": "twofactorcode",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": ""
}
}
}
},
"/sec/doot": {
"get": {
"summary": "User ping",
@@ -194,7 +221,11 @@ const docTemplate = `{
"required": true
}
],
"responses": {}
"responses": {
"200": {
"description": ""
}
}
}
},
"/signup": {

View File

@@ -9,7 +9,7 @@
"paths": {
"/adm/doot": {
"get": {
"summary": "Admin ming",
"summary": "Admin ping",
"parameters": [
{
"type": "string",
@@ -19,7 +19,11 @@
"required": true
}
],
"responses": {}
"responses": {
"200": {
"description": ""
}
}
}
},
"/admin": {
@@ -31,7 +35,7 @@
"produces": [
"application/json"
],
"summary": "User login",
"summary": "Admin login",
"parameters": [
{
"description": "email, password and 2FA code. 2FA code is required",
@@ -65,7 +69,11 @@
"/doot": {
"get": {
"summary": "Unauthenticated Ping",
"responses": {}
"responses": {
"200": {
"description": ""
}
}
}
},
"/forgot": {
@@ -173,6 +181,25 @@
}
}
},
"/sec/2fa-doot": {
"get": {
"summary": "2FA-Restricted Ping",
"parameters": [
{
"type": "string",
"description": "2FA authentication code",
"name": "twofactorcode",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": ""
}
}
}
},
"/sec/doot": {
"get": {
"summary": "User ping",
@@ -185,7 +212,11 @@
"required": true
}
],
"responses": {}
"responses": {
"200": {
"description": ""
}
}
}
},
"/signup": {

View File

@@ -52,8 +52,10 @@ paths:
name: jwt
required: true
type: string
responses: {}
summary: Admin ming
responses:
"200":
description: ""
summary: Admin ping
/admin:
post:
consumes:
@@ -79,10 +81,12 @@ paths:
description: userkey, 2fa token or password missing
"401":
description: not found or credentials invalid
summary: User login
summary: Admin login
/doot:
get:
responses: {}
responses:
"200":
description: ""
summary: Unauthenticated Ping
/forgot:
post:
@@ -152,6 +156,18 @@ paths:
"401":
description: bad token or user not found
summary: Password reset
/sec/2fa-doot:
get:
parameters:
- description: 2FA authentication code
in: query
name: twofactorcode
required: true
type: string
responses:
"200":
description: ""
summary: 2FA-Restricted Ping
/sec/doot:
get:
parameters:
@@ -160,7 +176,9 @@ paths:
name: jwt
required: true
type: string
responses: {}
responses:
"200":
description: ""
summary: User ping
/signup:
post: