Ver código fonte

fix: Add security definitions

Sean Blackburn 1 ano atrás
pai
commit
14ab2b2c5b

+ 17 - 0
README.md

@@ -2,6 +2,23 @@
 
 OpenAPI documentation of the modulplaner API
 
+
+## Optional endpoints
+
+This OpenAPI spec contains some "optional" endpoints. This is down to the fact, that the
+module planner can be used on a static website, or also be integrated into a server that
+is connected to a database.
+
+When the Modulplaner is set to be hosted on a static site, the endpoints marked with
+`[OPTIONAL]` can not be reached.
+
+
+## Authentication
+
+The defined authentication can be exchanged for any valid authentication. The spec only
+represents which endpoints should require authentication when implementing a server.
+
+
 ## Definitions
 
 - `Module`:  A specific unit or component of a broader course of study. It focuses on a

+ 0 - 0
src/components/securitySchemes/.gitkeep


+ 6 - 0
src/openapi.yaml

@@ -10,6 +10,12 @@ info:
     name: MPL 2.0
     url: https://www.mozilla.org/en-US/MPL/2.0/
 
+components:
+  securitySchemes:
+    authRequired:
+      type: http
+      scheme: bearer
+
 servers:
   - url: http://localhost:8080
     description: localhost

+ 4 - 2
src/paths/api/me/favourites/index.yaml

@@ -5,7 +5,8 @@ get:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   tags:
     - Me/Favourites
   responses:
@@ -22,7 +23,8 @@ post:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   tags:
     - Me/Favourites
   requestBody:

+ 6 - 3
src/paths/api/me/favourites/{favourite}/index.yaml

@@ -5,7 +5,8 @@ get:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   parameters:
     - $ref: ../../../../../components/parameters/me-favourite.yaml
   tags:
@@ -25,7 +26,8 @@ put:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   parameters:
     - $ref: ../../../../../components/parameters/me-favourite.yaml
   tags:
@@ -51,7 +53,8 @@ delete:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   parameters:
     - $ref: ../../../../../components/parameters/me-favourite.yaml
   tags:

+ 2 - 1
src/paths/api/me/index.yaml

@@ -5,7 +5,8 @@ get:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   tags:
     - Me
   responses:

+ 4 - 2
src/paths/api/me/personal-events/index.yaml

@@ -5,7 +5,8 @@ get:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   tags:
     - Me/Personal Event
   responses:
@@ -22,7 +23,8 @@ post:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   tags:
     - Me/Personal Event
   requestBody:

+ 6 - 3
src/paths/api/me/personal-events/{event}/index.yaml

@@ -5,7 +5,8 @@ get:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   parameters:
     - $ref: ../../../../../components/parameters/me-event.yaml
   tags:
@@ -25,7 +26,8 @@ put:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   parameters:
     - $ref: ../../../../../components/parameters/me-event.yaml
   tags:
@@ -51,7 +53,8 @@ delete:
   description: >-
     **THIS IS AN OPTIONAL ENDPOINT**: This endpoint might not be implemented, as it
     requires a server running!
-  security: []
+  security:
+    - authRequired: []
   parameters:
     - $ref: ../../../../../components/parameters/me-event.yaml
   tags: