Skip to content

Commit a97064a

Browse files
committed
Merge branch 'refs/heads/develop'
2 parents 439539a + 7e6cef2 commit a97064a

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

src/LucaDegasperi/OAuth2Server/Repositories/FluentClient.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class FluentClient implements ClientInterface
99

1010
public function getClient($clientId, $clientSecret = null, $redirectUri = null, $grantType = null)
1111
{
12+
$query = null;
13+
1214
if (! is_null($redirectUri) && is_null($clientSecret)) {
1315
$query = DB::table('oauth_clients')
1416
->join('oauth_client_endpoints', 'oauth_clients.id', '=', 'oauth_client_endpoints.client_id')
@@ -39,11 +41,14 @@ public function getClient($clientId, $clientSecret = null, $redirectUri = null,
3941
return false;
4042
}
4143

44+
$metadata = DB::table('oauth_client_metadata')->where('client_id', '=', $result->id)->lists('value', 'key');
45+
4246
return array(
4347
'client_id' => $result->id,
4448
'client_secret' => $result->secret,
4549
'redirect_uri' => (isset($result->redirect_uri)) ? $result->redirect_uri : null,
46-
'name' => $result->name
50+
'name' => $result->name,
51+
'metadata' => $metadata
4752
);
4853
}
4954
}

src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function deleteExpired()
201201
->where('oauth_session_access_tokens.access_token_expires', '<', $time)
202202
->where(function ($query) use ($time) {
203203
$query->where('oauth_session_refresh_tokens.refresh_token_expires', '<', $time)
204-
->orWhereRaw('oauth_session_refresh_tokens.refresh_token_expires IS NULL');
204+
->orWhereNull('oauth_session_refresh_tokens.refresh_token_expires');
205205
})
206206
->get();
207207
if (count($expiredSessions) == 0) {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateOauthClientMetadataTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('oauth_client_metadata', function (Blueprint $table) {
17+
$table->increments('id');
18+
$table->string('client_id', 40);
19+
$table->string('key', 40);
20+
$table->string('value');
21+
$table->timestamps();
22+
23+
$table->foreign('client_id')
24+
->references('id')->on('oauth_clients')
25+
->onDelete('cascade');
26+
27+
$table->unique(array('client_id', 'key'), 'oauth_client_metadata_cid_key_unique');
28+
$table->index('client_id');
29+
30+
});
31+
}
32+
33+
/**
34+
* Reverse the migrations.
35+
*
36+
* @return void
37+
*/
38+
public function down()
39+
{
40+
Schema::table('oauth_client_metadata', function ($table) {
41+
$table->dropForeign('oauth_grant_scopes_client_id_foreign');
42+
});
43+
Schema::drop('oauth_client_metadata');
44+
}
45+
}

0 commit comments

Comments
 (0)