Skip to content

Commit eaa3f9e

Browse files
authored
Merge pull request #9 from pdsinterop/feature/token-endpoint
Add function to decrypt 'code' for ID token generation
2 parents 62d3e87 + e021df0 commit eaa3f9e

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), true);
145+
}
139146
///////////////////////////// HELPER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
140147

141148
private function generateJti() {

0 commit comments

Comments
 (0)