You are here

public static function JwtTranscoder::getAlgorithmType in JSON Web Token Authentication (JWT) 8.0

Same name and namespace in other branches
  1. 8 src/Transcoder/JwtTranscoder.php \Drupal\jwt\Transcoder\JwtTranscoder::getAlgorithmType()

Return the type of algorithm selected.

Parameters

string $algorithm: The algorithm.

Return value

string The algorithm type. Returns NULL if algorithm not found.

Overrides JwtTranscoderInterface::getAlgorithmType

1 call to JwtTranscoder::getAlgorithmType()
JwtTranscoder::setAlgorithm in src/Transcoder/JwtTranscoder.php
Sets the algorithm to be used for the JWT.

File

src/Transcoder/JwtTranscoder.php, line 75

Class

JwtTranscoder
Class JwtTranscoder.

Namespace

Drupal\jwt\Transcoder

Code

public static function getAlgorithmType($algorithm) {
  switch ($algorithm) {
    case 'HS256':
    case 'HS384':
    case 'HS512':
      return 'jwt_hs';
    case 'RS256':
      return 'jwt_rs';
    default:
      return NULL;
  }
}