Skip to content

Commit 7888c91

Browse files
committed
Merge branch '11.x'
# Conflicts: # CHANGELOG.md # src/PassportServiceProvider.php
2 parents f8997fc + 121f030 commit 7888c91

File tree

6 files changed

+63
-35
lines changed

6 files changed

+63
-35
lines changed

.github/ISSUE_TEMPLATE/1_Bug_report.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Bug Report
2-
description: "Report a general library issue."
2+
description: "Report something that's broken."
33
body:
44
- type: markdown
55
attributes:
6-
value: "Before submitting your report, [please ensure your Laravel version is still supported](https://laravel.com/docs/releases#support-policy)."
6+
value: "Please read [our full contribution guide](https://laravel.com/docs/contributions#bug-reports) before submitting bug reports. If you notice improper DocBlock, PHPStan, or IDE warnings while using Laravel, do not create a GitHub issue. Instead, please submit a pull request to fix the problem."
77
- type: input
88
attributes:
99
label: Passport Version
@@ -14,7 +14,7 @@ body:
1414
- type: input
1515
attributes:
1616
label: Laravel Version
17-
description: Provide the Laravel version that you are using.
17+
description: Provide the Laravel version that you are using. [Please ensure it is still supported.](https://laravel.com/docs/releases#support-policy)
1818
placeholder: 10.4.1
1919
validations:
2020
required: true

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,4 @@ permissions:
1212

1313
jobs:
1414
tests:
15-
runs-on: ubuntu-22.04
16-
17-
strategy:
18-
fail-fast: true
19-
20-
name: Static Analysis
21-
22-
steps:
23-
- name: Checkout code
24-
uses: actions/checkout@v4
25-
26-
- name: Setup PHP
27-
uses: shivammathur/setup-php@v2
28-
with:
29-
php-version: 8.2
30-
tools: composer:v2
31-
coverage: none
32-
33-
- name: Install dependencies
34-
uses: nick-fields/retry@v2
35-
with:
36-
timeout_minutes: 5
37-
max_attempts: 5
38-
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
39-
40-
- name: Execute type checking
41-
run: vendor/bin/phpstan
15+
uses: laravel/.github/.github/workflows/static-analysis.yml@main

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
# Release Notes
22

3-
## [Unreleased](https://github.com/laravel/passport/compare/v11.10.0...master)
3+
## [Unreleased](https://github.com/laravel/passport/compare/v11.10.4...master)
4+
5+
## [v11.10.4](https://github.com/laravel/passport/compare/v11.10.2...v11.10.4) - 2024-01-30
6+
7+
* Consistently retrieve client uuids value from Passport by [@rojtjo](https://github.com/rojtjo) in https://github.com/laravel/passport/pull/1711
8+
* [11.x] Allow developers to disable the password grant type by [@axlon](https://github.com/axlon) in https://github.com/laravel/passport/pull/1712
9+
10+
## [v11.10.2](https://github.com/laravel/passport/compare/v11.10.1...v11.10.2) - 2024-01-17
11+
12+
* Add getScopesAttribute and getScopesAttribute methods by [@uintaam](https://github.com/uintaam) in https://github.com/laravel/passport/pull/1709
13+
14+
## [v11.10.1](https://github.com/laravel/passport/compare/v11.10.0...v11.10.1) - 2024-01-10
15+
16+
* [11.x] Allow unsetting a user's access token by [@axlon](https://github.com/axlon) in https://github.com/laravel/passport/pull/1698
17+
* [11.x] Add getGrantTypesAttribute method to fix Eloquent strict mode error by [@gdebrauwer](https://github.com/gdebrauwer) in https://github.com/laravel/passport/pull/1705
418

519
## [v11.10.0](https://github.com/laravel/passport/compare/v11.9.2...v11.10.0) - 2023-11-02
620

src/Client.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function boot()
6565
parent::boot();
6666

6767
static::creating(function ($model) {
68-
if (config('passport.client_uuids')) {
68+
if (Passport::clientUuids()) {
6969
$model->{$model->getKeyName()} = $model->{$model->getKeyName()} ?: (string) Str::orderedUuid();
7070
}
7171
});
@@ -105,6 +105,37 @@ public function tokens()
105105
return $this->hasMany(Passport::tokenModel(), 'client_id');
106106
}
107107

108+
/**
109+
* Get the grant types the client can use.
110+
*
111+
* @return array|null
112+
*/
113+
public function getGrantTypesAttribute()
114+
{
115+
return $this->attributes['grant_types'] ?? null;
116+
}
117+
118+
/**
119+
* Get the scopes for the client.
120+
*
121+
* @return array|null
122+
*/
123+
public function getScopesAttribute()
124+
{
125+
return $this->attributes['scopes'] ?? null;
126+
}
127+
128+
/**
129+
* Set the scopes for the client.
130+
*
131+
* @param array|null $scopes
132+
* @return void
133+
*/
134+
public function setScopesAttribute(?array $scopes)
135+
{
136+
$this->attributes['scopes'] = $scopes;
137+
}
138+
108139
/**
109140
* The temporary non-hashed client secret.
110141
*

src/Passport.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ class Passport
2121
*/
2222
public static $implicitGrantEnabled = false;
2323

24+
/**
25+
* Indicates if the password grant type is enabled.
26+
*
27+
* @var bool|null
28+
*/
29+
public static $passwordGrantEnabled = true;
30+
2431
/**
2532
* The default scope.
2633
*

src/PassportServiceProvider.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,11 @@ protected function registerAuthorizationServer()
160160
$this->makeRefreshTokenGrant(), Passport::tokensExpireIn()
161161
);
162162

163-
$server->enableGrantType(
164-
$this->makePasswordGrant(), Passport::tokensExpireIn()
165-
);
163+
if (Passport::$passwordGrantEnabled) {
164+
$server->enableGrantType(
165+
$this->makePasswordGrant(), Passport::tokensExpireIn()
166+
);
167+
}
166168

167169
$server->enableGrantType(
168170
new PersonalAccessGrant, Passport::personalAccessTokensExpireIn()

0 commit comments

Comments
 (0)