/** * Initialize from an array representing a JSON object. * * @param array $members * @return self */ public static function fromArray(array $members) { $params = array(); foreach ($members as $name => $value) { $params[] = JWTParameter::fromNameAndValue($name, $value); } return new self(...$params); }
/** * Constructor * * @param string ...$certs Base64 encoded DER certificates */ public function __construct(...$certs) { foreach ($certs as $cert) { if (!Base64::isValid($cert)) { throw new \UnexpectedValueException("Certificate must be base64 encoded."); } } parent::__construct(self::PARAM_X509_CERTIFICATE_CHAIN, $certs); }
/** * Constructor * * @param string $algo Algorithm name */ public function __construct($algo) { parent::__construct(self::PARAM_ENCRYPTION_ALGORITHM, $algo); }
/** * Constructor * * @param Claim $claim */ public function __construct(Claim $claim) { parent::__construct($claim->name(), $claim->value()); }
/** * Constructor * * @param string $uri */ public function __construct($uri) { parent::__construct(self::PARAM_JWK_SET_URL, (string) $uri); }
/** * Constructor * * @param string $thumbprint Base64url encoded SHA-256 hash */ public function __construct($thumbprint) { $this->_validateEncoding($thumbprint); parent::__construct(self::PARAM_X509_CERTIFICATE_SHA256_THUMBPRINT, (string) $thumbprint); }
/** * Constructor * * @param string $type */ public function __construct($type) { parent::__construct(self::PARAM_CONTENT_TYPE, (string) $type); }
/** * Constructor * * @param string ...$names */ public function __construct(...$names) { parent::__construct(self::PARAM_CRITICAL, $names); }
/** * Constructor * * @param string $iv Base64url encoded initialization vector */ public function __construct($iv) { $this->_validateEncoding($iv); parent::__construct(self::PARAM_INITIALIZATION_VECTOR, (string) $iv); }
/** * Constructor * * @param string $id */ public function __construct($id) { parent::__construct(self::PARAM_KEY_ID, (string) $id); }
/** * Constructor * * @param string $salt Base64url encoded salt input value */ public function __construct($salt) { $this->_validateEncoding($salt); parent::__construct(self::PARAM_PBES2_SALT_INPUT, (string) $salt); }
/** * Constructor * * @param string $algo Algorithm name */ public function __construct($algo) { parent::__construct(self::PARAM_ALGORITHM, (string) $algo); }
/** * Constructor * * @param JWK $jwk */ public function __construct(JWK $jwk) { parent::__construct(self::PARAM_JSON_WEB_KEY, $jwk->toArray()); }
/** * Constructor * * @param string $tag Base64url encoded authentication tag */ public function __construct($tag) { $this->_validateEncoding($tag); parent::__construct(self::PARAM_AUTHENTICATION_TAG, (string) $tag); }