diff options
| author | tv <tv@krebsco.de> | 2026-02-21 20:48:28 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-02-21 22:22:17 +0100 |
| commit | 296927352a58c929c855dd300b95274cc3b5f240 (patch) | |
| tree | e5aab634c3c3ba4c13a4404fa554b805d21564cd | |
| parent | c08122e28eca9df17570cac186cc5cb23f044cf6 (diff) | |
add G4fClient.Core.AuthBasicHTTPBearer
| -rw-r--r-- | lib/G4fClient/Core.hs | 13 |
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 = |
