Skip to content

Commit 8a75495

Browse files
authored
Allow developers to disable the password grant type (#1712)
1 parent 8498677 commit 8a75495

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

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
@@ -169,9 +169,11 @@ protected function registerAuthorizationServer()
169169
$this->makeRefreshTokenGrant(), Passport::tokensExpireIn()
170170
);
171171

172-
$server->enableGrantType(
173-
$this->makePasswordGrant(), Passport::tokensExpireIn()
174-
);
172+
if (Passport::$passwordGrantEnabled) {
173+
$server->enableGrantType(
174+
$this->makePasswordGrant(), Passport::tokensExpireIn()
175+
);
176+
}
175177

176178
$server->enableGrantType(
177179
new PersonalAccessGrant, Passport::personalAccessTokensExpireIn()

0 commit comments

Comments
 (0)