示例#1
0
文件: Header.php 项目: sop/jwx
 /**
  * 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);
 }
示例#2
0
 /**
  * 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);
 }
示例#3
0
 /**
  * Constructor
  *
  * @param string $algo Algorithm name
  */
 public function __construct($algo)
 {
     parent::__construct(self::PARAM_ENCRYPTION_ALGORITHM, $algo);
 }
示例#4
0
 /**
  * Constructor
  *
  * @param Claim $claim
  */
 public function __construct(Claim $claim)
 {
     parent::__construct($claim->name(), $claim->value());
 }
示例#5
0
 /**
  * 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);
 }
示例#7
0
 /**
  * Constructor
  *
  * @param string $type
  */
 public function __construct($type)
 {
     parent::__construct(self::PARAM_CONTENT_TYPE, (string) $type);
 }
示例#8
0
 /**
  * Constructor
  *
  * @param string ...$names
  */
 public function __construct(...$names)
 {
     parent::__construct(self::PARAM_CRITICAL, $names);
 }
示例#9
0
 /**
  * Constructor
  *
  * @param string $iv Base64url encoded initialization vector
  */
 public function __construct($iv)
 {
     $this->_validateEncoding($iv);
     parent::__construct(self::PARAM_INITIALIZATION_VECTOR, (string) $iv);
 }
示例#10
0
 /**
  * Constructor
  *
  * @param string $id
  */
 public function __construct($id)
 {
     parent::__construct(self::PARAM_KEY_ID, (string) $id);
 }
示例#11
0
 /**
  * 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);
 }
示例#12
0
 /**
  * Constructor
  *
  * @param string $algo Algorithm name
  */
 public function __construct($algo)
 {
     parent::__construct(self::PARAM_ALGORITHM, (string) $algo);
 }
示例#13
0
 /**
  * Constructor
  *
  * @param JWK $jwk
  */
 public function __construct(JWK $jwk)
 {
     parent::__construct(self::PARAM_JSON_WEB_KEY, $jwk->toArray());
 }
示例#14
0
 /**
  * Constructor
  *
  * @param string $tag Base64url encoded authentication tag
  */
 public function __construct($tag)
 {
     $this->_validateEncoding($tag);
     parent::__construct(self::PARAM_AUTHENTICATION_TAG, (string) $tag);
 }