Add set schema to middleware

Fix #828, breaking change: computed columns now only work if they are on
the config schema.

Fix #835, tests now not depend on the search_path of the
postgrest_test_authenticator.
This commit is contained in:
steve-chavez
2018-01-10 09:50:20 -05:00
committed by Steve Chávez
parent f9e770b583
commit 85d9feeeab
7 changed files with 24 additions and 20 deletions
+1 -2
View File
@@ -4,7 +4,6 @@ set client_min_messages to warning;
DROP SCHEMA IF EXISTS jwt CASCADE;
CREATE SCHEMA jwt;
CREATE OR REPLACE FUNCTION jwt.url_encode(data bytea) RETURNS text LANGUAGE sql AS $$
SELECT translate(encode(data, 'base64'), E'+/=\n', '-_');
$$;
@@ -31,7 +30,7 @@ WITH
WHEN algorithm = 'HS384' THEN 'sha384'
WHEN algorithm = 'HS512' THEN 'sha512'
ELSE '' END) -- hmac throws error
SELECT jwt.url_encode(hmac(signables, secret, (select * FROM alg)));
SELECT jwt.url_encode(public.hmac(signables, secret, (select * FROM alg)));
$$;