protected function JwtTranscoder::getKey in JSON Web Token Authentication (JWT) 8.0
Same name and namespace in other branches
- 8 src/Transcoder/JwtTranscoder.php \Drupal\jwt\Transcoder\JwtTranscoder::getKey()
Helper function to get the correct key based on operation.
Parameters
string $operation: The operation being performed. One of: encode, decode.
Return value
null|string Returns NULL if opteration is not found. Otherwise returns key.
2 calls to JwtTranscoder::getKey()
- JwtTranscoder::decode in src/
Transcoder/ JwtTranscoder.php - Gets a validated JsonWebToken from an encoded JWT.
- JwtTranscoder::encode in src/
Transcoder/ JwtTranscoder.php - Encodes a JsonWebToken.
File
- src/
Transcoder/ JwtTranscoder.php, line 205
Class
- JwtTranscoder
- Class JwtTranscoder.
Namespace
Drupal\jwt\TranscoderCode
protected function getKey($operation) {
if ($this->algorithmType == 'jwt_hs') {
return $this->secret;
}
elseif ($this->algorithmType == 'jwt_rs') {
if ($operation == 'encode') {
return $this->privateKey;
}
elseif ($operation == 'decode') {
return $this->publicKey;
}
}
return NULL;
}