Skip to content

Commit 64e2ecf

Browse files
committed
Add support for the OAuth2 "Implicit" grant flow.
1 parent 4e3757e commit 64e2ecf

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/Factory/ConfigFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ final public function create() : Config
4747
$grantTypes = [
4848
GrantType::AUTH_CODE,
4949
GrantType::CLIENT_CREDENTIALS,
50+
GrantType::IMPLICIT,
5051
GrantType::REFRESH_TOKEN,
5152
];
5253

src/Factory/GrantTypeFactory.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use League\OAuth2\Server\Grant\AuthCodeGrant;
99
use League\OAuth2\Server\Grant\ClientCredentialsGrant;
1010
use League\OAuth2\Server\Grant\GrantTypeInterface;
11+
use League\OAuth2\Server\Grant\ImplicitGrant;
1112
use League\OAuth2\Server\Grant\RefreshTokenGrant;
1213
use Pdsinterop\Solid\Auth\Config\Expiration;
1314
use Pdsinterop\Solid\Auth\Enum\OAuth2\GrantType;
@@ -52,6 +53,10 @@ final public function createGrantType(string $grantType) : GrantTypeInterface
5253
$grant = $this->createClientCredentialsGrant();
5354
break;
5455

56+
case GrantType::IMPLICIT:
57+
$grant = $this->createImplicitGrant($expiration->forAccessToken());
58+
break;
59+
5560
case GrantType::REFRESH_TOKEN:
5661
$grant = $this->createRefreshTokenGrant($factory);
5762
break;
@@ -88,6 +93,11 @@ private function createAuthCodeGrant(RepositoryFactory $factory, DateInterval $e
8893
);
8994
}
9095

96+
private function createImplicitGrant(DateInterval $expiration) : ImplicitGrant
97+
{
98+
return new ImplicitGrant($expiration);
99+
}
100+
91101
private function createRefreshTokenGrant(RepositoryFactory $factory) : RefreshTokenGrant
92102
{
93103
return new RefreshTokenGrant(

0 commit comments

Comments
 (0)