From 296927352a58c929c855dd300b95274cc3b5f240 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 21 Feb 2026 20:48:28 +0100 Subject: add G4fClient.Core.AuthBasicHTTPBearer --- lib/G4fClient/Core.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/G4fClient/Core.hs') 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 = -- cgit v1.2.3