From 10b45a8dea25277c45fff9a6e26ff941e9ec39fc Mon Sep 17 00:00:00 2001
From: Jens Langhammer <jens.langhammer@beryju.org>
Date: Mon, 19 Apr 2021 18:56:36 +0200
Subject: [PATCH] api: fix 401 responses which should be 403s

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
---
 authentik/api/auth.py | 3 ---
 outpost/pkg/ak/api.go | 4 +++-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/authentik/api/auth.py b/authentik/api/auth.py
index da6a154bf..d25db3629 100644
--- a/authentik/api/auth.py
+++ b/authentik/api/auth.py
@@ -62,6 +62,3 @@ class AuthentikTokenAuthentication(BaseAuthentication):
             return None
 
         return (token.user, None)
-
-    def authenticate_header(self, request: Request) -> str:
-        return "Bearer"
diff --git a/outpost/pkg/ak/api.go b/outpost/pkg/ak/api.go
index 9a9202bbc..d872b6851 100644
--- a/outpost/pkg/ak/api.go
+++ b/outpost/pkg/ak/api.go
@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"math/rand"
 	"net/url"
+	"os"
 	"time"
 
 	"github.com/go-openapi/runtime"
@@ -56,7 +57,8 @@ func NewAPIController(akURL url.URL, token string) *APIController {
 	outposts, err := apiClient.Outposts.OutpostsInstancesList(outposts.NewOutpostsInstancesListParams(), auth)
 
 	if err != nil {
-		log.WithError(err).Panic("Failed to fetch configuration")
+		log.WithError(err).Error("Failed to fetch configuration")
+		os.Exit(1)
 	}
 	outpost := outposts.Payload.Results[0]
 	doGlobalSetup(outpost.Config.(map[string]interface{}))