From 1dd4fa22cdfc749c5474f94108bca0aec34aea81 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 15 Jun 2023 01:26:36 -0400 Subject: [PATCH] feat: add auth status endpoint --- controller/auth.go | 11 +++++++++++ controller/response/auth_status.go | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 controller/response/auth_status.go diff --git a/controller/auth.go b/controller/auth.go index e25c9b0..4c7c213 100644 --- a/controller/auth.go +++ b/controller/auth.go @@ -3,6 +3,7 @@ package controller import ( "git.lumeweb.com/LumeWeb/portal/controller/request" "git.lumeweb.com/LumeWeb/portal/controller/response" + "git.lumeweb.com/LumeWeb/portal/middleware" "git.lumeweb.com/LumeWeb/portal/service/auth" "github.com/kataras/iris/v12" ) @@ -99,3 +100,13 @@ func (a *AuthController) PostLogout() { // Return a success response to the client. a.Ctx.StatusCode(iris.StatusNoContent) } + +func (a *AuthController) GetStatus() { + middleware.VerifyJwt(a.Ctx) + + if a.Ctx.IsStopped() { + return + } + + a.respondJSON(&response.AuthStatusResponse{Status: true}) +} diff --git a/controller/response/auth_status.go b/controller/response/auth_status.go new file mode 100644 index 0000000..b560c90 --- /dev/null +++ b/controller/response/auth_status.go @@ -0,0 +1,5 @@ +package response + +type AuthStatusResponse struct { + Status bool `json:"status"` +}