aboutsummaryrefslogtreecommitdiffstats
path: root/lib/G4fClient/Core.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-02-21 20:48:28 +0100
committertv <tv@krebsco.de>2026-02-21 22:22:17 +0100
commit296927352a58c929c855dd300b95274cc3b5f240 (patch)
treee5aab634c3c3ba4c13a4404fa554b805d21564cd /lib/G4fClient/Core.hs
parentc08122e28eca9df17570cac186cc5cb23f044cf6 (diff)
add G4fClient.Core.AuthBasicHTTPBearer
Diffstat (limited to 'lib/G4fClient/Core.hs')
-rw-r--r--lib/G4fClient/Core.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/G4fClient/Core.hs b/lib/G4fClient/Core.hs
index 72756be..3bdbd18 100644
--- a/lib/G4fClient/Core.hs
+++ b/lib/G4fClient/Core.hs
@@ -116,6 +116,19 @@ newConfig = do
, configQueryExtraUnreserved = ""
}
+-- * AuthBasicHTTPBearer
+
+-- |
+newtype AuthBasicHTTPBearer = AuthBasicHTTPBearer T.Text
+ deriving (P.Eq, P.Show)
+
+-- |
+instance AuthMethod AuthBasicHTTPBearer where
+ applyAuthMethod _config (AuthBasicHTTPBearer token) req =
+ pure $
+ addHeader req
+ [ (NH.hAuthorization, BC.pack ("Bearer " <> T.unpack token)) ]
+
-- | updates config use AuthMethod on matching requests
addAuthMethod :: AuthMethod auth => G4fClientConfig -> auth -> G4fClientConfig
addAuthMethod config@G4fClientConfig {configAuthMethods = as} a =