File tree 3 files changed +11
-8
lines changed
3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 1
1
module Hasura.HTTP
2
2
( wreqOptions
3
3
, HttpException (.. )
4
+ , hdrsToText
4
5
) where
5
6
6
7
import Control.Lens hiding ((.=) )
@@ -12,8 +13,16 @@ import qualified Network.HTTP.Client as HTTP
12
13
import qualified Network.HTTP.Types as HTTP
13
14
import qualified Network.Wreq as Wreq
14
15
16
+ import Data.CaseInsensitive (original )
17
+ import Hasura.Server.Utils (bsToTxt )
15
18
import Hasura.Server.Version (currentVersion )
16
19
20
+ hdrsToText :: [HTTP. Header ] -> [(Text , Text )]
21
+ hdrsToText hdrs =
22
+ [ (bsToTxt $ original hdrName, bsToTxt hdrVal)
23
+ | (hdrName, hdrVal) <- hdrs
24
+ ]
25
+
17
26
wreqOptions :: HTTP. Manager -> [HTTP. Header ] -> Wreq. Options
18
27
wreqOptions manager hdrs =
19
28
Wreq. defaults
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ module Hasura.Server.Auth
22
22
import Control.Exception (try )
23
23
import Control.Lens
24
24
import Data.Aeson
25
- import Data.CaseInsensitive (CI (.. ), original )
26
25
import Data.IORef (newIORef )
27
26
28
27
import qualified Data.Aeson as J
@@ -73,12 +72,6 @@ data AuthMode
73
72
| AMAdminSecretAndJWT ! AdminSecret ! JWTCtx ! (Maybe RoleName )
74
73
deriving (Show , Eq )
75
74
76
- hdrsToText :: [N. Header ] -> [(T. Text , T. Text )]
77
- hdrsToText hdrs =
78
- [ (bsToTxt $ original hdrName, bsToTxt hdrVal)
79
- | (hdrName, hdrVal) <- hdrs
80
- ]
81
-
82
75
mkAuthMode
83
76
:: ( MonadIO m
84
77
, MonadError T. Text m
Original file line number Diff line number Diff line change @@ -183,7 +183,8 @@ processJwt jwtCtx headers mUnAuthRole =
183
183
184
184
withoutAuthZHeader = do
185
185
unAuthRole <- maybe missingAuthzHeader return mUnAuthRole
186
- return $ mkUserInfo unAuthRole $ mkUserVars []
186
+ return $ mkUserInfo unAuthRole $ mkUserVars $ hdrsToText headers
187
+
187
188
missingAuthzHeader =
188
189
throw400 InvalidHeaders " Missing Authorization header in JWT authentication mode"
189
190
You can’t perform that action at this time.
0 commit comments