@pgpm/jwt-claims 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/deploy/schemas/ctx/procedures/ip_address.sql +14 -0
  2. package/deploy/schemas/ctx/procedures/origin.sql +14 -0
  3. package/deploy/schemas/ctx/procedures/security_definer.sql +23 -0
  4. package/deploy/schemas/ctx/procedures/user_agent.sql +14 -0
  5. package/deploy/schemas/ctx/procedures/user_id.sql +14 -0
  6. package/deploy/schemas/ctx/schema.sql +15 -0
  7. package/deploy/schemas/jwt_private/procedures/current_token_id.sql +14 -0
  8. package/deploy/schemas/jwt_public/procedures/current_origin.sql +14 -0
  9. package/package.json +4 -4
  10. package/revert/schemas/ctx/procedures/ip_address.sql +7 -0
  11. package/revert/schemas/ctx/procedures/origin.sql +7 -0
  12. package/revert/schemas/ctx/procedures/security_definer.sql +7 -0
  13. package/revert/schemas/ctx/procedures/user_agent.sql +7 -0
  14. package/revert/schemas/ctx/procedures/user_id.sql +7 -0
  15. package/revert/schemas/ctx/schema.sql +7 -0
  16. package/revert/schemas/jwt_private/procedures/current_token_id.sql +7 -0
  17. package/revert/schemas/jwt_public/procedures/current_origin.sql +7 -0
  18. package/verify/schemas/ctx/procedures/ip_address.sql +7 -0
  19. package/verify/schemas/ctx/procedures/origin.sql +7 -0
  20. package/verify/schemas/ctx/procedures/security_definer.sql +7 -0
  21. package/verify/schemas/ctx/procedures/user_agent.sql +7 -0
  22. package/verify/schemas/ctx/procedures/user_id.sql +7 -0
  23. package/verify/schemas/ctx/schema.sql +7 -0
  24. package/verify/schemas/jwt_private/procedures/current_token_id.sql +7 -0
  25. package/verify/schemas/jwt_public/procedures/current_origin.sql +7 -0
