2
2
3
3
use League \OAuth2 \Server \Storage \SessionInterface ;
4
4
use DB ;
5
+ use Carbon \Carbon ;
5
6
6
7
class FluentSession implements SessionInterface {
7
8
@@ -10,7 +11,9 @@ public function createSession($clientId, $ownerType, $ownerId)
10
11
return DB ::table ('oauth_sessions ' )->insertGetId (array (
11
12
'client_id ' => $ clientId ,
12
13
'owner_type ' => $ ownerType ,
13
- 'owner_id ' => $ ownerId
14
+ 'owner_id ' => $ ownerId ,
15
+ 'created_at ' => Carbon::now (),
16
+ 'updated_at ' => Carbon::now ()
14
17
));
15
18
}
16
19
@@ -28,6 +31,8 @@ public function associateRedirectUri($sessionId, $redirectUri)
28
31
DB ::table ('oauth_session_redirects ' )->insert (array (
29
32
'session_id ' => $ sessionId ,
30
33
'redirect_uri ' => $ redirectUri ,
34
+ 'created_at ' => Carbon::now (),
35
+ 'updated_at ' => Carbon::now ()
31
36
));
32
37
}
33
38
@@ -37,6 +42,8 @@ public function associateAccessToken($sessionId, $accessToken, $expireTime)
37
42
'session_id ' => $ sessionId ,
38
43
'access_token ' => $ accessToken ,
39
44
'access_token_expires ' => $ expireTime ,
45
+ 'created_at ' => Carbon::now (),
46
+ 'updated_at ' => Carbon::now ()
40
47
));
41
48
}
42
49
@@ -47,6 +54,8 @@ public function associateRefreshToken($accessTokenId, $refreshToken, $expireTime
47
54
'refresh_token ' => $ refreshToken ,
48
55
'refresh_token_expires ' => $ expireTime ,
49
56
'client_id ' => $ clientId ,
57
+ 'created_at ' => Carbon::now (),
58
+ 'updated_at ' => Carbon::now ()
50
59
));
51
60
}
52
61
@@ -55,7 +64,9 @@ public function associateAuthCode($sessionId, $authCode, $expireTime)
55
64
$ id = DB ::table ('oauth_session_authcodes ' )->insertGetId (array (
56
65
'session_id ' => $ sessionId ,
57
66
'auth_code ' => $ authCode ,
58
- 'auth_code_expires ' => $ expireTime
67
+ 'auth_code_expires ' => $ expireTime ,
68
+ 'created_at ' => Carbon::now (),
69
+ 'updated_at ' => Carbon::now ()
59
70
));
60
71
61
72
return $ id ;
@@ -119,6 +130,8 @@ public function associateScope($accessTokenId, $scopeId)
119
130
DB ::table ('oauth_session_token_scopes ' )->insert (array (
120
131
'session_access_token_id ' => $ accessTokenId ,
121
132
'scope_id ' => $ scopeId ,
133
+ 'created_at ' => Carbon::now (),
134
+ 'updated_at ' => Carbon::now ()
122
135
));
123
136
}
124
137
@@ -135,7 +148,9 @@ public function associateAuthCodeScope($authCodeId, $scopeId)
135
148
{
136
149
DB ::table ('oauth_session_authcode_scopes ' )->insert (array (
137
150
'oauth_session_authcode_id ' => $ authCodeId ,
138
- 'scope_id ' => $ scopeId
151
+ 'scope_id ' => $ scopeId ,
152
+ 'created_at ' => Carbon::now (),
153
+ 'updated_at ' => Carbon::now ()
139
154
));
140
155
}
141
156
@@ -160,4 +175,4 @@ public function removeRefreshToken($refreshToken)
160
175
->delete ();
161
176
}
162
177
163
- }
178
+ }
0 commit comments