Added openapi scheme for the stats api tokens.

ref #56
This commit is contained in:
Nicolai Ort 2020-12-29 21:38:48 +01:00
parent 345851bf1d
commit 9675e79441
3 changed files with 11 additions and 1 deletions

View File

@ -35,7 +35,7 @@ export class StatsController {
@Get("/authorized")
@UseBefore(StatsAuth)
@OpenAPI({ description: "A demo endpoint for authorized stats." })
@OpenAPI({ description: "A demo endpoint for authorized stats.", security: [{ "StatsApiToken": [] }] })
async getAuthorized() {
let connection = getConnection();
let runners = await connection.getRepository(Runner).find({ relations: ["scans"] });

View File

@ -35,6 +35,11 @@ export default async (app: Application) => {
"in": "cookie",
"name": "lfk_backend__refresh_token",
description: "A cookie containing a JWT based refreh token. Attention: Doesn't work in swagger-ui. Use /api/auth/login or /api/auth/refresh to get one."
},
"StatsApiToken": {
"type": "http",
"scheme": "bearer",
description: "Api token that can be obtained by creating a new stats client (post to /api/statsclients)."
}
}
},

View File

@ -44,6 +44,11 @@ const spec = routingControllersToSpec(
"in": "cookie",
"name": "lfk_backend__refresh_token",
description: "A cookie containing a JWT based refreh token. Attention: Doesn't work in swagger-ui. Use /api/auth/login or /api/auth/refresh to get one."
},
"StatsApiToken": {
"type": "http",
"scheme": "bearer",
description: "Api token that can be obtained by creating a new stats client (post to /api/statsclients)."
}
}
},