diff options
Diffstat (limited to 'lib')
| -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 = |
