From 90e5f7ae45e91c8c6772a92b5353dd9530cd8818 Mon Sep 17 00:00:00 2001 From: Martijn Janssen Date: Mon, 21 Feb 2022 16:05:22 +0100 Subject: [PATCH 1/2] On permission denied show user message accordingly --- connect.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connect.go b/connect.go index 9fde644..624da2f 100644 --- a/connect.go +++ b/connect.go @@ -108,7 +108,8 @@ func callbackController(a *App) gin.HandlerFunc { "token": rawIDToken, }) } else { - c.AbortWithStatus(http.StatusUnauthorized) + c.Writer.WriteString("permission denied") + c.Status(http.StatusUnauthorized) } } } From 4298f6c3b7a9a5bdb680bccc78fdfb97b12f34b9 Mon Sep 17 00:00:00 2001 From: Martijn Janssen Date: Mon, 21 Feb 2022 16:46:25 +0100 Subject: [PATCH 2/2] Resolve golangci-lint error --- connect.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/connect.go b/connect.go index 624da2f..8317bca 100644 --- a/connect.go +++ b/connect.go @@ -108,7 +108,12 @@ func callbackController(a *App) gin.HandlerFunc { "token": rawIDToken, }) } else { - c.Writer.WriteString("permission denied") + _, err := c.Writer.WriteString("permission denied") + if err != nil { + log.Errorf("unable to write response to user") + c.AbortWithStatus(http.StatusUnauthorized) + return + } c.Status(http.StatusUnauthorized) } }