public function JwtTranscoder::decode in JSON Web Token Authentication (JWT) 8.0
Same name and namespace in other branches
- 8 src/Transcoder/JwtTranscoder.php \Drupal\jwt\Transcoder\JwtTranscoder::decode()
Gets a validated JsonWebToken from an encoded JWT.
Parameters
string $jwt: The encoded JWT.
Return value
\Drupal\jwt\JsonWebToken\JsonWebTokenInterface Validated JWT.
Overrides JwtTranscoderInterface::decode
File
- src/
Transcoder/ JwtTranscoder.php, line 171
Class
- JwtTranscoder
- Class JwtTranscoder.
Namespace
Drupal\jwt\TranscoderCode
public function decode($jwt) {
$key = $this
->getKey('decode');
$algorithms = [
$this->algorithm,
];
try {
$token = $this->transcoder
->decode($jwt, $key, $algorithms);
} catch (\Exception $e) {
throw JwtDecodeException::newFromException($e);
}
return new JsonWebToken($token);
}