Update v1.0.6
This commit is contained in:
		
							
								
								
									
										13
									
								
								vendor/tymon/jwt-auth/src/Claims/Audience.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								vendor/tymon/jwt-auth/src/Claims/Audience.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| class Audience extends Claim | ||||
| { | ||||
|     /** | ||||
|      * The claim name | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $name = 'aud'; | ||||
| } | ||||
							
								
								
									
										112
									
								
								vendor/tymon/jwt-auth/src/Claims/Claim.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								vendor/tymon/jwt-auth/src/Claims/Claim.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,112 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| use Tymon\JWTAuth\Exceptions\InvalidClaimException; | ||||
|  | ||||
| abstract class Claim implements ClaimInterface | ||||
| { | ||||
|     /** | ||||
|      * The claim name | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $name; | ||||
|  | ||||
|     /** | ||||
|      * The claim value | ||||
|      * | ||||
|      * @var mixed | ||||
|      */ | ||||
|     private $value; | ||||
|  | ||||
|     /** | ||||
|      * @param mixed  $value | ||||
|      */ | ||||
|     public function __construct($value) | ||||
|     { | ||||
|         $this->setValue($value); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the claim value, and call a validate method if available | ||||
|      * | ||||
|      * @param $value | ||||
|      * @throws \Tymon\JWTAuth\Exceptions\InvalidClaimException | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setValue($value) | ||||
|     { | ||||
|         if (! $this->validate($value)) { | ||||
|             throw new InvalidClaimException('Invalid value provided for claim "' . $this->getName() . '": ' . $value); | ||||
|         } | ||||
|  | ||||
|         $this->value = $value; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the claim value | ||||
|      * | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function getValue() | ||||
|     { | ||||
|         return $this->value; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the claim name | ||||
|      * | ||||
|      * @param string $name | ||||
|      * @return $this | ||||
|      */ | ||||
|     public function setName($name) | ||||
|     { | ||||
|         $this->name = $name; | ||||
|  | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the claim name | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName() | ||||
|     { | ||||
|         return $this->name; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Validate the Claim value | ||||
|      * | ||||
|      * @param  $value | ||||
|      * @return boolean | ||||
|      */ | ||||
|     protected function validate($value) | ||||
|     { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Build a key value array comprising of the claim name and value | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     public function toArray() | ||||
|     { | ||||
|         return [$this->getName() => $this->getValue()]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the claim as a string | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function __toString() | ||||
|     { | ||||
|         return json_encode($this->toArray(), JSON_UNESCAPED_SLASHES); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										36
									
								
								vendor/tymon/jwt-auth/src/Claims/ClaimInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								vendor/tymon/jwt-auth/src/Claims/ClaimInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| interface ClaimInterface | ||||
| { | ||||
|     /** | ||||
|      * Set the claim value, and call a validate method if available | ||||
|      * | ||||
|      * @param mixed | ||||
|      * @return Claim | ||||
|      */ | ||||
|     public function setValue($value); | ||||
|  | ||||
|     /** | ||||
|      * Get the claim value | ||||
|      * | ||||
|      * @return mixed | ||||
|      */ | ||||
|     public function getValue(); | ||||
|  | ||||
|     /** | ||||
|      * Set the claim name | ||||
|      * | ||||
|      * @param string  $name | ||||
|      * @return Claim | ||||
|      */ | ||||
|     public function setName($name); | ||||
|  | ||||
|     /** | ||||
|      * Get the claim name | ||||
|      * | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getName(); | ||||
| } | ||||
							
								
								
									
										16
									
								
								vendor/tymon/jwt-auth/src/Claims/Custom.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								vendor/tymon/jwt-auth/src/Claims/Custom.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| class Custom extends Claim | ||||
| { | ||||
|     /** | ||||
|      * @param string  $name | ||||
|      * @param mixed   $value | ||||
|      */ | ||||
|     public function __construct($name, $value) | ||||
|     { | ||||
|         parent::__construct($value); | ||||
|         $this->setName($name); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										24
									
								
								vendor/tymon/jwt-auth/src/Claims/Expiration.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								vendor/tymon/jwt-auth/src/Claims/Expiration.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| class Expiration extends Claim | ||||
| { | ||||
|     /** | ||||
|      * The claim name | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $name = 'exp'; | ||||
|  | ||||
|     /** | ||||
|      * Validate the expiry claim | ||||
|      * | ||||
|      * @param  mixed  $value | ||||
|      * @return boolean | ||||
|      */ | ||||
|     protected function validate($value) | ||||
|     { | ||||
|         return is_numeric($value); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										46
									
								
								vendor/tymon/jwt-auth/src/Claims/Factory.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								vendor/tymon/jwt-auth/src/Claims/Factory.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| class Factory | ||||
| { | ||||
|     /** | ||||
|      * @var array | ||||
|      */ | ||||
|     private static $classMap = [ | ||||
|         'aud' => 'Tymon\JWTAuth\Claims\Audience', | ||||
|         'exp' => 'Tymon\JWTAuth\Claims\Expiration', | ||||
|         'iat' => 'Tymon\JWTAuth\Claims\IssuedAt', | ||||
|         'iss' => 'Tymon\JWTAuth\Claims\Issuer', | ||||
|         'jti' => 'Tymon\JWTAuth\Claims\JwtId', | ||||
|         'nbf' => 'Tymon\JWTAuth\Claims\NotBefore', | ||||
|         'sub' => 'Tymon\JWTAuth\Claims\Subject' | ||||
|     ]; | ||||
|  | ||||
|     /** | ||||
|      * Get the instance of the claim when passing the name and value | ||||
|      * | ||||
|      * @param  string  $name | ||||
|      * @param  mixed   $value | ||||
|      * @return \Tymon\JWTAuth\Claims\Claim | ||||
|      */ | ||||
|     public function get($name, $value) | ||||
|     { | ||||
|         if ($this->has($name)) { | ||||
|             return new self::$classMap[$name]($value); | ||||
|         } | ||||
|  | ||||
|         return new Custom($name, $value); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Check whether the claim exists | ||||
|      * | ||||
|      * @param  string  $name | ||||
|      * @return boolean | ||||
|      */ | ||||
|     public function has($name) | ||||
|     { | ||||
|         return array_key_exists($name, self::$classMap); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										24
									
								
								vendor/tymon/jwt-auth/src/Claims/IssuedAt.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								vendor/tymon/jwt-auth/src/Claims/IssuedAt.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| class IssuedAt extends Claim | ||||
| { | ||||
|     /** | ||||
|      * The claim name | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $name = 'iat'; | ||||
|  | ||||
|     /** | ||||
|      * Validate the issued at claim | ||||
|      * | ||||
|      * @param  mixed  $value | ||||
|      * @return boolean | ||||
|      */ | ||||
|     protected function validate($value) | ||||
|     { | ||||
|         return is_numeric($value); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										13
									
								
								vendor/tymon/jwt-auth/src/Claims/Issuer.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								vendor/tymon/jwt-auth/src/Claims/Issuer.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| class Issuer extends Claim | ||||
| { | ||||
|     /** | ||||
|      * The claim name | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $name = 'iss'; | ||||
| } | ||||
							
								
								
									
										13
									
								
								vendor/tymon/jwt-auth/src/Claims/JwtId.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								vendor/tymon/jwt-auth/src/Claims/JwtId.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| class JwtId extends Claim | ||||
| { | ||||
|     /** | ||||
|      * The claim name | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $name = 'jti'; | ||||
| } | ||||
							
								
								
									
										24
									
								
								vendor/tymon/jwt-auth/src/Claims/NotBefore.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								vendor/tymon/jwt-auth/src/Claims/NotBefore.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| class NotBefore extends Claim | ||||
| { | ||||
|     /** | ||||
|      * The claim name | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $name = 'nbf'; | ||||
|  | ||||
|     /** | ||||
|      * Validate the not before claim | ||||
|      * | ||||
|      * @param  mixed  $value | ||||
|      * @return boolean | ||||
|      */ | ||||
|     protected function validate($value) | ||||
|     { | ||||
|         return is_numeric($value); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										13
									
								
								vendor/tymon/jwt-auth/src/Claims/Subject.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								vendor/tymon/jwt-auth/src/Claims/Subject.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Tymon\JWTAuth\Claims; | ||||
|  | ||||
| class Subject extends Claim | ||||
| { | ||||
|     /** | ||||
|      * The claim name | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $name = 'sub'; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Bhanu Slathia
					Bhanu Slathia