@pgpm/jwt-claims 0.12.0 → 0.12.2
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.
- package/deploy/schemas/ctx/procedures/ip_address.sql +2 -1
- package/deploy/schemas/ctx/procedures/origin.sql +2 -1
- package/deploy/schemas/ctx/procedures/security_definer.sql +1 -0
- package/deploy/schemas/ctx/procedures/user_agent.sql +2 -1
- package/deploy/schemas/ctx/procedures/user_id.sql +2 -1
- package/deploy/schemas/ctx/schema.sql +1 -0
- package/deploy/schemas/jwt_private/procedures/current_token_id.sql +1 -0
- package/deploy/schemas/jwt_public/procedures/current_origin.sql +2 -1
- package/launchql-jwt-claims.control +2 -2
- package/package.json +3 -3
- package/pgpm.plan +10 -2
- package/revert/schemas/ctx/procedures/ip_address.sql +1 -0
- package/revert/schemas/ctx/procedures/origin.sql +1 -0
- package/revert/schemas/ctx/procedures/security_definer.sql +2 -0
- package/revert/schemas/ctx/procedures/user_agent.sql +1 -0
- package/revert/schemas/ctx/procedures/user_id.sql +1 -0
- package/revert/schemas/ctx/schema.sql +1 -0
- package/revert/schemas/jwt_private/procedures/current_token_id.sql +1 -0
- package/revert/schemas/jwt_public/procedures/current_origin.sql +1 -0
- package/sql/launchql-jwt-claims--0.9.0.sql +49 -1
- package/verify/schemas/ctx/procedures/ip_address.sql +1 -0
- package/verify/schemas/ctx/procedures/origin.sql +1 -0
- package/verify/schemas/ctx/procedures/security_definer.sql +2 -0
- package/verify/schemas/ctx/procedures/user_agent.sql +1 -0
- package/verify/schemas/ctx/procedures/user_id.sql +1 -0
- package/verify/schemas/ctx/schema.sql +2 -1
- package/verify/schemas/jwt_private/procedures/current_token_id.sql +1 -0
- package/verify/schemas/jwt_public/procedures/current_origin.sql +1 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
comment = 'launchql-jwt-claims extension'
|
|
3
3
|
default_version = '0.9.0'
|
|
4
4
|
module_pathname = '$libdir/launchql-jwt-claims'
|
|
5
|
-
requires = 'plpgsql,uuid-ossp,launchql-verify'
|
|
5
|
+
requires = 'plpgsql,uuid-ossp,launchql-types,launchql-verify'
|
|
6
6
|
relocatable = false
|
|
7
7
|
superuser = false
|
|
8
|
-
|
|
8
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpm/jwt-claims",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "JWT claim handling and validation functions",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"pgpm": "^0.2.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@pgpm/types": "0.12.
|
|
27
|
+
"@pgpm/types": "0.12.2",
|
|
28
28
|
"@pgpm/verify": "0.12.0"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"bugs": {
|
|
36
36
|
"url": "https://github.com/launchql/pgpm-modules/issues"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "880c1b99631ac536288584ace0ac3dd40300f17e"
|
|
39
39
|
}
|
package/pgpm.plan
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
%project=launchql-jwt-claims
|
|
3
3
|
%uri=launchql-jwt-claims
|
|
4
4
|
|
|
5
|
+
schemas/ctx/schema 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/ctx/schema
|
|
6
|
+
schemas/ctx/procedures/ip_address [schemas/ctx/schema] 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/ctx/procedures/ip_address
|
|
7
|
+
schemas/ctx/procedures/origin [schemas/ctx/schema] 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/ctx/procedures/origin
|
|
8
|
+
schemas/ctx/procedures/user_agent [schemas/ctx/schema] 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/ctx/procedures/user_agent
|
|
9
|
+
schemas/ctx/procedures/user_id [schemas/ctx/schema] 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/ctx/procedures/user_id
|
|
10
|
+
schemas/ctx/procedures/security_definer [schemas/ctx/schema] 2021-04-20T04:04:08Z Dan Lynch <dlynch@Dans-MBP-3> # add schemas/ctx/procedures/security_definer
|
|
5
11
|
schemas/jwt_public/schema 2020-12-17T06:47:29Z Dan Lynch <dlynch@Dans-MBP-3> # add schemas/jwt_public/schema
|
|
6
|
-
schemas/jwt_private/schema 2020-12-17T06:47:34Z Dan Lynch <dlynch@Dans-MBP-3> # add schemas/jwt_private/schema
|
|
7
12
|
schemas/jwt_public/procedures/current_user_id [schemas/jwt_public/schema] 2020-12-17T06:48:56Z Dan Lynch <dlynch@Dans-MBP-3> # add schemas/jwt_public/procedures/current_user_id
|
|
8
13
|
schemas/jwt_public/procedures/current_ip_address [schemas/jwt_public/schema] 2020-12-17T23:19:17Z Dan Lynch <dlynch@Dans-MBP-3> # add schemas/jwt_public/procedures/current_ip_address
|
|
9
14
|
schemas/jwt_public/procedures/current_user_agent [schemas/jwt_public/schema] 2020-12-17T23:20:04Z Dan Lynch <dlynch@Dans-MBP-3> # add schemas/jwt_public/procedures/current_user_agent
|
|
10
|
-
schemas/
|
|
15
|
+
schemas/jwt_public/procedures/current_origin [schemas/jwt_public/schema] 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/jwt_public/procedures/current_origin
|
|
11
16
|
schemas/jwt_public/procedures/current_group_ids [schemas/jwt_public/schema] 2020-12-17T23:30:50Z Dan Lynch <dlynch@Dans-MBP-3> # add schemas/jwt_public/procedures/current_group_ids
|
|
17
|
+
schemas/jwt_private/schema 2020-12-17T06:47:34Z Dan Lynch <dlynch@Dans-MBP-3> # add schemas/jwt_private/schema
|
|
18
|
+
schemas/jwt_private/procedures/current_database_id [schemas/jwt_private/schema] 2020-12-17T23:22:28Z Dan Lynch <dlynch@Dans-MBP-3> # add schemas/jwt_private/procedures/current_database_id
|
|
19
|
+
schemas/jwt_private/procedures/current_token_id [schemas/jwt_private/schema] 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/jwt_private/procedures/current_token_id
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
\echo Use "CREATE EXTENSION launchql-jwt-claims" to load this file. \quit
|
|
2
|
+
CREATE SCHEMA ctx;
|
|
3
|
+
|
|
4
|
+
GRANT USAGE ON SCHEMA ctx TO authenticated, anonymous;
|
|
5
|
+
|
|
6
|
+
ALTER DEFAULT PRIVILEGES IN SCHEMA ctx
|
|
7
|
+
GRANT EXECUTE ON FUNCTIONS TO authenticated;
|
|
8
|
+
|
|
2
9
|
CREATE SCHEMA jwt_public;
|
|
3
10
|
|
|
4
11
|
GRANT USAGE ON SCHEMA jwt_public TO authenticated, anonymous;
|
|
@@ -13,6 +20,39 @@ GRANT USAGE ON SCHEMA jwt_private TO authenticated, anonymous;
|
|
|
13
20
|
ALTER DEFAULT PRIVILEGES IN SCHEMA jwt_private
|
|
14
21
|
GRANT EXECUTE ON FUNCTIONS TO authenticated;
|
|
15
22
|
|
|
23
|
+
CREATE FUNCTION ctx.ip_address() RETURNS inet AS $EOFCODE$
|
|
24
|
+
SELECT nullif(current_setting('jwt.claims.ip_address', true), '')::inet;
|
|
25
|
+
$EOFCODE$ LANGUAGE sql STABLE;
|
|
26
|
+
|
|
27
|
+
CREATE FUNCTION ctx.origin() RETURNS origin AS $EOFCODE$
|
|
28
|
+
SELECT nullif(current_setting('jwt.claims.origin', true), '')::origin;
|
|
29
|
+
$EOFCODE$ LANGUAGE sql STABLE;
|
|
30
|
+
|
|
31
|
+
CREATE FUNCTION ctx.user_agent() RETURNS text AS $EOFCODE$
|
|
32
|
+
SELECT nullif(current_setting('jwt.claims.user_agent', true), '');
|
|
33
|
+
$EOFCODE$ LANGUAGE sql STABLE;
|
|
34
|
+
|
|
35
|
+
CREATE FUNCTION ctx.user_id() RETURNS uuid AS $EOFCODE$
|
|
36
|
+
SELECT nullif(current_setting('jwt.claims.user_id', true), '')::uuid;
|
|
37
|
+
$EOFCODE$ LANGUAGE sql STABLE;
|
|
38
|
+
|
|
39
|
+
DO $LQLMIGRATION$
|
|
40
|
+
DECLARE
|
|
41
|
+
BEGIN
|
|
42
|
+
EXECUTE format('CREATE FUNCTION ctx.security_definer() returns text as $FUNC$
|
|
43
|
+
SELECT ''%s'';
|
|
44
|
+
$FUNC$
|
|
45
|
+
LANGUAGE ''sql'';', current_user);
|
|
46
|
+
EXECUTE format('CREATE FUNCTION ctx.is_security_definer() returns bool as $FUNC$
|
|
47
|
+
SELECT ''%s'' = current_user;
|
|
48
|
+
$FUNC$
|
|
49
|
+
LANGUAGE ''sql'';', current_user);
|
|
50
|
+
END;
|
|
51
|
+
$LQLMIGRATION$;
|
|
52
|
+
|
|
53
|
+
GRANT EXECUTE ON FUNCTION ctx.security_definer() TO PUBLIC;
|
|
54
|
+
GRANT EXECUTE ON FUNCTION ctx.is_security_definer() TO PUBLIC;
|
|
55
|
+
|
|
16
56
|
CREATE FUNCTION jwt_public.current_user_id() RETURNS uuid AS $EOFCODE$
|
|
17
57
|
DECLARE
|
|
18
58
|
v_identifier_id uuid;
|
|
@@ -53,6 +93,10 @@ BEGIN
|
|
|
53
93
|
END;
|
|
54
94
|
$EOFCODE$ LANGUAGE plpgsql STABLE;
|
|
55
95
|
|
|
96
|
+
CREATE FUNCTION jwt_public.current_origin() RETURNS origin AS $EOFCODE$
|
|
97
|
+
SELECT nullif(current_setting('jwt.claims.origin', TRUE), '')::origin;
|
|
98
|
+
$EOFCODE$ LANGUAGE sql STABLE;
|
|
99
|
+
|
|
56
100
|
CREATE FUNCTION jwt_public.current_user_agent() RETURNS text AS $EOFCODE$
|
|
57
101
|
DECLARE
|
|
58
102
|
v_uagent text;
|
|
@@ -93,6 +137,10 @@ BEGIN
|
|
|
93
137
|
END;
|
|
94
138
|
$EOFCODE$ LANGUAGE plpgsql STABLE;
|
|
95
139
|
|
|
140
|
+
CREATE FUNCTION jwt_private.current_token_id() RETURNS uuid AS $EOFCODE$
|
|
141
|
+
SELECT nullif(current_setting('jwt.claims.token_id', TRUE), '')::uuid;
|
|
142
|
+
$EOFCODE$ LANGUAGE sql STABLE;
|
|
143
|
+
|
|
96
144
|
CREATE FUNCTION jwt_public.current_group_ids() RETURNS uuid[] AS $EOFCODE$
|
|
97
145
|
DECLARE
|
|
98
146
|
v_identifier_ids uuid[];
|
|
@@ -111,4 +159,4 @@ BEGIN
|
|
|
111
159
|
RETURN ARRAY[]::uuid[];
|
|
112
160
|
END IF;
|
|
113
161
|
END;
|
|
114
|
-
$EOFCODE$ LANGUAGE plpgsql STABLE;
|
|
162
|
+
$EOFCODE$ LANGUAGE plpgsql STABLE;
|