Skip to content

Commit b44d915

Browse files
committed
add option to read code information, so we can add the subject/user_id sent with the code information.
1 parent 62d3e87 commit b44d915

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/TokenGenerator.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
use Pdsinterop\Solid\Auth\Utils\Jwks;
66
use Pdsinterop\Solid\Auth\Enum\OpenId\OpenIdConnectMetadata as OidcMeta;
77
use Laminas\Diactoros\Response\JsonResponse as JsonResponse;
8+
use League\OAuth2\Server\CryptTrait;
89

910
class TokenGenerator
1011
{
12+
use CryptTrait;
1113
////////////////////////////// CLASS PROPERTIES \\\\\\\\\\\\\\\\\\\\\\\\\\\\
1214

1315
/** @var Config */
@@ -19,6 +21,7 @@ final public function __construct(
1921
Config $config
2022
) {
2123
$this->config = $config;
24+
$this->setEncryptionKey($this->config->getKeys()->getEncryptionKey());
2225
}
2326

2427
public function generateRegistrationAccessToken($clientId, $privateKey) {
@@ -136,6 +139,10 @@ public function addIdTokenToResponse($response, $clientId, $subject, $nonce, $pr
136139
}
137140
return $response;
138141
}
142+
143+
public function getCodeInfo($code) {
144+
return json_decode($this->decrypt($code));
145+
}
139146
///////////////////////////// HELPER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
140147

141148
private function generateJti() {

0 commit comments

Comments
 (0)