WIP: add argument for custom pre-request handler
This commit is contained in:
Vendored
+1
-1
@@ -4,7 +4,7 @@ GRANT USAGE ON SCHEMA
|
||||
, test
|
||||
, jwt
|
||||
, "تست"
|
||||
TO postgrest_test_anonymous;
|
||||
TO postgrest_test_anonymous, bad_role;
|
||||
|
||||
-- Schema test objects
|
||||
SET search_path = test, "تست", pg_catalog;
|
||||
|
||||
Vendored
+3
-2
@@ -1,7 +1,8 @@
|
||||
DROP ROLE IF EXISTS postgrest_test_authenticator, postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author;
|
||||
DROP ROLE IF EXISTS postgrest_test_authenticator, postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author, bad_role;
|
||||
CREATE ROLE postgrest_test_authenticator WITH login noinherit;
|
||||
CREATE ROLE postgrest_test_anonymous;
|
||||
CREATE ROLE postgrest_test_default_role;
|
||||
CREATE ROLE postgrest_test_author;
|
||||
CREATE ROLE bad_role;
|
||||
|
||||
GRANT postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author TO postgrest_test_authenticator;
|
||||
GRANT postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author, bad_role TO postgrest_test_authenticator;
|
||||
|
||||
Vendored
+8
@@ -237,6 +237,14 @@ SELECT jwt.sign(
|
||||
) r;
|
||||
$$;
|
||||
|
||||
create function block_bad_role() returns void
|
||||
language plpgsql as $$
|
||||
begin
|
||||
if current_role = 'bad_role' then
|
||||
raise invalid_password using message = 'role is not allowed';
|
||||
end if;
|
||||
end
|
||||
$$;
|
||||
|
||||
--
|
||||
-- Name: reveal_big_jwt(); Type: FUNCTION; Schema: test; Owner: -
|
||||
|
||||
Reference in New Issue
Block a user