From 284cdfbb6a68b87dada96e5005187335365cd7a0 Mon Sep 17 00:00:00 2001 From: Mike Neilson Date: Tue, 25 May 2021 21:01:18 -0700 Subject: [PATCH] [api] added auth mechanism to api docs. --- .../housedb/api/controllers/LocationController.java | 12 ++++++++++++ .../api/controllers/TimeSeriesController.java | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/z-api/src/main/java/net/hobbyscience/housedb/api/controllers/LocationController.java b/z-api/src/main/java/net/hobbyscience/housedb/api/controllers/LocationController.java index 419346a..8bf92d2 100644 --- a/z-api/src/main/java/net/hobbyscience/housedb/api/controllers/LocationController.java +++ b/z-api/src/main/java/net/hobbyscience/housedb/api/controllers/LocationController.java @@ -22,6 +22,9 @@ public class LocationController implements CrudHandler { tags = {"Locations"}, responses = { @OpenApiResponse(status="200", content = {@OpenApiContent( from = Location[].class,isArray=true)}) + }, + security = { + @OpenApiSecurity(name = "bearerAuth") } ) @Override @@ -43,6 +46,9 @@ public void getAll( Context ctx){ responses = { @OpenApiResponse(status="200", content = {@OpenApiContent( from = Location.class)}) }, + security = { + @OpenApiSecurity(name = "bearerAuth") + }, tags = {"Locations"} ) public void getOne( Context ctx, String locationName ){ @@ -88,11 +94,17 @@ public void create(Context ctx) { @OpenApi( + security = { + @OpenApiSecurity(name = "bearerAuth") + }, tags = {"Locations"} ) public void update(Context ctx, String locationName){ throw new UnsupportedOperationException("not implemented yet"); } @OpenApi( + security = { + @OpenApiSecurity(name = "bearerAuth") + }, tags = {"Locations"} ) public void delete(Context ctx, String locationName){ throw new UnsupportedOperationException("not implemented yet"); } diff --git a/z-api/src/main/java/net/hobbyscience/housedb/api/controllers/TimeSeriesController.java b/z-api/src/main/java/net/hobbyscience/housedb/api/controllers/TimeSeriesController.java index 06c807e..21064cb 100644 --- a/z-api/src/main/java/net/hobbyscience/housedb/api/controllers/TimeSeriesController.java +++ b/z-api/src/main/java/net/hobbyscience/housedb/api/controllers/TimeSeriesController.java @@ -44,6 +44,9 @@ public void getAll(Context ctx){ responses = { @OpenApiResponse(status="200", content = {@OpenApiContent( from = TimeSeries.class)}), @OpenApiResponse(status="404", content = {@OpenApiContent( from = NotFoundResponse.class)}) + }, + security = { + @OpenApiSecurity(name = "bearerAuth") } ) public void getOne(Context ctx, String locationName){ @@ -97,11 +100,17 @@ public void create(Context ctx){ } @OpenApi( + security = { + @OpenApiSecurity(name = "bearerAuth") + }, tags = {"TimeSeries"} ) public void update(Context ctx, String locationName){ throw new UnsupportedOperationException("not implemented yet"); } @OpenApi( + security = { + @OpenApiSecurity(name = "bearerAuth") + }, tags = {"TimeSeries"} ) public void delete(Context ctx , String locationName){ throw new UnsupportedOperationException("not implemented yet"); }