Skip to content

Commit b033c71

Browse files
committed
fix: update session_state claim attribute from uuid to text
1 parent 6eb3c22 commit b033c71

8 files changed

Lines changed: 115 additions & 57 deletions

File tree

app/schema/schema.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50921,7 +50921,7 @@ type KeycloakJwt {
5092150921
nbf: Int
5092250922
preferredUsername: String
5092350923
priorityGroup: String
50924-
sessionState: UUID
50924+
sessionState: String
5092550925
sub: String
5092650926
typ: String
5092750927
userGroups: [String]
@@ -50998,7 +50998,7 @@ input KeycloakJwtFilter {
5099850998
priorityGroup: StringFilter
5099950999

5100051000
"""Filter by the object’s `sessionState` field."""
51001-
sessionState: UUIDFilter
51001+
sessionState: StringFilter
5100251002

5100351003
"""Filter by the object’s `sub` field."""
5100451004
sub: StringFilter

app/schema/schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171566,7 +171566,7 @@
171566171566
"args": [],
171567171567
"type": {
171568171568
"kind": "SCALAR",
171569-
"name": "UUID",
171569+
"name": "String",
171570171570
"ofType": null
171571171571
},
171572171572
"isDeprecated": false,
@@ -171865,7 +171865,7 @@
171865171865
"description": "Filter by the object’s `sessionState` field.",
171866171866
"type": {
171867171867
"kind": "INPUT_OBJECT",
171868-
"name": "UUIDFilter",
171868+
"name": "StringFilter",
171869171869
"ofType": null
171870171870
},
171871171871
"defaultValue": null

schema/deploy/types/keycloak_jwt.sql

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,7 @@
33

44
begin;
55

6-
drop type cif.keycloak_jwt;
7-
8-
-- Recreating the type with the `sub` field as text
9-
10-
create type cif.keycloak_jwt as (
11-
jti uuid,
12-
exp integer,
13-
nbf integer,
14-
iat integer,
15-
iss text,
16-
aud text,
17-
sub text,
18-
typ text,
19-
azp text,
20-
auth_time integer,
21-
session_state uuid,
22-
acr text,
23-
email_verified boolean,
24-
name text,
25-
preferred_username text,
26-
given_name text,
27-
family_name text,
28-
email text,
29-
broker_session_id text,
30-
priority_group text,
31-
user_groups text[]
32-
);
33-
comment on type cif.keycloak_jwt is E'@primaryKey sub\n@foreignKey (sub) references cif_user (session_sub)';
6+
alter type cif.keycloak_jwt drop attribute session_state;
7+
alter type cif.keycloak_jwt add attribute session_state text;
348

359
commit;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
-- Deploy cif:types/keycloak_jwt to pg
2+
-- requires: schemas/main
3+
4+
begin;
5+
6+
drop type cif.keycloak_jwt;
7+
8+
-- Recreating the type with the `sub` field as text
9+
10+
create type cif.keycloak_jwt as (
11+
jti uuid,
12+
exp integer,
13+
nbf integer,
14+
iat integer,
15+
iss text,
16+
aud text,
17+
sub text,
18+
typ text,
19+
azp text,
20+
auth_time integer,
21+
session_state uuid,
22+
acr text,
23+
email_verified boolean,
24+
name text,
25+
preferred_username text,
26+
given_name text,
27+
family_name text,
28+
email text,
29+
broker_session_id text,
30+
priority_group text,
31+
user_groups text[]
32+
);
33+
comment on type cif.keycloak_jwt is E'@primaryKey sub\n@foreignKey (sub) references cif_user (session_sub)';
34+
35+
commit;

schema/revert/types/keycloak_jwt.sql

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,33 @@
33

44
begin;
55

6-
drop type cif.keycloak_jwt;
6+
drop type cif.keycloak_jwt;
77

8-
create type cif.keycloak_jwt as (
9-
jti uuid,
10-
exp integer,
11-
nbf integer,
12-
iat integer,
13-
iss text,
14-
aud text,
15-
sub uuid,
16-
typ text,
17-
azp text,
18-
auth_time integer,
19-
session_state uuid,
20-
acr text,
21-
email_verified boolean,
22-
name text,
23-
preferred_username text,
24-
given_name text,
25-
family_name text,
26-
email text,
27-
broker_session_id text,
28-
priority_group text,
29-
user_groups text[]
30-
);
8+
-- Recreating the type with the `sub` field as text
319

32-
comment on type cif.keycloak_jwt is E'@primaryKey sub\n@foreignKey (sub) references cif_user (uuid)';
10+
create type cif.keycloak_jwt as (
11+
jti uuid,
12+
exp integer,
13+
nbf integer,
14+
iat integer,
15+
iss text,
16+
aud text,
17+
sub text,
18+
typ text,
19+
azp text,
20+
auth_time integer,
21+
session_state uuid,
22+
acr text,
23+
email_verified boolean,
24+
name text,
25+
preferred_username text,
26+
given_name text,
27+
family_name text,
28+
email text,
29+
broker_session_id text,
30+
priority_group text,
31+
user_groups text[]
32+
);
33+
comment on type cif.keycloak_jwt is E'@primaryKey sub\n@foreignKey (sub) references cif_user (session_sub)';
3334

3435
commit;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
-- Deploy cif:types/keycloak_jwt to pg
2+
-- requires: schemas/main
3+
4+
begin;
5+
6+
drop type cif.keycloak_jwt;
7+
8+
create type cif.keycloak_jwt as (
9+
jti uuid,
10+
exp integer,
11+
nbf integer,
12+
iat integer,
13+
iss text,
14+
aud text,
15+
sub uuid,
16+
typ text,
17+
azp text,
18+
auth_time integer,
19+
session_state uuid,
20+
acr text,
21+
email_verified boolean,
22+
name text,
23+
preferred_username text,
24+
given_name text,
25+
family_name text,
26+
email text,
27+
broker_session_id text,
28+
priority_group text,
29+
user_groups text[]
30+
);
31+
32+
comment on type cif.keycloak_jwt is E'@primaryKey sub\n@foreignKey (sub) references cif_user (uuid)';
33+
34+
commit;

schema/sqitch.plan

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,3 +392,4 @@ tables/form_002 [tables/form_001] 2024-12-13T19:25:15Z Pierre Bastianelli <pierr
392392

393393
tables/funding_stream_rfp_003 2026-02-04T21:17:58Z Dylan Leard <dylan@button.is> # add 2025 rpf year
394394
@1.18.8 2026-02-05T17:50:37Z Dylan Leard <dylan@button.is> # release v1.18.8
395+
types/keycloak_jwt [types/keycloak_jwt@1.18.8] 2026-08-13T21:04:50Z Dylan Leard <dleard@L7G9HM2LVW> # session_state is no longer a uuid
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Verify cif:type_keycloak_jwt on pg
2+
3+
begin;
4+
5+
do $$
6+
begin
7+
assert (
8+
select true from pg_catalog.pg_type where typname = 'keycloak_jwt'
9+
), 'type "keycloak_jwt" is not defined';
10+
end;
11+
$$;
12+
13+
rollback;

0 commit comments

Comments
 (0)