Set request.jwt.claim.*

This commit is contained in:
Joe Nelson
2016-10-17 22:32:36 -07:00
parent 5d904dfd66
commit c6cd8145eb
4 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ claimsToSQL claims = roleStmts <> varStmts
roleStmts = maybeToList $
(\r -> "set local role " <> r <> ";") . toS . valueToVariable <$> M.lookup "role" claims
varStmts = map setVar $ M.toList (M.delete "role" claims)
setVar (k, val) = "set local " <> toS (pgFmtIdent $ "postgrest.claims." <> k)
setVar (k, val) = "set local " <> toS (pgFmtIdent $ "request.jwt.claim." <> k)
<> " = " <> toS (valueToVariable val) <> ";"
valueToVariable = pgFmtLit . unquoted