@pgpm/jwt-claims 0.14.0 → 0.15.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.
package/Makefile CHANGED
@@ -1,5 +1,5 @@
1
- EXTENSION = launchql-jwt-claims
2
- DATA = sql/launchql-jwt-claims--0.9.0.sql
1
+ EXTENSION = pgpm-jwt-claims
2
+ DATA = sql/pgpm-jwt-claims--0.14.0.sql
3
3
 
4
4
  PG_CONFIG = pg_config
5
5
  PGXS := $(shell $(PG_CONFIG) --pgxs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpm/jwt-claims",
3
- "version": "0.14.0",
3
+ "version": "0.15.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": "^1.0.0"
25
25
  },
26
26
  "dependencies": {
27
- "@pgpm/types": "0.14.0",
28
- "@pgpm/verify": "0.14.0"
27
+ "@pgpm/types": "0.15.0",
28
+ "@pgpm/verify": "0.15.0"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
@@ -35,5 +35,5 @@
35
35
  "bugs": {
36
36
  "url": "https://github.com/constructive-io/pgpm-modules/issues"
37
37
  },
38
- "gitHead": "7369638ab084da95b0cb00ec63ad236637f6ebe5"
38
+ "gitHead": "118ac6f810720378fa954e9620abf2516293c148"
39
39
  }
@@ -0,0 +1,8 @@
1
+ # pgpm-jwt-claims extension
2
+ comment = 'pgpm-jwt-claims extension'
3
+ default_version = '0.14.0'
4
+ module_pathname = '$libdir/pgpm-jwt-claims'
5
+ requires = 'plpgsql,uuid-ossp,pgpm-types,pgpm-verify'
6
+ relocatable = false
7
+ superuser = false
8
+
package/pgpm.plan CHANGED
@@ -1,6 +1,6 @@
1
1
  %syntax-version=1.0.0
2
- %project=launchql-jwt-claims
3
- %uri=launchql-jwt-claims
2
+ %project=pgpm-jwt-claims
3
+ %uri=pgpm-jwt-claims
4
4
 
5
5
  schemas/ctx/schema 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/ctx/schema
6
6
  schemas/ctx/procedures/ip_address [schemas/ctx/schema] 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/ctx/procedures/ip_address
@@ -1,4 +1,4 @@
1
- \echo Use "CREATE EXTENSION launchql-jwt-claims" to load this file. \quit
1
+ \echo Use "CREATE EXTENSION pgpm-jwt-claims" to load this file. \quit
2
2
  CREATE SCHEMA ctx;
3
3
 
4
4
  GRANT USAGE ON SCHEMA ctx TO authenticated, anonymous;
@@ -6,20 +6,6 @@ GRANT USAGE ON SCHEMA ctx TO authenticated, anonymous;
6
6
  ALTER DEFAULT PRIVILEGES IN SCHEMA ctx
7
7
  GRANT EXECUTE ON FUNCTIONS TO authenticated;
8
8
 
9
- CREATE SCHEMA jwt_public;
10
-
11
- GRANT USAGE ON SCHEMA jwt_public TO authenticated, anonymous;
12
-
13
- ALTER DEFAULT PRIVILEGES IN SCHEMA jwt_public
14
- GRANT EXECUTE ON FUNCTIONS TO authenticated;
15
-
16
- CREATE SCHEMA jwt_private;
17
-
18
- GRANT USAGE ON SCHEMA jwt_private TO authenticated, anonymous;
19
-
20
- ALTER DEFAULT PRIVILEGES IN SCHEMA jwt_private
21
- GRANT EXECUTE ON FUNCTIONS TO authenticated;
22
-
23
9
  CREATE FUNCTION ctx.ip_address() RETURNS inet AS $EOFCODE$
24
10
  SELECT nullif(current_setting('jwt.claims.ip_address', true), '')::inet;
25
11
  $EOFCODE$ LANGUAGE sql STABLE;
@@ -36,7 +22,7 @@ CREATE FUNCTION ctx.user_id() RETURNS uuid AS $EOFCODE$
36
22
  SELECT nullif(current_setting('jwt.claims.user_id', true), '')::uuid;
37
23
  $EOFCODE$ LANGUAGE sql STABLE;
38
24
 
39
- DO $LQLMIGRATION$
25
+ DO $EOFCODE$
40
26
  DECLARE
41
27
  BEGIN
