-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Private claims implementation #1122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 9.0.0-WIP
Are you sure you want to change the base?
Changes from 35 commits
517403b
aefdde5
f6d5ed0
962506e
d2888f1
3630fc7
108b1ee
8dd31f5
12d8643
d6d45d9
ba02f3b
7ac954b
c659a19
8e1473c
7256a3c
f0a3e97
381e415
1db5e24
9891fdb
e8b1942
970ef40
5bd8127
162a02e
88b5705
1842975
74a934e
40fed67
d240052
b8141f9
6bcff56
73f49e5
568c787
0aef818
d43c63c
5a71aaf
1d79e35
6710412
0302141
dc2f7ac
2ea4450
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?php | ||
| /** | ||
| * @author Sebastian Kroczek <[email protected]> | ||
| * @copyright Copyright (c) Alex Bilbie | ||
| * @license http://mit-license.org/ | ||
| * | ||
| * @link https://github.com/thephpleague/oauth2-server | ||
| */ | ||
|
|
||
| namespace League\OAuth2\Server\Entities; | ||
|
|
||
| interface ClaimEntityInterface | ||
| { | ||
| /** | ||
| * Get the claim's name. | ||
| * | ||
| * @return string | ||
| */ | ||
| public function getName(); | ||
|
|
||
| /** | ||
| * Get the claim's value | ||
| * | ||
| * @return mixed | ||
| */ | ||
| public function getValue(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <?php | ||
| /** | ||
| * @author Sebastian Kroczek <[email protected]> | ||
| * @copyright Copyright (c) Alex Bilbie | ||
| * @license http://mit-license.org/ | ||
| * | ||
| * @link https://github.com/thephpleague/oauth2-server | ||
| */ | ||
|
|
||
| namespace League\OAuth2\Server\Entities\Traits; | ||
|
|
||
| trait ClaimEntityTrait | ||
| { | ||
| /** | ||
| * @var string | ||
| */ | ||
| protected $name; | ||
|
|
||
| /** | ||
| * @var mixed | ||
| */ | ||
| protected $value; | ||
|
|
||
| /** | ||
| * Returns the name of the claim | ||
| * | ||
| * @return string | ||
| */ | ||
| public function getName() | ||
| { | ||
| return $this->name; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the claims value | ||
| * | ||
| * @return mixed | ||
| */ | ||
| public function getValue() | ||
| { | ||
| return $this->value; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,8 +161,18 @@ public function respondToAccessTokenRequest( | |
| } | ||
| } | ||
|
|
||
| $privateClaims = []; | ||
|
|
||
| if ($this->claimRepository !== null) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First of all, sorry for the (very) late comment. But just got an email that people are interested again. |
||
| $privateClaims = $this->claimRepository->getClaims( | ||
| $this->getIdentifier(), | ||
| $client, | ||
| $authCodePayload->user_id | ||
| ); | ||
| } | ||
|
|
||
| // Issue and persist new access token | ||
| $accessToken = $this->issueAccessToken($accessTokenTTL, $client, $authCodePayload->user_id, $scopes); | ||
| $accessToken = $this->issueAccessToken($accessTokenTTL, $client, $authCodePayload->user_id, $scopes, $privateClaims); | ||
| $this->getEmitter()->emit(new RequestEvent(RequestEvent::ACCESS_TOKEN_ISSUED, $request)); | ||
| $responseType->setAccessToken($accessToken); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.