interface JwtTranscoderInterface in JSON Web Token Authentication (JWT) 8
Same name and namespace in other branches
- 8.0 src/Transcoder/JwtTranscoderInterface.php \Drupal\jwt\Transcoder\JwtTranscoderInterface
Interface JwtTranscoderInterface.
@package Drupal\jwt
Hierarchy
- interface \Drupal\jwt\Transcoder\JwtTranscoderInterface
Expanded class hierarchy of JwtTranscoderInterface
All classes that implement JwtTranscoderInterface
2 files declare their use of JwtTranscoderInterface
- JwtAuth.php in src/
Authentication/ Provider/ JwtAuth.php - JwtPathAuth.php in modules/
jwt_path_auth/ src/ Authentication/ Provider/ JwtPathAuth.php
File
- src/
Transcoder/ JwtTranscoderInterface.php, line 12
Namespace
Drupal\jwt\TranscoderView source
interface JwtTranscoderInterface {
/**
* Gets a validated JsonWebToken from an encoded JWT.
*
* @param string $jwt
* The encoded JWT.
*
* @return \Drupal\jwt\JsonWebToken\JsonWebTokenInterface
* Validated JWT.
*
* @throws \Drupal\jwt\Transcoder\JwtDecodeException
*/
public function decode($jwt);
/**
* Encodes a JsonWebToken.
*
* @param \Drupal\jwt\JsonWebToken\JsonWebTokenInterface $jwt
* A JWT.
*
* @return string
* The encoded JWT.
*/
public function encode(JsonWebTokenInterface $jwt);
/**
* Sets the secret that is used for a symmetric algorithm signature.
*
* The secret is only used when a symmetric algorithm is selected. Currently
* the symmetric algorithms supported are:
* * HS256
* * HS384
* * HS512
* The secret is used for both signature creation and verification.
*
* @param string $secret
* The secret for the JWT.
*/
public function setSecret($secret);
/**
* Sets the algorithm to be used for the JWT.
*
* @param string $algorithm
* This can be any of the array keys returned by the getAlgorithmOptions
* function.
*
* @see getAlgorithmOptions()
*/
public function setAlgorithm($algorithm);
/**
* Sets the private key used to create signatures for an asymmetric algorithm.
*
* This key is only used when an asymmetric algorithm is selected. Currently
* supported asymmetric algorithms are:
* * RS256
*
* @param string $private_key
* A PEM encoded private key.
* @param bool $derive_public_key
* (Optional) Derive the public key from the private key. Defaults to true.
*
* @return bool
* Function does some validation of the key. Returns TRUE on success.
*/
public function setPrivateKey($private_key, $derive_public_key = TRUE);
/**
* Sets the public key used to verify signatures for an asymmetric algorithm.
*
* This key is only used when an asymmetric algorithm is selected. Currently
* supported asymmetric algorithms are:
* * RS256
*
* @param string $public_key
* A PEM encoded public key.
*
* @return mixed
* Function does some validation of the key. Returns TRUE on success.
*/
public function setPublicKey($public_key);
/**
* Return the type of algorithm selected.
*
* @param string $algorithm
* The algorithm.
*
* @return string
* The algorithm type. Returns NULL if algorithm not found.
*/
public static function getAlgorithmType($algorithm);
/**
* Gets a list of algorithms supported by this transcoder.
*
* @return array
* An array of options formatted for a select list.
*/
public static function getAlgorithmOptions();
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JwtTranscoderInterface:: |
public | function | Gets a validated JsonWebToken from an encoded JWT. | 1 |
JwtTranscoderInterface:: |
public | function | Encodes a JsonWebToken. | 1 |
JwtTranscoderInterface:: |
public static | function | Gets a list of algorithms supported by this transcoder. | 1 |
JwtTranscoderInterface:: |
public static | function | Return the type of algorithm selected. | 1 |
JwtTranscoderInterface:: |
public | function | Sets the algorithm to be used for the JWT. | 1 |
JwtTranscoderInterface:: |
public | function | Sets the private key used to create signatures for an asymmetric algorithm. | 1 |
JwtTranscoderInterface:: |
public | function | Sets the public key used to verify signatures for an asymmetric algorithm. | 1 |
JwtTranscoderInterface:: |
public | function | Sets the secret that is used for a symmetric algorithm signature. | 1 |