@@ -0,0 +1,14 @@
1
+ -- Deploy schemas/ctx/procedures/ip_address to pg
2
+
3
+ -- requires: schemas/ctx/schema
4
+
5
+ BEGIN;
6
+
7
+ CREATE FUNCTION ctx.ip_address()
8
+ RETURNS inet
9
+ AS $$
10
+ SELECT nullif(current_setting('jwt.claims.ip_address', true), '')::inet;
11
+ $$
12
+ LANGUAGE 'sql' STABLE;
13
+
14
+ COMMIT;
@@ -0,0 +1,14 @@
1
+ -- Deploy schemas/ctx/procedures/origin to pg
2
+
3
+ -- requires: schemas/ctx/schema
4
+
5
+ BEGIN;
6
+
7
+ CREATE FUNCTION ctx.origin()
8
+ RETURNS origin
9
+ AS $$
10
+ SELECT nullif(current_setting('jwt.claims.origin', true), '')::origin;
11
+ $$
12
+ LANGUAGE 'sql' STABLE;
13
+
14
+ COMMIT;
@@ -0,0 +1,23 @@
1
+ -- Deploy schemas/ctx/procedures/security_definer to pg
2
+
3
+ -- requires: schemas/ctx/schema
4
+
5
+ BEGIN;
6
+
7
+ DO $LQLMIGRATION$
8
+ DECLARE
9
+ BEGIN
10
+ EXECUTE format('CREATE FUNCTION ctx.security_definer() returns text as $FUNC$
11
+ SELECT ''%s'';
12
+ $FUNC$
13
+ LANGUAGE ''sql'';', current_user);
14
+ EXECUTE format('CREATE FUNCTION ctx.is_security_definer() returns bool as $FUNC$
15
+ SELECT ''%s'' = current_user;
16
+ $FUNC$
17
+ LANGUAGE ''sql'';', current_user);
18
+ END;
19
+ $LQLMIGRATION$;
20
+ GRANT EXECUTE ON FUNCTION ctx.security_definer() TO PUBLIC;
21
+ GRANT EXECUTE ON FUNCTION ctx.is_security_definer() TO PUBLIC;
22
+
23
+ COMMIT;
@@ -0,0 +1,14 @@
1
+ -- Deploy schemas/ctx/procedures/user_agent to pg
2
+
3
+ -- requires: schemas/ctx/schema
4
+
5
+ BEGIN;
6
+
7
+ CREATE FUNCTION ctx.user_agent()
8
+ RETURNS text
9
+ AS $$
10
+ SELECT nullif(current_setting('jwt.claims.user_agent', true), '');
11
+ $$
12
+ LANGUAGE 'sql' STABLE;
13
+
14
+ COMMIT;
@@ -0,0 +1,14 @@
1
+ -- Deploy schemas/ctx/procedures/user_id to pg
2
+
3
+ -- requires: schemas/ctx/schema
4
+
5
+ BEGIN;
6
+
7
+ CREATE FUNCTION ctx.user_id()
8
+ RETURNS uuid
9
+ AS $$
10
+ SELECT nullif(current_setting('jwt.claims.user_id', true), '')::uuid;
11
+ $$
12
+ LANGUAGE 'sql' STABLE;
13
+
14
+ COMMIT;
@@ -0,0 +1,15 @@
1
+ -- Deploy schemas/ctx/schema to pg
2
+
3
+
4
+ BEGIN;
5
+
6
+ CREATE SCHEMA ctx;
7
+
8
+ GRANT USAGE ON SCHEMA ctx
9
+ TO authenticated, anonymous;
10
+
11
+ ALTER DEFAULT PRIVILEGES IN SCHEMA ctx
12
+ GRANT EXECUTE ON FUNCTIONS
13
+ TO authenticated;
14
+
15
+ COMMIT;
@@ -0,0 +1,14 @@
1
+ -- Deploy schemas/jwt_private/procedures/current_token_id to pg
2
+
3
+ -- requires: schemas/jwt_private/schema
4
+
5
+ BEGIN;
6
+
7
+ CREATE FUNCTION jwt_private.current_token_id()
8
+ RETURNS uuid
9
+ AS $$
10
+ SELECT nullif(current_setting('jwt.claims.token_id', true), '')::uuid;
11
+ $$
12
+ LANGUAGE 'sql' STABLE;
13
+
14
+ COMMIT;
@@ -0,0 +1,14 @@
1
+ -- Deploy schemas/jwt_public/procedures/current_origin to pg
2
+
3
+ -- requires: schemas/jwt_public/schema
4
+
5
+ BEGIN;
6
+
7
+ CREATE FUNCTION jwt_public.current_origin()
8
+ RETURNS origin
9
+ AS $$
10
+ SELECT nullif(current_setting('jwt.claims.origin', true), '')::origin;
11
+ $$
12
+ LANGUAGE 'sql' STABLE;
13
+
14
+ COMMIT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpm/jwt-claims",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "JWT claim handling and validation functions",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "contributors": [
@@ -24,8 +24,8 @@
24
24
  "pgpm": "^0.2.0"
25
25
  },
26
26
  "dependencies": {
27
- "@pgpm/types": "0.8.0",
28
- "@pgpm/verify": "0.8.0"
27
+ "@pgpm/types": "0.9.0",
28
+ "@pgpm/verify": "0.9.0"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
@@ -35,5 +35,5 @@
35
35
  "bugs": {
36
36
  "url": "https://github.com/launchql/pgpm-modules/issues"
37
37
  },
38
- "gitHead": "76daa8923128fd8f93a8fd5303239ec998c0bf98"
38
+ "gitHead": "7cb34c75176e820a490de0442814425303a3ab1f"
39
39
  }
@@ -0,0 +1,7 @@
1
+ -- Revert schemas/ctx/procedures/ip_address from pg
2
+
3
+ BEGIN;
4
+
5
+ DROP FUNCTION ctx.ip_address;
6
+
7
+ COMMIT;
@@ -0,0 +1,7 @@
1
+ -- Revert schemas/ctx/procedures/origin from pg
2
+
3
+ BEGIN;
4
+
5
+ DROP FUNCTION ctx.origin;
6
+
7
+ COMMIT;
@@ -0,0 +1,7 @@
1
+ -- Revert schemas/ctx/procedures/security_definer from pg
2
+
3
+ BEGIN;
4
+
5
+ DROP FUNCTION ctx.security_definer;
6
+
7
+ COMMIT;
@@ -0,0 +1,7 @@
1
+ -- Revert schemas/ctx/procedures/user_agent from pg
2
+
3
+ BEGIN;
4
+
5
+ DROP FUNCTION ctx.user_agent;
6
+
7
+ COMMIT;
@@ -0,0 +1,7 @@
1
+ -- Revert schemas/ctx/procedures/user_id from pg
2
+
3
+ BEGIN;
4
+
5
+ DROP FUNCTION ctx.user_id;
6
+
7
+ COMMIT;
@@ -0,0 +1,7 @@
1
+ -- Revert schemas/ctx/schema from pg
2
+
3
+ BEGIN;
4
+
5
+ DROP SCHEMA ctx;
6
+
7
+ COMMIT;
@@ -0,0 +1,7 @@
1
+ -- Revert schemas/jwt_private/procedures/current_token_id from pg
2
+
3
+ BEGIN;
4
+
5
+ DROP FUNCTION jwt_private.current_token_id;
6
+
7
+ COMMIT;
@@ -0,0 +1,7 @@
1
+ -- Revert schemas/jwt_public/procedures/current_origin from pg
2
+
3
+ BEGIN;
4
+
5
+ DROP FUNCTION jwt_public.current_origin;
6
+
7
+ COMMIT;
@@ -0,0 +1,7 @@
1
+ -- Verify schemas/ctx/procedures/ip_address on pg
2
+
3
+ BEGIN;
4
+
5
+ SELECT verify_function ('ctx.ip_address');
6
+
7
+ ROLLBACK;
@@ -0,0 +1,7 @@
1
+ -- Verify schemas/ctx/procedures/origin on pg
2
+
3
+ BEGIN;
4
+
5
+ SELECT verify_function ('ctx.origin');
6
+
7
+ ROLLBACK;
@@ -0,0 +1,7 @@
1
+ -- Verify schemas/ctx/procedures/security_definer on pg
2
+
3
+ BEGIN;
4
+
5
+ SELECT verify_function ('ctx.security_definer');
6
+
7
+ ROLLBACK;
@@ -0,0 +1,7 @@
1
+ -- Verify schemas/ctx/procedures/user_agent on pg
2
+
3
+ BEGIN;
4
+
5
+ SELECT verify_function ('ctx.user_agent');
6
+
7
+ ROLLBACK;
@@ -0,0 +1,7 @@
1
+ -- Verify schemas/ctx/procedures/user_id on pg
2
+
3
+ BEGIN;
4
+
5
+ SELECT verify_function ('ctx.user_id');
6
+
7
+ ROLLBACK;
@@ -0,0 +1,7 @@
1
+ -- Verify schemas/ctx/schema on pg
2
+
3
+ BEGIN;
4
+
5
+ SELECT verify_schema ('ctx');
6
+
7
+ ROLLBACK;
@@ -0,0 +1,7 @@
1
+ -- Verify schemas/jwt_private/procedures/current_token_id on pg
2
+
3
+ BEGIN;
4
+
5
+ SELECT verify_function ('jwt_private.current_token_id');
6
+
7
+ ROLLBACK;
@@ -0,0 +1,7 @@
1
+ -- Verify schemas/jwt_public/procedures/current_origin on pg
2
+
3
+ BEGIN;
4
+
5
+ SELECT verify_function ('jwt_public.current_origin');
6
+
7
+ ROLLBACK;