aboutsummaryrefslogtreecommitdiff
path: root/pkg/ext/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/ext/auth.go')
-rw-r--r--pkg/ext/auth.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/ext/auth.go b/pkg/ext/auth.go
index bb6c0a2..b57e86a 100644
--- a/pkg/ext/auth.go
+++ b/pkg/ext/auth.go
@@ -11,6 +11,14 @@ type authService interface {
ValidateToken(token []byte) (bool, error)
}
+func DisableAuthentication(next http.HandlerFunc) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ ctx := r.Context()
+ ctx = context.WithValue(ctx, "disableAuthentication", true)
+ next(w, r.WithContext(ctx))
+ }
+}
+
func Authenticate(auth authService) func(next http.HandlerFunc) http.HandlerFunc {
return func(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {