You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
848 B

11 months ago
  1. const { validApiKey } = require("../../../utils/middleware/validApiKey");
  2. function apiAuthEndpoints(app) {
  3. if (!app) return;
  4. app.get("/v1/auth", [validApiKey], (_, response) => {
  5. /*
  6. #swagger.tags = ['Authentication']
  7. #swagger.description = 'Verify the attached Authentication header contains a valid API token.'
  8. #swagger.responses[200] = {
  9. description: 'Valid auth token was found.',
  10. content: {
  11. "application/json": {
  12. schema: {
  13. type: 'object',
  14. example: {
  15. authenticated: true,
  16. }
  17. }
  18. }
  19. }
  20. }
  21. #swagger.responses[403] = {
  22. schema: {
  23. "$ref": "#/definitions/InvalidAPIKey"
  24. }
  25. }
  26. */
  27. response.status(200).json({ authenticated: true });
  28. });
  29. }
  30. module.exports = { apiAuthEndpoints };