Use sql to generate jwt, rather than custom haskell
This commit is contained in:
@@ -19,6 +19,7 @@ import PostgREST.ApiRequest (ApiRequest(..), ContentType(..),
|
||||
import PostgREST.Auth (claimsToSQL, JWTAttempt(..))
|
||||
import PostgREST.Config (AppConfig (..), corsPolicy)
|
||||
import PostgREST.Error (errResponse)
|
||||
import PostgREST.QueryBuilder (pgFmtLit)
|
||||
|
||||
import Protolude hiding (concat, null)
|
||||
|
||||
@@ -45,6 +46,10 @@ runWithClaims conf eClaims app req =
|
||||
]
|
||||
(toS $ "{\"message\":\""<>message<>"\"}")
|
||||
|
||||
exposeSecretToSQL :: Maybe Text -> H.Transaction ()
|
||||
exposeSecretToSQL mS = do
|
||||
for_ mS $ \s ->
|
||||
H.sql $ "set local postgrest.jwt_secret = " <> toS (pgFmtLit s) <> ";"
|
||||
|
||||
defaultMiddle :: Application -> Application
|
||||
defaultMiddle =
|
||||
|
||||
Reference in New Issue
Block a user