Swagger tweak, removing manually built postman build
This commit is contained in:
@@ -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": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -556,3 +556,11 @@ func checkTwoFactorNotReused(a *models.Auth, tfCode string) bool {
|
|||||||
|
|
||||||
return true
|
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() {}
|
||||||
|
|||||||
41
docs/docs.go
41
docs/docs.go
@@ -18,7 +18,7 @@ const docTemplate = `{
|
|||||||
"paths": {
|
"paths": {
|
||||||
"/adm/doot": {
|
"/adm/doot": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Admin ming",
|
"summary": "Admin ping",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -28,7 +28,11 @@ const docTemplate = `{
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {}
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/admin": {
|
"/admin": {
|
||||||
@@ -40,7 +44,7 @@ const docTemplate = `{
|
|||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"summary": "User login",
|
"summary": "Admin login",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "email, password and 2FA code. 2FA code is required",
|
"description": "email, password and 2FA code. 2FA code is required",
|
||||||
@@ -74,7 +78,11 @@ const docTemplate = `{
|
|||||||
"/doot": {
|
"/doot": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Unauthenticated Ping",
|
"summary": "Unauthenticated Ping",
|
||||||
"responses": {}
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/forgot": {
|
"/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": {
|
"/sec/doot": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "User ping",
|
"summary": "User ping",
|
||||||
@@ -194,7 +221,11 @@ const docTemplate = `{
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {}
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/signup": {
|
"/signup": {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"/adm/doot": {
|
"/adm/doot": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Admin ming",
|
"summary": "Admin ping",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -19,7 +19,11 @@
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {}
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/admin": {
|
"/admin": {
|
||||||
@@ -31,7 +35,7 @@
|
|||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"summary": "User login",
|
"summary": "Admin login",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "email, password and 2FA code. 2FA code is required",
|
"description": "email, password and 2FA code. 2FA code is required",
|
||||||
@@ -65,7 +69,11 @@
|
|||||||
"/doot": {
|
"/doot": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "Unauthenticated Ping",
|
"summary": "Unauthenticated Ping",
|
||||||
"responses": {}
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/forgot": {
|
"/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": {
|
"/sec/doot": {
|
||||||
"get": {
|
"get": {
|
||||||
"summary": "User ping",
|
"summary": "User ping",
|
||||||
@@ -185,7 +212,11 @@
|
|||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {}
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/signup": {
|
"/signup": {
|
||||||
|
|||||||
@@ -52,8 +52,10 @@ paths:
|
|||||||
name: jwt
|
name: jwt
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
responses: {}
|
responses:
|
||||||
summary: Admin ming
|
"200":
|
||||||
|
description: ""
|
||||||
|
summary: Admin ping
|
||||||
/admin:
|
/admin:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
@@ -79,10 +81,12 @@ paths:
|
|||||||
description: userkey, 2fa token or password missing
|
description: userkey, 2fa token or password missing
|
||||||
"401":
|
"401":
|
||||||
description: not found or credentials invalid
|
description: not found or credentials invalid
|
||||||
summary: User login
|
summary: Admin login
|
||||||
/doot:
|
/doot:
|
||||||
get:
|
get:
|
||||||
responses: {}
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
summary: Unauthenticated Ping
|
summary: Unauthenticated Ping
|
||||||
/forgot:
|
/forgot:
|
||||||
post:
|
post:
|
||||||
@@ -152,6 +156,18 @@ paths:
|
|||||||
"401":
|
"401":
|
||||||
description: bad token or user not found
|
description: bad token or user not found
|
||||||
summary: Password reset
|
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:
|
/sec/doot:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
@@ -160,7 +176,9 @@ paths:
|
|||||||
name: jwt
|
name: jwt
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
responses: {}
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
summary: User ping
|
summary: User ping
|
||||||
/signup:
|
/signup:
|
||||||
post:
|
post:
|
||||||
|
|||||||
Reference in New Issue
Block a user