42
28
  EXECUTE format('CREATE FUNCTION ctx.security_definer() returns text as $FUNC$
@@ -48,11 +34,19 @@ LANGUAGE ''sql'';', current_user);
48
34
  $FUNC$
49
35
  LANGUAGE ''sql'';', current_user);
50
36
  END;
51
- $LQLMIGRATION$;
37
+ $EOFCODE$;
52
38
 
53
39
  GRANT EXECUTE ON FUNCTION ctx.security_definer() TO PUBLIC;
40
+
54
41
  GRANT EXECUTE ON FUNCTION ctx.is_security_definer() TO PUBLIC;
55
42
 
43
+ CREATE SCHEMA jwt_public;
44
+
45
+ GRANT USAGE ON SCHEMA jwt_public TO authenticated, anonymous;
46
+
47
+ ALTER DEFAULT PRIVILEGES IN SCHEMA jwt_public
48
+ GRANT EXECUTE ON FUNCTIONS TO authenticated;
49
+
56
50
  CREATE FUNCTION jwt_public.current_user_id() RETURNS uuid AS $EOFCODE$
57
51
  DECLARE
58
52
  v_identifier_id uuid;
@@ -93,10 +87,6 @@ BEGIN
93
87
  END;
94
88
  $EOFCODE$ LANGUAGE plpgsql STABLE;
95
89
 
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
-
100
90
  CREATE FUNCTION jwt_public.current_user_agent() RETURNS text AS $EOFCODE$
101
91
  DECLARE
102
92
  v_uagent text;
@@ -117,46 +107,57 @@ BEGIN
117
107
  END;
118
108
  $EOFCODE$ LANGUAGE plpgsql STABLE;
119
109
 
120
- CREATE FUNCTION jwt_private.current_database_id() RETURNS uuid AS $EOFCODE$
110
+ CREATE FUNCTION jwt_public.current_origin() RETURNS origin AS $EOFCODE$
111
+ SELECT nullif(current_setting('jwt.claims.origin', true), '')::origin;
112
+ $EOFCODE$ LANGUAGE sql STABLE;
113
+
114
+ CREATE FUNCTION jwt_public.current_group_ids() RETURNS uuid[] AS $EOFCODE$
121
115
  DECLARE
122
- v_identifier_id uuid;
116
+ v_identifier_ids uuid[];
123
117
  BEGIN
124
- IF current_setting('jwt.claims.database_id', TRUE)
118
+ IF current_setting('jwt.claims.group_ids', TRUE)
125
119
  IS NOT NULL THEN
126
120
  BEGIN
127
- v_identifier_id = current_setting('jwt.claims.database_id', TRUE)::uuid;
121
+ v_identifier_ids = current_setting('jwt.claims.group_ids', TRUE)::uuid[];
128
122
  EXCEPTION
129
123
  WHEN OTHERS THEN
130
124
  RAISE NOTICE 'Invalid UUID value';
131
- RETURN NULL;
125
+ RETURN ARRAY[]::uuid[];
132
126
  END;
133
- RETURN v_identifier_id;
127
+ RETURN v_identifier_ids;
134
128
  ELSE
135
- RETURN NULL;
129
+ RETURN ARRAY[]::uuid[];
136
130
  END IF;
137
131
  END;
138
132
  $EOFCODE$ LANGUAGE plpgsql STABLE;
139
133
 
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;
134
+ CREATE SCHEMA jwt_private;
143
135
 
144
- CREATE FUNCTION jwt_public.current_group_ids() RETURNS uuid[] AS $EOFCODE$
136
+ GRANT USAGE ON SCHEMA jwt_private TO authenticated, anonymous;
137
+
138
+ ALTER DEFAULT PRIVILEGES IN SCHEMA jwt_private
139
+ GRANT EXECUTE ON FUNCTIONS TO authenticated;
140
+
141
+ CREATE FUNCTION jwt_private.current_database_id() RETURNS uuid AS $EOFCODE$
145
142
  DECLARE
146
- v_identifier_ids uuid[];
143
+ v_identifier_id uuid;
147
144
  BEGIN
148
- IF current_setting('jwt.claims.group_ids', TRUE)
145
+ IF current_setting('jwt.claims.database_id', TRUE)
149
146
  IS NOT NULL THEN
150
147
  BEGIN
151
- v_identifier_ids = current_setting('jwt.claims.group_ids', TRUE)::uuid[];
148
+ v_identifier_id = current_setting('jwt.claims.database_id', TRUE)::uuid;
152
149
  EXCEPTION
153
150
  WHEN OTHERS THEN
154
151
  RAISE NOTICE 'Invalid UUID value';
155
- RETURN ARRAY[]::uuid[];
152
+ RETURN NULL;
156
153
  END;
157
- RETURN v_identifier_ids;
154
+ RETURN v_identifier_id;
158
155
  ELSE
159
- RETURN ARRAY[]::uuid[];
156
+ RETURN NULL;
160
157
  END IF;
161
158
  END;
162
159
  $EOFCODE$ LANGUAGE plpgsql STABLE;
160
+
161
+ CREATE FUNCTION jwt_private.current_token_id() RETURNS uuid AS $EOFCODE$
162
+ SELECT nullif(current_setting('jwt.claims.token_id', true), '')::uuid;
163
+ $EOFCODE$ LANGUAGE sql STABLE;
@@ -1,8 +0,0 @@
1
- # launchql-jwt-claims extension
2
- comment = 'launchql-jwt-claims extension'
3
- default_version = '0.9.0'
4
- module_pathname = '$libdir/launchql-jwt-claims'
5
- requires = 'plpgsql,uuid-ossp,launchql-types,launchql-verify'
6
- relocatable = false
7
- superuser = false
8
-