279 lines
9.2 KiB
JSON
279 lines
9.2 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"title": "Go-Gin Prepack",
|
|
"contact": {},
|
|
"version": "1"
|
|
},
|
|
"basePath": "/v1",
|
|
"paths": {
|
|
"/adm/doot": {
|
|
"get": {
|
|
"description": "admin ping and login check",
|
|
"summary": "ping example",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Cookie set by /admin",
|
|
"name": "jwt",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {}
|
|
}
|
|
},
|
|
"/admin": {
|
|
"post": {
|
|
"description": "Secured login for any user accounts",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "User login",
|
|
"parameters": [
|
|
{
|
|
"description": "user email",
|
|
"name": "userkey",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "user password",
|
|
"name": "password",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "the 2fa token",
|
|
"name": "twofactorcode",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "",
|
|
"headers": {
|
|
"jwt": {
|
|
"type": "string",
|
|
"description": "The authentication token for this session, valid for 24h"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "userkey, 2fa token or password missing"
|
|
},
|
|
"401": {
|
|
"description": "not found or credentials invalid"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/doot": {
|
|
"get": {
|
|
"description": "unauthenticated ping",
|
|
"summary": "ping example",
|
|
"responses": {}
|
|
}
|
|
},
|
|
"/forgot": {
|
|
"post": {
|
|
"description": "Request a password reset for the provided userkey",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "Forgot password",
|
|
"parameters": [
|
|
{
|
|
"description": "user email to reset",
|
|
"name": "userkey",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": ""
|
|
},
|
|
"400": {
|
|
"description": "userkey not provided"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/login": {
|
|
"post": {
|
|
"description": "Secured login for any user accounts",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "User login",
|
|
"parameters": [
|
|
{
|
|
"description": "user email",
|
|
"name": "userkey",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "user password",
|
|
"name": "password",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "the 2fa token for the user, if activated",
|
|
"name": "twofactorcode",
|
|
"in": "body",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "",
|
|
"headers": {
|
|
"jwt": {
|
|
"type": "string",
|
|
"description": "The authentication token for this session, valid for 24h"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "userkey or password missing"
|
|
},
|
|
"401": {
|
|
"description": "not found or credentials invalid"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/reset": {
|
|
"post": {
|
|
"description": "Use a JWT token to validate and reset a password",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "Password reset",
|
|
"parameters": [
|
|
{
|
|
"description": "the token emailed to the user",
|
|
"name": "token",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "the new password value",
|
|
"name": "password",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": ""
|
|
},
|
|
"400": {
|
|
"description": "token and password not provided"
|
|
},
|
|
"401": {
|
|
"description": "bad token or user not found"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/sec/doot": {
|
|
"get": {
|
|
"description": "user ping and login check",
|
|
"summary": "ping example",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "JWT Cookie set by /login",
|
|
"name": "jwt",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {}
|
|
}
|
|
},
|
|
"/signup": {
|
|
"post": {
|
|
"description": "Sign a user up for a new account",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "User signup",
|
|
"parameters": [
|
|
{
|
|
"description": "user email",
|
|
"name": "userkey",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "user password",
|
|
"name": "password",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": ""
|
|
},
|
|
"400": {
|
|
"description": "userkey missing, or password missing or not strong enough"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |