16
16
* - cacheKey : varchar 255
17
17
* - token : text
18
18
* - expiration : varchar 255 (unix timestamp)
19
+ * - subject : varchar 255
19
20
*
20
21
*/
21
22
component accessors = " true" singleton {
@@ -40,7 +41,7 @@ component accessors="true" singleton{
40
41
*/
41
42
property name = " keyPrefix" ;
42
43
43
- variables .COLUMNS = " id,cacheKey,token,expiration,created" ;
44
+ variables .COLUMNS = " id,cacheKey,token,expiration,created,subject " ;
44
45
45
46
/**
46
47
* Constructor
@@ -93,26 +94,34 @@ component accessors="true" singleton{
93
94
* @key The cache key
94
95
* @token The token to store
95
96
* @expiration The token expiration
97
+ * @payload The payload
96
98
*
97
99
* @return JWTStorage
98
100
*/
99
- any function set ( required key , required token , required expiration ){
101
+ any function set (
102
+ required key ,
103
+ required token ,
104
+ required expiration ,
105
+ required payload
106
+ ){
100
107
queryExecute (
101
108
" INSERT INTO #getTable () # (#variables .COLUMNS #)
102
109
VALUES (
103
110
:uuid,
104
111
:cacheKey,
105
112
:token,
106
113
:expiration,
107
- :created
114
+ :created,
115
+ :subject
108
116
)
109
117
" ,
110
118
{
111
119
uuid = { cfsqltype = " varchar" , value = " #variables .uuid .randomUUID ().toString () #" },
112
120
cacheKey = { cfsqltype = " varchar" , value = arguments .key },
113
121
token = { cfsqltype = " longvarchar" ,value = arguments .token },
114
122
expiration = { cfsqltype = " varchar" , value = arguments .expiration },
115
- created = { cfsqltype = " timestamp" , value = now () }
123
+ created = { cfsqltype = " timestamp" , value = now () },
124
+ subject = { cfsqltype = " varchar" , value = arguments .payload .sub },
116
125
},
117
126
{
118
127
datasource = variables .properties .dsn
@@ -316,6 +325,7 @@ component accessors="true" singleton{
316
325
break ;
317
326
}
318
327
}
328
+
319
329
// create it
320
330
if ( NOT tableFound ){
321
331
transaction {
@@ -326,6 +336,7 @@ component accessors="true" singleton{
326
336
expiration VARCHAR(255) NOT NULL,
327
337
created #getDateTimeColumnType () # NOT NULL,
328
338
token #getTextColumnType () # NOT NULL,
339
+ subject VARCHAR(255) NOT NULL,
329
340
PRIMARY KEY (id)
330
341
)" ,
331
342
{},
0 commit comments