Browse Source

Merge pull request #716 from causefx/develop

Develop
causefx 8 years ago
parent
commit
f13725a3f0
100 changed files with 9514 additions and 478 deletions
  1. 25 5
      api.php
  2. 7 1
      auth.php
  3. 2 1
      composer.json
  4. 59 1
      composer.lock
  5. 5 0
      config/configDefaults.php
  6. 10 10
      error.php
  7. 126 12
      functions.php
  8. 6 6
      index.php
  9. 2 2
      lang/de.ini
  10. 2 2
      lang/en.ini
  11. 2 2
      lang/es.ini
  12. 2 2
      lang/fr.ini
  13. 2 2
      lang/it.ini
  14. 2 2
      lang/nl.ini
  15. 2 2
      lang/pl.ini
  16. 68 11
      settings.php
  17. 117 79
      user.php
  18. 0 169
      vendor/composer/autoload_classmap.php
  19. 1 0
      vendor/composer/autoload_psr4.php
  20. 8 169
      vendor/composer/autoload_static.php
  21. 60 0
      vendor/composer/installed.json
  22. 2 0
      vendor/lcobucci/jwt/.gitignore
  23. 56 0
      vendor/lcobucci/jwt/.scrutinizer.yml
  24. 15 0
      vendor/lcobucci/jwt/.travis.yml
  25. 27 0
      vendor/lcobucci/jwt/LICENSE
  26. 149 0
      vendor/lcobucci/jwt/README.md
  27. 52 0
      vendor/lcobucci/jwt/composer.json
  28. 1898 0
      vendor/lcobucci/jwt/composer.lock
  29. 33 0
      vendor/lcobucci/jwt/phpunit.xml.dist
  30. 277 0
      vendor/lcobucci/jwt/src/Builder.php
  31. 40 0
      vendor/lcobucci/jwt/src/Claim.php
  32. 73 0
      vendor/lcobucci/jwt/src/Claim/Basic.php
  33. 32 0
      vendor/lcobucci/jwt/src/Claim/EqualsTo.php
  34. 116 0
      vendor/lcobucci/jwt/src/Claim/Factory.php
  35. 32 0
      vendor/lcobucci/jwt/src/Claim/GreaterOrEqualsTo.php
  36. 32 0
      vendor/lcobucci/jwt/src/Claim/LesserOrEqualsTo.php
  37. 28 0
      vendor/lcobucci/jwt/src/Claim/Validatable.php
  38. 157 0
      vendor/lcobucci/jwt/src/Parser.php
  39. 56 0
      vendor/lcobucci/jwt/src/Parsing/Decoder.php
  40. 51 0
      vendor/lcobucci/jwt/src/Parsing/Encoder.php
  41. 59 0
      vendor/lcobucci/jwt/src/Signature.php
  42. 59 0
      vendor/lcobucci/jwt/src/Signer.php
  43. 78 0
      vendor/lcobucci/jwt/src/Signer/BaseSigner.php
  44. 149 0
      vendor/lcobucci/jwt/src/Signer/Ecdsa.php
  45. 102 0
      vendor/lcobucci/jwt/src/Signer/Ecdsa/KeyParser.php
  46. 43 0
      vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha256.php
  47. 43 0
      vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha384.php
  48. 43 0
      vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha512.php
  49. 71 0
      vendor/lcobucci/jwt/src/Signer/Hmac.php
  50. 35 0
      vendor/lcobucci/jwt/src/Signer/Hmac/Sha256.php
  51. 35 0
      vendor/lcobucci/jwt/src/Signer/Hmac/Sha384.php
  52. 35 0
      vendor/lcobucci/jwt/src/Signer/Hmac/Sha512.php
  53. 85 0
      vendor/lcobucci/jwt/src/Signer/Key.php
  54. 44 0
      vendor/lcobucci/jwt/src/Signer/Keychain.php
  55. 78 0
      vendor/lcobucci/jwt/src/Signer/Rsa.php
  56. 35 0
      vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php
  57. 35 0
      vendor/lcobucci/jwt/src/Signer/Rsa/Sha384.php
  58. 35 0
      vendor/lcobucci/jwt/src/Signer/Rsa/Sha512.php
  59. 284 0
      vendor/lcobucci/jwt/src/Token.php
  60. 120 0
      vendor/lcobucci/jwt/src/ValidationData.php
  61. 320 0
      vendor/lcobucci/jwt/test/functional/EcdsaTokenTest.php
  62. 186 0
      vendor/lcobucci/jwt/test/functional/HmacTokenTest.php
  63. 53 0
      vendor/lcobucci/jwt/test/functional/Keys.php
  64. 272 0
      vendor/lcobucci/jwt/test/functional/RsaTokenTest.php
  65. 137 0
      vendor/lcobucci/jwt/test/functional/UnsignedTokenTest.php
  66. 5 0
      vendor/lcobucci/jwt/test/functional/ecdsa/private.key
  67. 8 0
      vendor/lcobucci/jwt/test/functional/ecdsa/private2.key
  68. 4 0
      vendor/lcobucci/jwt/test/functional/ecdsa/public1.key
  69. 4 0
      vendor/lcobucci/jwt/test/functional/ecdsa/public2.key
  70. 4 0
      vendor/lcobucci/jwt/test/functional/ecdsa/public3.key
  71. 30 0
      vendor/lcobucci/jwt/test/functional/rsa/encrypted-private.key
  72. 9 0
      vendor/lcobucci/jwt/test/functional/rsa/encrypted-public.key
  73. 28 0
      vendor/lcobucci/jwt/test/functional/rsa/private.key
  74. 9 0
      vendor/lcobucci/jwt/test/functional/rsa/public.key
  75. 699 0
      vendor/lcobucci/jwt/test/unit/BuilderTest.php
  76. 84 0
      vendor/lcobucci/jwt/test/unit/Claim/BasicTest.php
  77. 80 0
      vendor/lcobucci/jwt/test/unit/Claim/EqualsToTest.php
  78. 168 0
      vendor/lcobucci/jwt/test/unit/Claim/FactoryTest.php
  79. 103 0
      vendor/lcobucci/jwt/test/unit/Claim/GreaterOrEqualsToTest.php
  80. 103 0
      vendor/lcobucci/jwt/test/unit/Claim/LesserOrEqualsToTest.php
  81. 244 0
      vendor/lcobucci/jwt/test/unit/ParserTest.php
  82. 56 0
      vendor/lcobucci/jwt/test/unit/Parsing/DecoderTest.php
  83. 53 0
      vendor/lcobucci/jwt/test/unit/Parsing/EncoderTest.php
  84. 73 0
      vendor/lcobucci/jwt/test/unit/SignatureTest.php
  85. 128 0
      vendor/lcobucci/jwt/test/unit/Signer/BaseSignerTest.php
  86. 178 0
      vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/KeyParserTest.php
  87. 60 0
      vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha256Test.php
  88. 60 0
      vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha384Test.php
  89. 60 0
      vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha512Test.php
  90. 173 0
      vendor/lcobucci/jwt/test/unit/Signer/EcdsaTest.php
  91. 39 0
      vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha256Test.php
  92. 39 0
      vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha384Test.php
  93. 39 0
      vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha512Test.php
  94. 134 0
      vendor/lcobucci/jwt/test/unit/Signer/HmacTest.php
  95. 102 0
      vendor/lcobucci/jwt/test/unit/Signer/KeyTest.php
  96. 49 0
      vendor/lcobucci/jwt/test/unit/Signer/KeychainTest.php
  97. 39 0
      vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha256Test.php
  98. 39 0
      vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha384Test.php
  99. 39 0
      vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha512Test.php
  100. 502 0
      vendor/lcobucci/jwt/test/unit/TokenTest.php

+ 25 - 5
api.php

@@ -1,14 +1,16 @@
 <?php
 // Include functions
 require_once('user.php');
-$USER = new User('registration_callback');
+$USER = new User();
 // Get Action
 if (isset($_POST['a'])) { $action = $_POST['a']; }
 if (isset($_POST['k'])) { $key = $_POST['k']; }
 if (isset($_POST['v'])) { $values = $_POST['v']; }
 if (isset($_GET['a'])) { $action = $_GET['a']; }
 if (isset($_GET['k'])) { $key = $_GET['k']; }
-if (isset($_GET['v'])) { $values = explode('|',$_GET['v']); }
+if (isset($_GET['v'])) {
+    $values = (strpos($_GET['v'], '|') !== false ? explode('|',$_GET['v']) : $_GET['v']);
+}
 unset($_POST['a']);
 unset($_POST['k']);
 unset($_POST['v']);
@@ -35,6 +37,7 @@ if (isset($action)) {
 					$email = $values[1];
                     $server = $values[2];
                 }
+                //$USER = new User();
                 $USER->invite_user("chris", "causefx@me.com", "plex");
                 $result['data'] = "User has been invited";
                 //$result['data'] = "user = $user | email = $email | server = $server";
@@ -42,8 +45,25 @@ if (isset($action)) {
             	$result['error'] = "No Values Were Set For Function";
             }
             break;
-        case "2":
-            $result = "other test";
+        case "ombi":
+			if($values){
+				switch ($values) {
+					case 'plex-update':
+						$ombi = ombiAPI('plex-cache');
+						if($ombi){
+							$result['data'] = "Plex Content Cache Successful";
+						}else{
+							$result['error'] = "Plex Content Cache Error";
+						}
+						break;
+					default:
+                        $result['error'] = "$values is not a valid Ombi function";
+						break;
+				}
+			}else{
+                $result['error'] = "No Ombi Action Supplied";
+            }
+
             break;
         default:
             $result = "$action Not Defined As API Function";
@@ -57,4 +77,4 @@ if(!$result){
 }
 //return JSON array
 exit(json_encode($result));
-?>
+?>

+ 7 - 1
auth.php

@@ -4,6 +4,7 @@ require_once("user.php");
 $USER = new User("registration_callback");
 $ban = isset($_GET['ban']) ? strtoupper($_GET['ban']) : "";
 $whitelist = isset($_GET['whitelist']) ? $_GET['whitelist'] : false;
+$blacklist = isset($_GET['blacklist']) ? $_GET['blacklist'] : false;
 $currentIP = get_client_ip();
 
 if ($whitelist) {
@@ -14,6 +15,11 @@ if ($whitelist) {
 		$skipped = true;
 	}
 }
+if ($blacklist) {
+    if(in_array($currentIP, getWhitelist($blacklist))) {
+       !$debug ? exit(http_response_code(401)) : die("$currentIP Blacklisted");
+	}
+}
 if (isset($_GET['admin'])) {
     if($USER->authenticated && $USER->role == "admin" && !in_array(strtoupper($USER->username), getBannedUsers($ban))) {
         !$debug ? exit(http_response_code(200)) : die("$USER->username on $currentIP Authorized At Admin Level");
@@ -36,4 +42,4 @@ if ($skipped) {
 	!$debug ? exit(http_response_code(401)) : die("$USER->username on $currentIP Not Authorized Nor On Whitelist");
 }
 
-?>
+?>

+ 2 - 1
composer.json

@@ -6,6 +6,7 @@
         "phpmailer/phpmailer": "^5.2",
         "guzzlehttp/guzzle": "^6.2",
         "php-http/guzzle6-adapter": "^1.1",
-        "sparkpost/sparkpost": "^2.1"
+        "sparkpost/sparkpost": "^2.1",
+        "lcobucci/jwt": "^3.2"
     }
 }

+ 59 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "61c2611113fccd763f265883f6d8d0bc",
+    "content-hash": "8ed133f69f0edb58bde63a65043653a0",
     "packages": [
         {
             "name": "clue/stream-filter",
@@ -341,6 +341,64 @@
             "description": "PHP Sonarr API Wrapper",
             "time": "2016-02-07T18:57:43+00:00"
         },
+        {
+            "name": "lcobucci/jwt",
+            "version": "3.2.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/lcobucci/jwt.git",
+                "reference": "0b5930be73582369e10c4d4bb7a12bac927a203c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/lcobucci/jwt/zipball/0b5930be73582369e10c4d4bb7a12bac927a203c",
+                "reference": "0b5930be73582369e10c4d4bb7a12bac927a203c",
+                "shasum": ""
+            },
+            "require": {
+                "ext-openssl": "*",
+                "php": ">=5.5"
+            },
+            "require-dev": {
+                "mdanter/ecc": "~0.3.1",
+                "mikey179/vfsstream": "~1.5",
+                "phpmd/phpmd": "~2.2",
+                "phpunit/php-invoker": "~1.1",
+                "phpunit/phpunit": "~4.5",
+                "squizlabs/php_codesniffer": "~2.3"
+            },
+            "suggest": {
+                "mdanter/ecc": "Required to use Elliptic Curves based algorithms."
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Lcobucci\\JWT\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Luís Otávio Cobucci Oblonczyk",
+                    "email": "lcobucci@gmail.com",
+                    "role": "Developer"
+                }
+            ],
+            "description": "A simple library to work with JSON Web Token and JSON Web Signature",
+            "keywords": [
+                "JWS",
+                "jwt"
+            ],
+            "time": "2017-09-01T08:23:26+00:00"
+        },
         {
             "name": "php-http/discovery",
             "version": "1.2.1",

+ 5 - 0
config/configDefaults.php

@@ -93,9 +93,13 @@ return array(
 	"smtpHostType" => "tls",
 	"homepageNoticeTitle" => "",
 	"homepageNoticeMessage" => "",
+	"homepageNoticeTitleGuest" => "",
+	"homepageNoticeMessageGuest" => "",
 	"homepageNoticeType" => "success",
+	"homepageNoticeTypeGuest" => "success",
 	"homepageNoticeAuth" => "false",
 	"homepageNoticeLayout" => "elegant",
+	"homepageNoticeLayoutGuest" => "elegant",
 	"ipInfoToken" => "ddd0c072ad5021",
 	"historyRefresh" => "120000",
 	"downloadRefresh" => "30000",
@@ -132,5 +136,6 @@ return array(
 	"homepageOrderembyrecent" => '11',
 	"homepageOrderombi" => '12',
 	"homepageOrdercalendar" => '13',
+	"homepageOrdernoticeguest" => '14',
 	'requestedUserOnly' => 'true',
 );

+ 10 - 10
error.php

@@ -41,16 +41,16 @@ foreach(loadAppearance() as $key => $value) {
 //error stuff
 $requested = $_SERVER['REQUEST_URI'];
 $codes = array(
-       400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy'),
-       401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy'),
-       403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy'),
-       404 => array('Not Found', $requested . ' was not found on this server.', 'confused'),
-       405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused'),
-       408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy'),
-       500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused'),
-       502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused'),
-       503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused'),
-       504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused'),
+       400 => array('Bad Request', 'The server cannot or will not process the request due to an apparent client error.', 'sowwy','400'),
+       401 => array('Unauthorized', 'You do not have access to this page.', 'sowwy','401'),
+       403 => array('Forbidden', 'The server has refused to fulfill your request.', 'sowwy','403'),
+       404 => array('Not Found', $requested . ' was not found on this server.', 'confused','404'),
+       405 => array('Method Not Allowed', 'The method specified in the Request-Line is not allowed for the specified resource.', 'confused','405'),
+       408 => array('Request Timeout', 'Your browser failed to send a request in the time allowed by the server.', 'sowwy','408'),
+       500 => array('Internal Server Error', 'The request was unsuccessful due to an unexpected condition encountered by the server.', 'confused','500'),
+       502 => array('Bad Gateway', 'The server received an invalid response from the upstream server while trying to fulfill the request.', 'confused','502'),
+       503 => array('Service Unavailable', 'The server is currently unavailable (because it is overloaded or down for maintenance).', 'confused','503'),
+       504 => array('Gateway Timeout', 'The upstream server failed to send a request in the time allowed by the server.', 'confused','504'),
        999 => array('Not Logged In', 'You need to be logged in to access this page.', 'confused', '401'),
 );
 $errorTitle = ($codes[$status][0]) ? $codes[$status][0] : "Error";

+ 126 - 12
functions.php

@@ -2,7 +2,7 @@
 
 // ===================================
 // Define Version
- define('INSTALLEDVERSION', '1.601');
+ define('INSTALLEDVERSION', '1.61');
 // ===================================
 $debugOrganizr = true;
 if($debugOrganizr == true && file_exists('debug.php')){ require_once('debug.php'); }
@@ -24,6 +24,7 @@ function homepageOrder(){
 		"homepageOrderembyrecent" => homepageOrderembyrecent,
 		"homepageOrderombi" => homepageOrderombi,
 		"homepageOrdercalendar" => homepageOrdercalendar,
+		"homepageOrdernoticeguest" => homepageOrdernoticeguest,
 	);
 	asort($homepageOrder);
 	return $homepageOrder;
@@ -37,6 +38,57 @@ function debug_out($variable, $die = false) {
 	if ($die) { http_response_code(503); die(); }
 }
 
+//Cookie Function
+function coookie($type, $name, $value = '', $days = -1, $http = true){
+	if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https"){
+		$Secure = true;
+ 	   	$HTTPOnly = true;
+	}elseif (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
+		$Secure = true;
+ 	   	$HTTPOnly = true;
+	} else {
+		$Secure = false;
+ 	   	$HTTPOnly = false;
+   }
+   if(!$http){ $HTTPOnly = false; }
+	$Path = '/';
+	$Domain = $_SERVER['HTTP_HOST'];
+	$Port = strpos($Domain, ':');
+	if ($Port !== false)  $Domain = substr($Domain, 0, $Port);
+	$Port = strpos($Domain, ':');
+	$check = substr_count($Domain, '.');
+	if($check >= 3){
+		if(is_numeric($Domain[0])){
+			$Domain = '';
+		}else{
+			$Domain = '.'.explode('.',$Domain)[1].'.'.explode('.',$Domain)[2].'.'.explode('.',$Domain)[3];
+		}
+	}elseif($check == 2){
+		$Domain = '.'.explode('.',$Domain)[1].'.'.explode('.',$Domain)[2];
+	}elseif($check == 1){
+		$Domain = '.' . $Domain;
+	}else{
+		$Domain = '';
+	}
+	if($type = 'set'){
+		$_COOKIE[$name] = $value;
+		header('Set-Cookie: ' . rawurlencode($name) . '=' . rawurlencode($value)
+							. (empty($days) ? '' : '; expires=' . gmdate('D, d-M-Y H:i:s', time() + (86400 * $days)) . ' GMT')
+							. (empty($Path) ? '' : '; path=' . $Path)
+							. (empty($Domain) ? '' : '; domain=' . $Domain)
+							. (!$Secure ? '' : '; secure')
+							. (!$HTTPOnly ? '' : '; HttpOnly'), false);
+	}elseif($type = 'delete'){
+		unset($_COOKIE[$name]);
+		header('Set-Cookie: ' . rawurlencode($name) . '=' . rawurlencode($value)
+							. (empty($days) ? '' : '; expires=' . gmdate('D, d-M-Y H:i:s', time() - 3600) . ' GMT')
+							. (empty($Path) ? '' : '; path=' . $Path)
+							. (empty($Domain) ? '' : '; domain=' . $Domain)
+							. (!$Secure ? '' : '; secure')
+							. (!$HTTPOnly ? '' : '; HttpOnly'), false);
+	}
+
+}
 // ==== Auth Plugins START ====
 if (function_exists('ldap_connect')) :
 	// Pass credentials to LDAP backend
@@ -1556,6 +1608,23 @@ function upgradeCheck() {
 		$createConfigSuccess = createConfig($config);
 		unset($config);
 	}
+	// Upgrade to 1.603
+	$config = loadConfig();
+	if (isset($config['database_Location']) && (!isset($config['CONFIG_VERSION']) || $config['CONFIG_VERSION'] < '1.603')) {
+		// Update Version and Commit
+		$config['CONFIG_VERSION'] = '1.603';
+		copy('config/config.php', 'config/config['.date('Y-m-d_H-i-s').'][1.601].bak.php');
+		$createConfigSuccess = createConfig($config);
+		unset($config);
+		if(file_exists('org.log')){
+			copy('org.log', DATABASE_LOCATION.'org.log');
+			unlink('org.log');
+		}
+		if(file_exists('loginLog.json')){
+			copy('loginLog.json', DATABASE_LOCATION.'loginLog.json');
+			unlink('loginLog.json');
+		}
+	}
 
 	return true;
 }
@@ -3233,20 +3302,20 @@ function strip($string){
 }
 
 function writeLog($type, $message){
-	if(file_exists("org.log")){
-		if(filesize("org.log") > 500000){
-			rename('org.log','org['.date('Y-m-d').'].log');
+	if(file_exists(DATABASE_LOCATION."org.log")){
+		if(filesize(DATABASE_LOCATION."org.log") > 500000){
+			rename(DATABASE_LOCATION.'org.log',DATABASE_LOCATION.'org['.date('Y-m-d').'].log');
 			$message2 = date("Y-m-d H:i:s")."|".$type."|".strip("ORG LOG: Creating backup of org.log to org[".date('Y-m-d')."].log ")."\n";
-			file_put_contents("org.log", $message2, FILE_APPEND | LOCK_EX);
+			file_put_contents(DATABASE_LOCATION."org.log", $message2, FILE_APPEND | LOCK_EX);
 
 		}
 	}
     $message = date("Y-m-d H:i:s")."|".$type."|".strip($message)."\n";
-    file_put_contents("org.log", $message, FILE_APPEND | LOCK_EX);
+    file_put_contents(DATABASE_LOCATION."org.log", $message, FILE_APPEND | LOCK_EX);
 }
 
 function readLog(){
-    $log = file("org.log",FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
+    $log = file(DATABASE_LOCATION."org.log",FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
     $log = array_reverse($log);
     foreach($log as $line){
 		if(substr_count($line, '|') == 2){
@@ -4164,8 +4233,8 @@ function backupDB(){
 		$orgFiles = array(
 			'css' => 'custom.css',
 			'temp' => 'cus.sd',
-			'orgLog' => 'org.log',
-			'loginLog' => 'loginLog.json',
+			'orgLog' => DATABASE_LOCATION.'org.log',
+			'loginLog' => DATABASE_LOCATION.'loginLog.json',
 			'chatDB' => 'chatpack.db',
 			'config' => 'config/config.php',
 			'database' => DATABASE_LOCATION.'users.db'
@@ -4774,7 +4843,12 @@ function getOmbiToken($username, $password){
 		"rememberMe" => "true",
          );
 	$api = curl_post(OMBIURL."/api/v1/Token", $json, $headers);
-    return json_decode($api['content'], true)['access_token'];
+	if (isset($api['content'])) {
+		return json_decode($api['content'], true)['access_token'];
+	}else{
+		return false;
+	}
+
 }
 
 function ombiAction($id, $action, $type){
@@ -5066,14 +5140,42 @@ function outputOmbiRequests($header = "Requested Content", $items, $script = fal
 	$hideMenu .= '<li data-filter="item-all" data-name="Content" data-filter-on="false"><a class="js-filter-all" href="javascript:void(0)">All</a></li>';
     $hideMenu .= '</ul></div></div>';
     // If None Populate Empty Item
-    if (!count($items)) {
-        return '<div id="recentRequests" class="content-box box-shadow big-box"><h5 class="text-center">'.$header.'</h5><p class="text-center">No Requests Found</p></div>';
+    //if (count(array_flip($items)) < 1) {
+	if(!array_filter($items)) {
+        return '<div id="recentRequests"></div>';
     }else{
 		$className = str_replace(' ', '', $header);
         return '<div id="recentRequests" class="content-box box-shadow big-box"><h5 id="requestContent-title" style="margin-bottom: -20px" class="text-center">'.$header.'</h5><div class="recentHeader inbox-pagination '.$className.'">'.$hideMenu.'</div><br/><br/><div class="recentItems-request" data-name="'.$className.'">'.implode('',$items).'</div></div>'.($script?'<script>'.$script.'</script>':'');
     }
 }
 
+function ombiAPI($action){
+	$headers = array(
+		"Accept" => "application/json",
+		"Content-Type" => "application/json",
+		"Apikey" => OMBIKEY
+	);
+	$body = array();
+	switch ($action) {
+		case 'plex-cache':
+			$api = curl_post(OMBIURL."/api/v1/Job/plexcontentcacher", $body, $headers);
+			break;
+		default:
+			break;
+	}
+	if(is_array($api) || is_object($api)){
+		switch ($api['http_code']['http_code']){
+			case 200:
+				return true;
+				break;
+			default:
+				return false;
+		}
+	}else{
+		return false;
+	}
+}
+
 function loadIcons(){
 	$dirname = "images/";
 	$images = scandir($dirname);
@@ -5113,6 +5215,13 @@ function buildHomepageSettings(){
 					$class .= ' faded';
 				}
 				break;
+			case 'homepageOrdernoticeguest':
+				$class = 'palette-Cyan-A400 bg gray';
+				$image = 'images/pin.png';
+				if(empty(HOMEPAGENOTICETITLEGUEST) && empty(HOMEPAGENOTICEMESSAGEGUEST)){
+					$class .= ' faded';
+				}
+				break;
 			case 'homepageOrderspeedtest':
 				$class = 'red-bg';
 				$image = 'images/settings/full-color/png/64px/speedometer.png';
@@ -5235,6 +5344,11 @@ function buildHomepageItem($homepageItem, $group, $user){
 				$homepageItemBuilt .= buildHomepageNotice(HOMEPAGENOTICELAYOUT, HOMEPAGENOTICETYPE, HOMEPAGENOTICETITLE, HOMEPAGENOTICEMESSAGE);
 			}
 			break;
+		case 'homepageOrdernoticeguest':
+			if ($group == 'guest' && HOMEPAGENOTICETITLEGUEST && HOMEPAGENOTICETYPEGUEST && HOMEPAGENOTICEMESSAGEGUEST && HOMEPAGENOTICELAYOUTGUEST) {
+				$homepageItemBuilt .= buildHomepageNotice(HOMEPAGENOTICELAYOUTGUEST, HOMEPAGENOTICETYPEGUEST, HOMEPAGENOTICETITLEGUEST, HOMEPAGENOTICEMESSAGEGUEST);
+			}
+			break;
 		case 'homepageOrderspeedtest':
 			if(SPEEDTEST == "true" && qualifyUser(SPEEDTESTAUTH)){
 				$homepageItemBuilt .= '

+ 6 - 6
index.php

@@ -1045,7 +1045,7 @@ $group = (isset($group) ? $group : "guest");
 			</div>
 		</div>
 		<?php } ?>
-		<?php if (file_exists('config/config.php') && $configReady == "Yes" && $tabSetup == "No" && SPLASH == "true" && $splash) {?>
+		<?php if (file_exists('config/config.php') && $configReady == "Yes" && $tabSetup == "No" && SPLASH == "true" && $splash && count($splash) > 1) {?>
 		<div id="splashScreen" class="splash-modal modal fade">
 			<div style="background:<?=$sidebar;?>;" class="table-wrapper big-box">
 
@@ -1348,12 +1348,12 @@ $group = (isset($group) ? $group : "guest");
 		<?php if($configReady == "Yes") {
 			if($USER->authenticated){ ?>
 				if (localStorageSupport) {
-					if(getCookie('mpt') !== ''){
-						localStorage.setItem("myPlexAccessToken",getCookie('mpt'));
-					}
-					if(getCookie('Auth') !== ''){
-						localStorage.setItem("id_token",getCookie('Auth'));
+					<?php if(isset($_COOKIE['mpt'])){
+						echo 'localStorage.setItem("myPlexAccessToken","'.$_COOKIE['mpt'].'");';
 					}
+					if(isset($_COOKIE['Auth'])){
+						echo 'localStorage.setItem("id_token","'.$_COOKIE['Auth'].'");';
+					}?>
 				}
 		<?php }else{?>
 			if (localStorageSupport) {

+ 2 - 2
lang/de.ini

@@ -21,7 +21,7 @@ REMEMBER_ME = "Angemeldet bleiben"
 FORGOT_PASSWORD = "Passwort vergessen"
 RESET_PASSWORD = "Passwort zurücksetzen"
 DATABASE_PATH = "Datenbankverzeichnis"
-SPECIFY_LOCATION = "Festlegen, wo Datenbankdateien gespeichert werden sollen."
+SPECIFY_LOCATION = "Festlegen, wo Datenbankdateien gespeichert werden sollen.  Please choose a location outside of Web Root!  Your DB files will contain sensitive information!"
 CURRENT_DIRECTORY = "Aktuelles Verzeichnis"
 PARENT_DIRECTORY = "Überverzeichnis"
 SET_DATABASE_LOCATION = "Datenbankverzeichnis festlegen"
@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "Wir benötigen immer Hilfe bei der Übersetzung. Sollten S
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Hintergrund Ladebildschirm"
 HOVER_TEXT = "Einblendungs-Text"
-COOKIE_PASSWORD = "Cookie-Passwort"
+COOKIE_PASSWORD = "Cookie-Passwort - used for Multiple Logins, Cookie Authorization and auth_request"
 CREATE_USER = "Konto registrieren"
 ENTER_PASSWORD_TO_REGISTER = "Registrierungspasswort eingeben"
 SUBMIT = "Absenden"

+ 2 - 2
lang/en.ini

@@ -21,7 +21,7 @@ REMEMBER_ME = "Remember Me"
 FORGOT_PASSWORD = "Forgot Password"
 RESET_PASSWORD = "Reset Password"
 DATABASE_PATH = "Database Path"
-SPECIFY_LOCATION = "Specify the location of which you want to save your database files."
+SPECIFY_LOCATION = "Specify the location of which you want to save your database files.  Please choose a location outside of Web Root!  Your DB files will contain sensitive information!"
 CURRENT_DIRECTORY = "Current Directory"
 PARENT_DIRECTORY = "Parent Directory"
 SET_DATABASE_LOCATION = "Set Database Location"
@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins, Cookie Authorization and auth_request"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 2 - 2
lang/es.ini

@@ -21,7 +21,7 @@ REMEMBER_ME = "Recuérdame"
 FORGOT_PASSWORD = "¿Has olvidado tu contraseña?"
 RESET_PASSWORD = "Restablecimiento de contraseña"
 DATABASE_PATH = "Camino de la base de datos"
-SPECIFY_LOCATION = "¿Dónde quieres guardar los archivos de la base de datos?"
+SPECIFY_LOCATION = "¿Dónde quieres guardar los archivos de la base de datos?  Please choose a location outside of Web Root!  Your DB files will contain sensitive information!"
 CURRENT_DIRECTORY = "Directorio actual"
 PARENT_DIRECTORY = "Directorio matriz"
 SET_DATABASE_LOCATION = "Establecer la localización de la base de datos"
@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins, Cookie Authorization and auth_request"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 2 - 2
lang/fr.ini

@@ -21,7 +21,7 @@ REMEMBER_ME = "Se souvenir de moi"
 FORGOT_PASSWORD = "Mot de passe oublié"
 RESET_PASSWORD = "Réinitialiser le mot de passe"
 DATABASE_PATH = "Chemin de la base de donnés"
-SPECIFY_LOCATION = "Spécifier l'emplacement dans laquelle vous voulez sauvegarder les fichiers de la base de données."
+SPECIFY_LOCATION = "Spécifier l'emplacement dans laquelle vous voulez sauvegarder les fichiers de la base de données.  Please choose a location outside of Web Root!  Your DB files will contain sensitive information!"
 CURRENT_DIRECTORY = "Répertoire actuel"
 PARENT_DIRECTORY = "Répertoire parent"
 SET_DATABASE_LOCATION = "Définir l'emplacement de la base de données"
@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins, Cookie Authorization and auth_request"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 2 - 2
lang/it.ini

@@ -21,7 +21,7 @@ REMEMBER_ME = "Ricordami"
 FORGOT_PASSWORD = "Password dimenticata"
 RESET_PASSWORD = "Ripristina la password"
 DATABASE_PATH = "Percorso del database"
-SPECIFY_LOCATION = "Specifica dove vuoi salvare i tuoi file del database"
+SPECIFY_LOCATION = "Specifica dove vuoi salvare i tuoi file del database.  Please choose a location outside of Web Root!  Your DB files will contain sensitive information!"
 CURRENT_DIRECTORY = "Cartella corrente"
 PARENT_DIRECTORY = "Cartella superiore"
 SET_DATABASE_LOCATION = "Imposta posizione del database"
@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins, Cookie Authorization and auth_request"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 2 - 2
lang/nl.ini

@@ -21,7 +21,7 @@ REMEMBER_ME = "Onthouden"
 FORGOT_PASSWORD = "Wachtwoord vergeten"
 RESET_PASSWORD = "Reset wachtwoord"
 DATABASE_PATH = "Database Pad"
-SPECIFY_LOCATION = "Specificeer de locatie waar je de database bestanden op wilt slaan."
+SPECIFY_LOCATION = "Specificeer de locatie waar je de database bestanden op wilt slaan.  Please choose a location outside of Web Root!  Your DB files will contain sensitive information!"
 CURRENT_DIRECTORY = "Huidige map"
 PARENT_DIRECTORY = "Bovenliggende map"
 SET_DATABASE_LOCATION = "Database locatie instellen"
@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "We always need help with translations.  If you speak anoth
 UPGRADE = "Upgrade"
 LOADING_COLOR = "Loading Background"
 HOVER_TEXT = "Hover Text"
-COOKIE_PASSWORD = "Cookie Password"
+COOKIE_PASSWORD = "Cookie Password - used for Multiple Logins, Cookie Authorization and auth_request"
 CREATE_USER = "Create Account"
 ENTER_PASSWORD_TO_REGISTER = "Enter Password To Register"
 SUBMIT = "Submit"

+ 2 - 2
lang/pl.ini

@@ -21,7 +21,7 @@ REMEMBER_ME = "Zapamiętaj mnie"
 FORGOT_PASSWORD = "Zapomniane hasło"
 RESET_PASSWORD = "Resetuj hasło"
 DATABASE_PATH = "Ścieżka bazy danych"
-SPECIFY_LOCATION = "Określ położenie, gdzie chcesz zapisywać swoje pliki baz danych."
+SPECIFY_LOCATION = "Określ położenie, gdzie chcesz zapisywać swoje pliki baz danych.  Please choose a location outside of Web Root!  Your DB files will contain sensitive information!"
 CURRENT_DIRECTORY = "Aktualny katalog"
 PARENT_DIRECTORY = "Nadrzędny katalog"
 SET_DATABASE_LOCATION = "Ustaw położenie bazy danych"
@@ -149,7 +149,7 @@ TRANSLATIONS_ABOUT = "Zawsze potrzebujemy pomocy z tłumaczeniami.  Jeżeli znas
 UPGRADE = "Ulepsz"
 LOADING_COLOR = "Tło ładowania"
 HOVER_TEXT = "Tekst przy najechaniu kursorem"
-COOKIE_PASSWORD = "Hasło ciasteczek"
+COOKIE_PASSWORD = "Hasło ciasteczek - used for Multiple Logins, Cookie Authorization and auth_request"
 CREATE_USER = "Stwórz konto"
 ENTER_PASSWORD_TO_REGISTER = "Wpisz hasło by zarejestrować"
 SUBMIT = "Prześlij"

+ 68 - 11
settings.php

@@ -617,6 +617,7 @@ echo buildSettings(
 							'buttonType' => 'dark',
 							'buttonDrop' => '
 							<ul class="dropdown-menu">
+								<li class="dropdown-header">Choose a Theme Below</li>
 								<li id="open-themes" box="themes-box" onclick"" data-toggle="tooltip" data-placement="top" title="" data-original-title="Custom Themes Created by The Community"><a onclick="" href="#">Themes</a></li>
 								<li id="layerCakeDefault" data-toggle="tooltip" data-placement="top" title="" data-original-title="A 7 color theme based on Organizr"><a onclick="layerCake(\'Basic\',\'layerCake\');$(\'#customCSS_id\').attr(\'data-changed\', \'true\');" href="#">LAYER#CAKE Basic</a></li>
 								<li id="layerCakeCustom" data-toggle="tooltip" data-placement="top" title="" data-original-title="A 32 color theme based on Organizr"><a onclick="layerCake(\'Advanced\',\'layerCake\');$(\'#customCSS_id\').attr(\'data-changed\', \'true\');" href="#">LAYER#CAKE Advanced</a></li>
@@ -1512,6 +1513,46 @@ echo buildSettings(
 		 				'labelTranslate' => 'NOTICE_MESSAGE',
 						'html' => '<div class="summernote" name="homepageNoticeMessage">'.HOMEPAGENOTICEMESSAGE.'</div>',
 					),
+                    array(
+						'type' => 'custom',
+						'html' => '<h2>Not Logged In/Guest Notice</h2>',
+					),
+                    array(
+						'type' => $userSelectType,
+						'labelTranslate' => 'NOTICE_LAYOUT',
+						'name' => 'homepageNoticeLayoutGuest',
+						'value' => HOMEPAGENOTICELAYOUTGUEST,
+						'options' => array(
+							'Elegant' => 'elegant',
+							'Basic' => 'basic',
+							'Jumbotron' => 'jumbotron',
+						),
+					),
+     				array(
+						'type' => $userSelectType,
+						'labelTranslate' => 'NOTICE_COLOR',
+						'name' => 'homepageNoticeTypeGuest',
+						'value' => HOMEPAGENOTICETYPEGUEST,
+						'options' => array(
+							'Green' => 'success',
+							'Blue' => 'primary',
+							'Gray' => 'gray',
+							'Red' => 'danger',
+							'Yellow' => 'warning',
+							'Light Blue' => 'info',
+						),
+					),
+     				array(
+						'type' => 'text',
+						'labelTranslate' => 'NOTICE_TITLE',
+						'name' => 'homepageNoticeTitleGuest',
+						'value' => HOMEPAGENOTICETITLEGUEST,
+					),
+        			array(
+						'type' => 'custom',
+		 				'labelTranslate' => 'NOTICE_MESSAGE',
+						'html' => '<div class="summernote" name="homepageNoticeMessageGuest">'.HOMEPAGENOTICEMESSAGEGUEST.'</div>',
+					),
 				),
 			),
 			array(
@@ -1824,12 +1865,6 @@ echo buildSettings(
 							'onclick' => 'if ($(\'#git_branch_id[data-changed]\').length) { alert(\'Branch was altered, save settings first!\') } else { if (confirm(\''.translate('GIT_FORCE_CONFIRM').'\')) { performUpdate(); ajax_request(\'POST\', \'forceBranchInstall\'); } }',
 						),
 					),
-					array(
-						'type' => 'checkbox',
-						'labelTranslate' => 'MULTIPLE_LOGINS',
-						'name' => 'multipleLogin',
-						'value' => MULTIPLELOGIN,
-					),
 				),
 			),
 			array(
@@ -2273,7 +2308,7 @@ echo buildSettings(
                                         <a href='https://reddit.com/r/organizr' target='_blank' type='button' style="background: #AD80FD" class='btn waves btn-labeled btn-success btn text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-reddit'></i></span>SUBREDDIT</a>
                                         <a href='https://github.com/causefx/Organizr/issues/new' target='_blank' type='button' class='btn waves btn-labeled btn-success btn text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-github-alt'></i></span><?php echo $language->translate("SUBMIT_ISSUE");?></a>
                                         <a href='https://github.com/causefx/Organizr' target='_blank' type='button' class='btn waves btn-labeled btn-primary btn text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-github'></i></span><?php echo $language->translate("VIEW_ON_GITHUB");?></a>
-                                        <a href='https://gitter.im/Organizrr/Lobby' target='_blank' type='button' class='btn waves btn-labeled btn-dark btn text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-comments-o'></i></span><?php echo $language->translate("CHAT_WITH_US");?></a>
+                                        <a href='https://discord.gg/XvbT6nz' target='_blank' type='button' class='btn waves btn-labeled btn-dark btn text-uppercase waves-effect waves-float'><span class='btn-label'><i class='fa fa-comments-o'></i></span><?php echo $language->translate("CHAT_WITH_US");?></a>
                                         <button type="button" class="class='btn waves btn-labeled btn-warning btn text-uppercase waves-effect waves-float" data-toggle="modal" data-target=".Help-Me-modal-lg"><span class='btn-label'><i class='fa fa-life-ring'></i></span><?php echo $language->translate("HELP");?></button>
                                         <!--<button id="deleteToggle" type="button" class="class='btn waves btn-labeled btn-danger btn text-uppercase waves-effect waves-float" ><span class='btn-label'><i class='fa fa-trash'></i></span><?php echo $language->translate("DELETE_DATABASE");?></button>-->
                                     </p>
@@ -2670,13 +2705,16 @@ echo buildSettings(
                                                             <th scope="row"><?=$countUsers;?></th>
 
                                                             <td><?php if(GRAVATAR == "true") : ?><i class="userpic"><img src="https://www.gravatar.com/avatar/<?=$userpic;?>?s=25&d=mm" class="img-circle"></i> &nbsp; <?php endif; ?><?=$row['username'];?></td>
-                                                            <td><?=$row['email'];?></td>
+                                                            <td><input type="text" class="form-control material newemail" name="newemail" value="<?=$row['email'];?>">
+                                                                <button style="display: none" class="btn btn-success btn-sm waves editUserEmail"><i class="fa fa-check"></i></button>
+                                                                <button style="display: none" type="button" class="btn btn-danger btn-sm waves closeEditUserEmail"><i class="fa fa-close"></i></button>
+                                                            </td>
 
                                                             <td><span class="label label-<?=$userActiveColor;?>"><?=$userActive;?></span></td>
 
                                                             <td><?=$lastActive;?></td>
 
-                                                            <td><span class="text-uppercase <?=$userColor;?>"><?=$row['role'];?></span></td>
+                                                            <td><span class="userRole text-uppercase <?=$userColor;?>"><?=$row['role'];?></span></td>
 
                                                             <td id="<?=$row['username'];?>">
 
@@ -2855,14 +2893,14 @@ echo buildSettings(
                             <div class="email-inner-section">
                                 <div class="small-box" id="loginlog">
                                     <div>
-                                        <?php if(file_exists("org.log")){ ?>
+                                        <?php if(file_exists(DATABASE_LOCATION."org.log")){ ?>
                                         <button id="viewOrgLogs" class="btn waves btn-labeled gray-bg text-uppercase waves-effect waves-float" type="button"><span class="btn-label"><i class="fa fa-terminal"></i></span>Organizr Log </button>
                                         <?php } if(file_exists(FAIL_LOG)){ ?>
                                         <button id="viewLoginLogs" class="btn waves btn-labeled grayish-blue-bg text-uppercase waves-effect waves-float" type="button" style="display: none"><span class="btn-label"><i class="fa fa-user"></i></span>Login Log </button>
                                         <?php } ?>
                                     </div>
 
-                                    <?php if(file_exists("org.log")){ ?>
+                                    <?php if(file_exists(DATABASE_LOCATION."org.log")){ ?>
                                     <div id="orgLogTable" class="table-responsive" style="display: none">
                                         <table id="orgLogs" class="datatable display">
                                             <thead>
@@ -3371,6 +3409,25 @@ echo buildSettings(
                 editUsername = $('#unregister').find('#inputUsername');
                 $(editUsername).html('<input type="hidden" name="op" value="unregister"/><input type="hidden" name="username"value="' + parent_id + '" />');
             });
+            $(".newemail").click(function(){
+                $(".editUserEmail").hide();
+                $(".closeEditUserEmail").hide();
+				$(this).parent().find('.editUserEmail').show();
+                $(this).parent().find('.closeEditUserEmail').show();
+            });
+            $(".closeEditUserEmail").click(function(){
+                $(".editUserEmail").hide();
+                $(".closeEditUserEmail").hide();
+            });
+            $(".editUserEmail").click(function(){
+
+                var parent_ids = $(this).parent().parent().attr('id');
+                newemail = $(this).parent().parent().find('input[name=newemail]').val();
+                role = $(this).parent().parent().find('.userRole').text();
+                editUsername = $('#unregister').find('#inputUsername');
+                console.log('user: '+parent_ids+' email: '+newemail+' role: '+role);
+                $(editUsername).html('<input type="hidden" name="op" value="update"/><input type="hidden" name="email" value="'+newemail+'"/><input type="hidden" name="role" value="'+role+'"/><input type="hidden" name="username"value="' + parent_ids + '" />');
+            });
             $(".promoteUser").click(function(){
 
                 var parent_ids = $(this).parent().attr('id');

+ 117 - 79
user.php

@@ -19,7 +19,7 @@
 
     if(file_exists('custom.css')) : define('CUSTOMCSS', 'true'); else : define('CUSTOMCSS', 'false'); endif;
     $notifyExplode = explode("-", NOTIFYEFFECT);
-    define('FAIL_LOG', 'loginLog.json');
+    define('FAIL_LOG', DATABASE_LOCATION.'loginLog.json');
     @date_default_timezone_set(TIMEZONE);
     function guestHash($start, $end){
         $ip   = $_SERVER['REMOTE_ADDR'];
@@ -28,7 +28,11 @@
     }
 
 	define('GUEST_HASH', "guest-".guestHash(0, 5));
-
+	//JWT tokens
+	use Lcobucci\JWT\Builder;
+	use Lcobucci\JWT\Signer\Hmac\Sha256;
+	use Lcobucci\JWT\ValidationData;
+	use Lcobucci\JWT\Parser;
 	class User
 	{
 		// =======================================================================
@@ -132,7 +136,7 @@
             $mail = new PHPMailer;
             $mail->isSMTP();
             $mail->Host = SMTPHOST;
-            $mail->SMTPAuth = SMTPHOSTAUTH;
+            $mail->SMTPAuth = (SMTPHOSTAUTH == "true" || SMTPHOSTAUTH == true) ? true : false;
             $mail->Username = SMTPHOSTUSERNAME;
             $mail->Password = SMTPHOSTPASSWORD;
             $mail->SMTPSecure = SMTPHOSTTYPE;
@@ -152,16 +156,46 @@
             }
 
         }
-
+		function jwtParse(){
+			$result = array();
+			$result['valid'] = false;
+			//Check Token with JWT
+			if(isset($_COOKIE['Organizr_Token'])){
+				//Set key
+				$key = (COOKIEPASSWORD != '') ? COOKIEPASSWORD : DATABASE_LOCATION;
+				//HSA256 Encyption
+				$signer = new Sha256();
+				$jwttoken = (new Parser())->parse((string) $_COOKIE['Organizr_Token']); // Parses from a string
+				$jwttoken->getHeaders(); // Retrieves the token header
+				$jwttoken->getClaims(); // Retrieves the token claims
+				//Start Validation
+				if($jwttoken->verify($signer, $key)){
+					$data = new ValidationData(); // It will use the current time to validate (iat, nbf and exp)
+					$data->setIssuer('Organizr');
+					$data->setAudience('Organizr');
+					//$data->setId('4f1g23a12aas');
+					if($jwttoken->validate($data)){
+						$result['valid'] = true;
+						$result['username'] = $jwttoken->getClaim('username');
+						$result['role'] = $jwttoken->getClaim('role');
+					}
+				}
+			}
+			if($result['valid'] == true){ return $result; }else{ return null; }
+		}
 		// class object constructor
 		function __construct($registration_callback=false)
 		{
 			// session management comes first. Warnings are repressed with @ because it will warn if something else already called session_start()
 			@session_start();
-            if(!isset($_COOKIE['Organizr'])) {
+            if(!isset($_COOKIE['Organizr_Token'])) {
                 if (empty($_SESSION["username"]) || empty($_SESSION["token"])) $this->resetSession();
             }else{
-                $_SESSION["username"] = $_COOKIE['OrganizrU'];
+				if($this->jwtParse()){
+					$_SESSION["username"] = $this->jwtParse()['username'];
+				}else{
+					$this->resetSession();
+				}
             }
 			// file location for the user database
 			$dbfile = DATABASE_LOCATION.'users.db';
@@ -400,21 +434,11 @@
 		{
 			$_SESSION["username"] = User::GUEST_USER;
 			$_SESSION["token"] = -1;
-            unset($_COOKIE['Organizr']);
-            setcookie('Organizr', '', time() - 3600, '/', DOMAIN);
-            setcookie('Organizr', '', time() - 3600, '/');
-            unset($_COOKIE['OrganizrU']);
-            setcookie('OrganizrU', '', time() - 3600, '/', DOMAIN);
-            setcookie('OrganizrU', '', time() - 3600, '/');
-            unset($_COOKIE['cookiePassword']);
-            setcookie("cookiePassword", '', time() - 3600, '/', DOMAIN);
-            setcookie("cookiePassword", '', time() - 3600, '/');
-			unset($_COOKIE['Auth']);
-            setcookie("Auth", '', time() - 3600, '/', DOMAIN);
-            setcookie("Auth", '', time() - 3600, '/');
-			unset($_COOKIE['mpt']);
-            setcookie("mpt", '', time() - 3600, '/', DOMAIN);
-            setcookie("mpt", '', time() - 3600, '/');
+			coookie('delete','cookiePassword');
+			coookie('delete','Auth');
+			coookie('delete','mpt');
+			coookie('delete','Organizr_Token');
+
 		}
 		/**
 		 * Validate a username. Empty usernames or names
@@ -450,40 +474,34 @@
 			if($this->is_user_active($username)===false) { return false; }
 			// logged in, but do the tokens match?
 			$token = $this->get_user_token($username);
-            if(isset($_COOKIE["Organizr"])){
-                if($_COOKIE["Organizr"] == $token){
-					// active, using the correct token -> authenticated
-					setcookie("cookiePassword", COOKIEPASSWORD, time() + (86400 * 7), "/", DOMAIN);
-					return true;
-                }else{
-                    $this->error("cookie token mismatch for $username");
-                    unset($_COOKIE['Organizr']);
-                    setcookie('Organizr', '', time() - 3600, '/', DOMAIN);
-                    setcookie('Organizr', '', time() - 3600, '/');
-                    unset($_COOKIE['OrganizrU']);
-                    setcookie('OrganizrU', '', time() - 3600, '/', DOMAIN);
-                    setcookie('OrganizrU', '', time() - 3600, '/');
-                    unset($_COOKIE['cookiePassword']);
-                    setcookie("cookiePassword", '', time() - 3600, '/', DOMAIN);
-                    setcookie("cookiePassword", '', time() - 3600, '/');
-					unset($_COOKIE['Auth']);
-		            setcookie("Auth", '', time() - 3600, '/', DOMAIN);
-		            setcookie("Auth", '', time() - 3600, '/');
-					unset($_COOKIE['mpt']);
-		            setcookie("mpt", '', time() - 3600, '/', DOMAIN);
-		            setcookie("mpt", '', time() - 3600, '/');
-                    return false;
-                }
-            }else{
-                if($token != $_SESSION["token"]) {
-                    $this->error("token mismatch for $username");
-                    return false;
-                }else{
-					// active, using the correct token -> authenticated
-	                 setcookie("cookiePassword", COOKIEPASSWORD, time() + (86400 * 7), "/", DOMAIN);
-	                 return true;
+			//Check Token with Session
+			if(isset($_SESSION["token"])){
+				if($token == $_SESSION["token"]) { coookie('set','cookiePassword',COOKIEPASSWORD,7); return true; }
+			}
+			//Check Token with JWT
+			if(isset($_COOKIE['Organizr_Token'])){
+				//Set key
+				$key = (COOKIEPASSWORD != '') ? COOKIEPASSWORD : DATABASE_LOCATION;
+				//HSA256 Encyption
+				$signer = new Sha256();
+				$jwttoken = (new Parser())->parse((string) $_COOKIE['Organizr_Token']); // Parses from a string
+				$jwttoken->getHeaders(); // Retrieves the token header
+				$jwttoken->getClaims(); // Retrieves the token claims
+				//Start Validation
+				if($jwttoken->verify($signer, $key)){
+					$data = new ValidationData(); // It will use the current time to validate (iat, nbf and exp)
+					$data->setIssuer('Organizr');
+					$data->setAudience('Organizr');
+					//$data->setId('4f1g23a12aas');
+					if($jwttoken->validate($data)){
+						return true;
+					}
 				}
-            }
+			}
+            $this->error("token mismatch for $username");
+            $this->resetSession();
+			return false;
+
 		}
 		/**
 		 * Unicode friendly(ish) version of strtolower
@@ -527,11 +545,20 @@
 		function register_user($username, $email, $sha1, &$registration_callback = false, $settings, $validate) {
 			//Admin bypass
 			if($validate == null){
+				$override = false;
 				$adminList = $this->get_admin_list();
 				if($adminList){
 					if(in_arrayi($_SESSION["username"], $adminList)){
 						$token = $this->get_user_token($_SESSION["username"]);
 						if($token == $_SESSION["token"]) {
+							$override = true;
+						}
+						if(isset($_COOKIE['Organizr_Token'])) {
+							if($this->jwtParse()){
+								$override = true;
+							}
+			            }
+						if($override == true) {
 							$validate = true;
 							writeLog("success", "Admin Override on registration for $username info");
 						}
@@ -680,7 +707,7 @@
 
 			if ($authSuccess) {
 				// Make sure user exists in database
-				$query = "SELECT username FROM users WHERE username = '".$username."' COLLATE NOCASE";
+				$query = "SELECT role FROM users WHERE username = '".$username."' COLLATE NOCASE";
 				$userExists = false;
 				foreach($this->database->query($query) as $data) {
 					$userExists = true;
@@ -691,25 +718,44 @@
 					// authentication passed - 1) mark active and update token
 					$this->mark_user_active($username);
 					$this->setSession($username, $this->update_user_token($username, $sha1, false));
+					$gotUserRole = $this->get_user_role($username);
+					//Create JWT
+					//Set key
+					$key = (COOKIEPASSWORD != '') ? COOKIEPASSWORD : DATABASE_LOCATION;
+					//HSA256 Encyption
+					$signer = new Sha256();
+					//Start Builder
+					$jwttoken = (new Builder())->setIssuer('Organizr') // Configures the issuer (iss claim)
+					                        ->setAudience('Organizr') // Configures the audience (aud claim)
+					                        ->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item
+					                        ->setIssuedAt(time()) // Configures the time that the token was issue (iat claim)
+					                        ->setExpiration(time() + (86400 * 7)) // Configures the expiration time of the token (exp claim)
+					                        ->set('username', $username) // Configures a new claim, called "username"
+					                        ->set('role', $gotUserRole) // Configures a new claim, called "role"
+					                        ->sign($signer, $key) // creates a signature using "testing" as key
+					                        ->getToken(); // Retrieves the generated token
+					$jwttoken->getHeaders(); // Retrieves the token headers
+					$jwttoken->getClaims(); // Retrieves the token claims
+					$_SESSION["Organizr_Token"] = $jwttoken;
 					// authentication passed - 2) signal authenticated
 					if($remember == "true") {
-						setcookie("Organizr", $this->get_user_token($username), time() + (86400 * 7), "/", DOMAIN);
-						setcookie("OrganizrU", $username, time() + (86400 * 7), "/", DOMAIN);
-
+						coookie('set','Organizr_Token',$jwttoken,7);
+					}else{
+						coookie('set','Organizr_Token',$jwttoken,1);
 					}
 					if(OMBIURL){
 						$ombiToken = getOmbiToken($username, $password);
 						if($ombiToken){
-							setcookie("Auth", $ombiToken, time() + (86400 * 7), "/", DOMAIN);
+							coookie('set','Auth',$ombiToken,7, false);
 						}
 					}
 					if(PLEXURL && isset($authSuccess['token'])){
-						setcookie("mpt", $authSuccess['token'], time() + (86400 * 7), "/", DOMAIN);
+						coookie('set','mpt',$authSuccess['token'],7);
 					}
 					$this->info("Welcome $username");
 					file_put_contents(FAIL_LOG, $buildLog($username, "good_auth"));
 					chmod(FAIL_LOG, 0660);
-					setcookie("cookiePassword", COOKIEPASSWORD, time() + (86400 * 7), "/", DOMAIN);
+					coookie('set','cookiePassword',COOKIEPASSWORD,7);
      				writeLog("success", "$username has logged in");
 					return true;
 				} else if (AUTHBACKENDCREATE !== 'false' && $surface) {
@@ -763,11 +809,18 @@
 			}else{
 				$token = $this->get_user_token($_SESSION["username"]);
 				if($token != $_SESSION["token"]) {
+					$override = false;
+				}
+				if(isset($_COOKIE['Organizr_Token'])) {
+					if($this->jwtParse()){
+						$override = true;
+					}
+				}
+				if($override){
+					writeLog("success", "Admin Override on update for $username info");
+				}else{
 					writeLog("error", $_SESSION["username"]." has requested info update using token: $token");
 					$this->error("token mismatch for ".$_SESSION["username"]);
-					return false;
-				}else{
-					writeLog("success", "Admin Override on update for $username info");
 				}
 			}
 			if($email !="") {
@@ -843,21 +896,6 @@
 			$this->database->exec($update);
 			$this->resetSession();
 			$this->info("Buh-Bye <strong>$username</strong>!");
-            unset($_COOKIE['Organizr']);
-            setcookie('Organizr', '', time() - 3600, '/', DOMAIN);
-            setcookie('Organizr', '', time() - 3600, '/');
-            unset($_COOKIE['OrganizrU']);
-            setcookie('OrganizrU', '', time() - 3600, '/', DOMAIN);
-            setcookie('OrganizrU', '', time() - 3600, '/');
-            unset($_COOKIE['cookiePassword']);
-            setcookie("cookiePassword", '', time() - 3600, '/', DOMAIN);
-            setcookie("cookiePassword", '', time() - 3600, '/');
-			unset($_COOKIE['Auth']);
-            setcookie("Auth", '', time() - 3600, '/', DOMAIN);
-            setcookie("Auth", '', time() - 3600, '/');
-			unset($_COOKIE['mpt']);
-            setcookie("mpt", '', time() - 3600, '/', DOMAIN);
-            setcookie("mpt", '', time() - 3600, '/');
    			writeLog("success", "$username has signed out");
 			return true;
 		}

+ 0 - 169
vendor/composer/autoload_classmap.php

@@ -6,181 +6,12 @@ $vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(
-    'Clue\\StreamFilter\\CallbackFilter' => $vendorDir . '/clue/stream-filter/src/CallbackFilter.php',
     'EasyPeasyICS' => $vendorDir . '/phpmailer/phpmailer/extras/EasyPeasyICS.php',
-    'GuzzleHttp\\Client' => $vendorDir . '/guzzlehttp/guzzle/src/Client.php',
-    'GuzzleHttp\\ClientInterface' => $vendorDir . '/guzzlehttp/guzzle/src/ClientInterface.php',
-    'GuzzleHttp\\Cookie\\CookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
-    'GuzzleHttp\\Cookie\\CookieJarInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php',
-    'GuzzleHttp\\Cookie\\FileCookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php',
-    'GuzzleHttp\\Cookie\\SessionCookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php',
-    'GuzzleHttp\\Cookie\\SetCookie' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/SetCookie.php',
-    'GuzzleHttp\\Exception\\BadResponseException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/BadResponseException.php',
-    'GuzzleHttp\\Exception\\ClientException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ClientException.php',
-    'GuzzleHttp\\Exception\\ConnectException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ConnectException.php',
-    'GuzzleHttp\\Exception\\GuzzleException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/GuzzleException.php',
-    'GuzzleHttp\\Exception\\RequestException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/RequestException.php',
-    'GuzzleHttp\\Exception\\SeekException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/SeekException.php',
-    'GuzzleHttp\\Exception\\ServerException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ServerException.php',
-    'GuzzleHttp\\Exception\\TooManyRedirectsException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php',
-    'GuzzleHttp\\Exception\\TransferException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/TransferException.php',
-    'GuzzleHttp\\HandlerStack' => $vendorDir . '/guzzlehttp/guzzle/src/HandlerStack.php',
-    'GuzzleHttp\\Handler\\CurlFactory' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php',
-    'GuzzleHttp\\Handler\\CurlFactoryInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php',
-    'GuzzleHttp\\Handler\\CurlHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php',
-    'GuzzleHttp\\Handler\\CurlMultiHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php',
-    'GuzzleHttp\\Handler\\EasyHandle' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/EasyHandle.php',
-    'GuzzleHttp\\Handler\\MockHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/MockHandler.php',
-    'GuzzleHttp\\Handler\\Proxy' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/Proxy.php',
-    'GuzzleHttp\\Handler\\StreamHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/StreamHandler.php',
-    'GuzzleHttp\\MessageFormatter' => $vendorDir . '/guzzlehttp/guzzle/src/MessageFormatter.php',
-    'GuzzleHttp\\Middleware' => $vendorDir . '/guzzlehttp/guzzle/src/Middleware.php',
-    'GuzzleHttp\\Pool' => $vendorDir . '/guzzlehttp/guzzle/src/Pool.php',
-    'GuzzleHttp\\PrepareBodyMiddleware' => $vendorDir . '/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php',
-    'GuzzleHttp\\Promise\\AggregateException' => $vendorDir . '/guzzlehttp/promises/src/AggregateException.php',
-    'GuzzleHttp\\Promise\\CancellationException' => $vendorDir . '/guzzlehttp/promises/src/CancellationException.php',
-    'GuzzleHttp\\Promise\\Coroutine' => $vendorDir . '/guzzlehttp/promises/src/Coroutine.php',
-    'GuzzleHttp\\Promise\\EachPromise' => $vendorDir . '/guzzlehttp/promises/src/EachPromise.php',
-    'GuzzleHttp\\Promise\\FulfilledPromise' => $vendorDir . '/guzzlehttp/promises/src/FulfilledPromise.php',
-    'GuzzleHttp\\Promise\\Promise' => $vendorDir . '/guzzlehttp/promises/src/Promise.php',
-    'GuzzleHttp\\Promise\\PromiseInterface' => $vendorDir . '/guzzlehttp/promises/src/PromiseInterface.php',
-    'GuzzleHttp\\Promise\\PromisorInterface' => $vendorDir . '/guzzlehttp/promises/src/PromisorInterface.php',
-    'GuzzleHttp\\Promise\\RejectedPromise' => $vendorDir . '/guzzlehttp/promises/src/RejectedPromise.php',
-    'GuzzleHttp\\Promise\\RejectionException' => $vendorDir . '/guzzlehttp/promises/src/RejectionException.php',
-    'GuzzleHttp\\Promise\\TaskQueue' => $vendorDir . '/guzzlehttp/promises/src/TaskQueue.php',
-    'GuzzleHttp\\Promise\\TaskQueueInterface' => $vendorDir . '/guzzlehttp/promises/src/TaskQueueInterface.php',
-    'GuzzleHttp\\Psr7\\AppendStream' => $vendorDir . '/guzzlehttp/psr7/src/AppendStream.php',
-    'GuzzleHttp\\Psr7\\BufferStream' => $vendorDir . '/guzzlehttp/psr7/src/BufferStream.php',
-    'GuzzleHttp\\Psr7\\CachingStream' => $vendorDir . '/guzzlehttp/psr7/src/CachingStream.php',
-    'GuzzleHttp\\Psr7\\DroppingStream' => $vendorDir . '/guzzlehttp/psr7/src/DroppingStream.php',
-    'GuzzleHttp\\Psr7\\FnStream' => $vendorDir . '/guzzlehttp/psr7/src/FnStream.php',
-    'GuzzleHttp\\Psr7\\InflateStream' => $vendorDir . '/guzzlehttp/psr7/src/InflateStream.php',
-    'GuzzleHttp\\Psr7\\LazyOpenStream' => $vendorDir . '/guzzlehttp/psr7/src/LazyOpenStream.php',
-    'GuzzleHttp\\Psr7\\LimitStream' => $vendorDir . '/guzzlehttp/psr7/src/LimitStream.php',
-    'GuzzleHttp\\Psr7\\MessageTrait' => $vendorDir . '/guzzlehttp/psr7/src/MessageTrait.php',
-    'GuzzleHttp\\Psr7\\MultipartStream' => $vendorDir . '/guzzlehttp/psr7/src/MultipartStream.php',
-    'GuzzleHttp\\Psr7\\NoSeekStream' => $vendorDir . '/guzzlehttp/psr7/src/NoSeekStream.php',
-    'GuzzleHttp\\Psr7\\PumpStream' => $vendorDir . '/guzzlehttp/psr7/src/PumpStream.php',
-    'GuzzleHttp\\Psr7\\Request' => $vendorDir . '/guzzlehttp/psr7/src/Request.php',
-    'GuzzleHttp\\Psr7\\Response' => $vendorDir . '/guzzlehttp/psr7/src/Response.php',
-    'GuzzleHttp\\Psr7\\ServerRequest' => $vendorDir . '/guzzlehttp/psr7/src/ServerRequest.php',
-    'GuzzleHttp\\Psr7\\Stream' => $vendorDir . '/guzzlehttp/psr7/src/Stream.php',
-    'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => $vendorDir . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php',
-    'GuzzleHttp\\Psr7\\StreamWrapper' => $vendorDir . '/guzzlehttp/psr7/src/StreamWrapper.php',
-    'GuzzleHttp\\Psr7\\UploadedFile' => $vendorDir . '/guzzlehttp/psr7/src/UploadedFile.php',
-    'GuzzleHttp\\Psr7\\Uri' => $vendorDir . '/guzzlehttp/psr7/src/Uri.php',
-    'GuzzleHttp\\Psr7\\UriNormalizer' => $vendorDir . '/guzzlehttp/psr7/src/UriNormalizer.php',
-    'GuzzleHttp\\Psr7\\UriResolver' => $vendorDir . '/guzzlehttp/psr7/src/UriResolver.php',
-    'GuzzleHttp\\RedirectMiddleware' => $vendorDir . '/guzzlehttp/guzzle/src/RedirectMiddleware.php',
-    'GuzzleHttp\\RequestOptions' => $vendorDir . '/guzzlehttp/guzzle/src/RequestOptions.php',
-    'GuzzleHttp\\RetryMiddleware' => $vendorDir . '/guzzlehttp/guzzle/src/RetryMiddleware.php',
-    'GuzzleHttp\\TransferStats' => $vendorDir . '/guzzlehttp/guzzle/src/TransferStats.php',
-    'GuzzleHttp\\UriTemplate' => $vendorDir . '/guzzlehttp/guzzle/src/UriTemplate.php',
-    'Http\\Adapter\\Guzzle6\\Client' => $vendorDir . '/php-http/guzzle6-adapter/src/Client.php',
-    'Http\\Adapter\\Guzzle6\\Promise' => $vendorDir . '/php-http/guzzle6-adapter/src/Promise.php',
-    'Http\\Client\\Exception' => $vendorDir . '/php-http/httplug/src/Exception.php',
-    'Http\\Client\\Exception\\HttpException' => $vendorDir . '/php-http/httplug/src/Exception/HttpException.php',
-    'Http\\Client\\Exception\\NetworkException' => $vendorDir . '/php-http/httplug/src/Exception/NetworkException.php',
-    'Http\\Client\\Exception\\RequestException' => $vendorDir . '/php-http/httplug/src/Exception/RequestException.php',
-    'Http\\Client\\Exception\\TransferException' => $vendorDir . '/php-http/httplug/src/Exception/TransferException.php',
-    'Http\\Client\\HttpAsyncClient' => $vendorDir . '/php-http/httplug/src/HttpAsyncClient.php',
-    'Http\\Client\\HttpClient' => $vendorDir . '/php-http/httplug/src/HttpClient.php',
-    'Http\\Client\\Promise\\HttpFulfilledPromise' => $vendorDir . '/php-http/httplug/src/Promise/HttpFulfilledPromise.php',
-    'Http\\Client\\Promise\\HttpRejectedPromise' => $vendorDir . '/php-http/httplug/src/Promise/HttpRejectedPromise.php',
-    'Http\\Discovery\\ClassDiscovery' => $vendorDir . '/php-http/discovery/src/ClassDiscovery.php',
-    'Http\\Discovery\\Exception' => $vendorDir . '/php-http/discovery/src/Exception.php',
-    'Http\\Discovery\\Exception\\ClassInstantiationFailedException' => $vendorDir . '/php-http/discovery/src/Exception/ClassInstantiationFailedException.php',
-    'Http\\Discovery\\Exception\\DiscoveryFailedException' => $vendorDir . '/php-http/discovery/src/Exception/DiscoveryFailedException.php',
-    'Http\\Discovery\\Exception\\NotFoundException' => $vendorDir . '/php-http/discovery/src/Exception/NotFoundException.php',
-    'Http\\Discovery\\Exception\\PuliUnavailableException' => $vendorDir . '/php-http/discovery/src/Exception/PuliUnavailableException.php',
-    'Http\\Discovery\\Exception\\StrategyUnavailableException' => $vendorDir . '/php-http/discovery/src/Exception/StrategyUnavailableException.php',
-    'Http\\Discovery\\HttpAsyncClientDiscovery' => $vendorDir . '/php-http/discovery/src/HttpAsyncClientDiscovery.php',
-    'Http\\Discovery\\HttpClientDiscovery' => $vendorDir . '/php-http/discovery/src/HttpClientDiscovery.php',
-    'Http\\Discovery\\MessageFactoryDiscovery' => $vendorDir . '/php-http/discovery/src/MessageFactoryDiscovery.php',
-    'Http\\Discovery\\NotFoundException' => $vendorDir . '/php-http/discovery/src/NotFoundException.php',
-    'Http\\Discovery\\Strategy\\CommonClassesStrategy' => $vendorDir . '/php-http/discovery/src/Strategy/CommonClassesStrategy.php',
-    'Http\\Discovery\\Strategy\\DiscoveryStrategy' => $vendorDir . '/php-http/discovery/src/Strategy/DiscoveryStrategy.php',
-    'Http\\Discovery\\Strategy\\MockClientStrategy' => $vendorDir . '/php-http/discovery/src/Strategy/MockClientStrategy.php',
-    'Http\\Discovery\\Strategy\\PuliBetaStrategy' => $vendorDir . '/php-http/discovery/src/Strategy/PuliBetaStrategy.php',
-    'Http\\Discovery\\StreamFactoryDiscovery' => $vendorDir . '/php-http/discovery/src/StreamFactoryDiscovery.php',
-    'Http\\Discovery\\UriFactoryDiscovery' => $vendorDir . '/php-http/discovery/src/UriFactoryDiscovery.php',
-    'Http\\Message\\Authentication' => $vendorDir . '/php-http/message/src/Authentication.php',
-    'Http\\Message\\Authentication\\AutoBasicAuth' => $vendorDir . '/php-http/message/src/Authentication/AutoBasicAuth.php',
-    'Http\\Message\\Authentication\\BasicAuth' => $vendorDir . '/php-http/message/src/Authentication/BasicAuth.php',
-    'Http\\Message\\Authentication\\Bearer' => $vendorDir . '/php-http/message/src/Authentication/Bearer.php',
-    'Http\\Message\\Authentication\\Chain' => $vendorDir . '/php-http/message/src/Authentication/Chain.php',
-    'Http\\Message\\Authentication\\Matching' => $vendorDir . '/php-http/message/src/Authentication/Matching.php',
-    'Http\\Message\\Authentication\\QueryParam' => $vendorDir . '/php-http/message/src/Authentication/QueryParam.php',
-    'Http\\Message\\Authentication\\RequestConditional' => $vendorDir . '/php-http/message/src/Authentication/RequestConditional.php',
-    'Http\\Message\\Authentication\\Wsse' => $vendorDir . '/php-http/message/src/Authentication/Wsse.php',
-    'Http\\Message\\Builder\\ResponseBuilder' => $vendorDir . '/php-http/message/src/Builder/ResponseBuilder.php',
-    'Http\\Message\\Cookie' => $vendorDir . '/php-http/message/src/Cookie.php',
-    'Http\\Message\\CookieJar' => $vendorDir . '/php-http/message/src/CookieJar.php',
-    'Http\\Message\\Decorator\\MessageDecorator' => $vendorDir . '/php-http/message/src/Decorator/MessageDecorator.php',
-    'Http\\Message\\Decorator\\RequestDecorator' => $vendorDir . '/php-http/message/src/Decorator/RequestDecorator.php',
-    'Http\\Message\\Decorator\\ResponseDecorator' => $vendorDir . '/php-http/message/src/Decorator/ResponseDecorator.php',
-    'Http\\Message\\Decorator\\StreamDecorator' => $vendorDir . '/php-http/message/src/Decorator/StreamDecorator.php',
-    'Http\\Message\\Encoding\\ChunkStream' => $vendorDir . '/php-http/message/src/Encoding/ChunkStream.php',
-    'Http\\Message\\Encoding\\CompressStream' => $vendorDir . '/php-http/message/src/Encoding/CompressStream.php',
-    'Http\\Message\\Encoding\\DechunkStream' => $vendorDir . '/php-http/message/src/Encoding/DechunkStream.php',
-    'Http\\Message\\Encoding\\DecompressStream' => $vendorDir . '/php-http/message/src/Encoding/DecompressStream.php',
-    'Http\\Message\\Encoding\\DeflateStream' => $vendorDir . '/php-http/message/src/Encoding/DeflateStream.php',
-    'Http\\Message\\Encoding\\Filter\\Chunk' => $vendorDir . '/php-http/message/src/Encoding/Filter/Chunk.php',
-    'Http\\Message\\Encoding\\FilteredStream' => $vendorDir . '/php-http/message/src/Encoding/FilteredStream.php',
-    'Http\\Message\\Encoding\\GzipDecodeStream' => $vendorDir . '/php-http/message/src/Encoding/GzipDecodeStream.php',
-    'Http\\Message\\Encoding\\GzipEncodeStream' => $vendorDir . '/php-http/message/src/Encoding/GzipEncodeStream.php',
-    'Http\\Message\\Encoding\\InflateStream' => $vendorDir . '/php-http/message/src/Encoding/InflateStream.php',
-    'Http\\Message\\Formatter' => $vendorDir . '/php-http/message/src/Formatter.php',
-    'Http\\Message\\Formatter\\CurlCommandFormatter' => $vendorDir . '/php-http/message/src/Formatter/CurlCommandFormatter.php',
-    'Http\\Message\\Formatter\\FullHttpMessageFormatter' => $vendorDir . '/php-http/message/src/Formatter/FullHttpMessageFormatter.php',
-    'Http\\Message\\Formatter\\SimpleFormatter' => $vendorDir . '/php-http/message/src/Formatter/SimpleFormatter.php',
-    'Http\\Message\\MessageFactory' => $vendorDir . '/php-http/message-factory/src/MessageFactory.php',
-    'Http\\Message\\MessageFactory\\DiactorosMessageFactory' => $vendorDir . '/php-http/message/src/MessageFactory/DiactorosMessageFactory.php',
-    'Http\\Message\\MessageFactory\\GuzzleMessageFactory' => $vendorDir . '/php-http/message/src/MessageFactory/GuzzleMessageFactory.php',
-    'Http\\Message\\MessageFactory\\SlimMessageFactory' => $vendorDir . '/php-http/message/src/MessageFactory/SlimMessageFactory.php',
-    'Http\\Message\\RequestFactory' => $vendorDir . '/php-http/message-factory/src/RequestFactory.php',
-    'Http\\Message\\RequestMatcher' => $vendorDir . '/php-http/message/src/RequestMatcher.php',
-    'Http\\Message\\RequestMatcher\\CallbackRequestMatcher' => $vendorDir . '/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php',
-    'Http\\Message\\RequestMatcher\\RegexRequestMatcher' => $vendorDir . '/php-http/message/src/RequestMatcher/RegexRequestMatcher.php',
-    'Http\\Message\\RequestMatcher\\RequestMatcher' => $vendorDir . '/php-http/message/src/RequestMatcher/RequestMatcher.php',
-    'Http\\Message\\ResponseFactory' => $vendorDir . '/php-http/message-factory/src/ResponseFactory.php',
-    'Http\\Message\\StreamFactory' => $vendorDir . '/php-http/message-factory/src/StreamFactory.php',
-    'Http\\Message\\StreamFactory\\DiactorosStreamFactory' => $vendorDir . '/php-http/message/src/StreamFactory/DiactorosStreamFactory.php',
-    'Http\\Message\\StreamFactory\\GuzzleStreamFactory' => $vendorDir . '/php-http/message/src/StreamFactory/GuzzleStreamFactory.php',
-    'Http\\Message\\StreamFactory\\SlimStreamFactory' => $vendorDir . '/php-http/message/src/StreamFactory/SlimStreamFactory.php',
-    'Http\\Message\\Stream\\BufferedStream' => $vendorDir . '/php-http/message/src/Stream/BufferedStream.php',
-    'Http\\Message\\UriFactory' => $vendorDir . '/php-http/message-factory/src/UriFactory.php',
-    'Http\\Message\\UriFactory\\DiactorosUriFactory' => $vendorDir . '/php-http/message/src/UriFactory/DiactorosUriFactory.php',
-    'Http\\Message\\UriFactory\\GuzzleUriFactory' => $vendorDir . '/php-http/message/src/UriFactory/GuzzleUriFactory.php',
-    'Http\\Message\\UriFactory\\SlimUriFactory' => $vendorDir . '/php-http/message/src/UriFactory/SlimUriFactory.php',
-    'Http\\Promise\\FulfilledPromise' => $vendorDir . '/php-http/promise/src/FulfilledPromise.php',
-    'Http\\Promise\\Promise' => $vendorDir . '/php-http/promise/src/Promise.php',
-    'Http\\Promise\\RejectedPromise' => $vendorDir . '/php-http/promise/src/RejectedPromise.php',
-    'Kryptonit3\\CouchPotato\\CouchPotato' => $vendorDir . '/kryptonit3/couchpotato/src/CouchPotato.php',
-    'Kryptonit3\\CouchPotato\\Exceptions\\InvalidException' => $vendorDir . '/kryptonit3/couchpotato/src/Exceptions/InvalidException.php',
-    'Kryptonit3\\SickRage\\Exceptions\\InvalidException' => $vendorDir . '/kryptonit3/sickrage/src/Exceptions/InvalidException.php',
-    'Kryptonit3\\SickRage\\SickRage' => $vendorDir . '/kryptonit3/sickrage/src/SickRage.php',
-    'Kryptonit3\\Sonarr\\Exceptions\\InvalidException' => $vendorDir . '/kryptonit3/sonarr/src/Exceptions/InvalidException.php',
-    'Kryptonit3\\Sonarr\\Sonarr' => $vendorDir . '/kryptonit3/sonarr/src/Sonarr.php',
     'PHPMailer' => $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php',
     'PHPMailerOAuth' => $vendorDir . '/phpmailer/phpmailer/class.phpmaileroauth.php',
     'PHPMailerOAuthGoogle' => $vendorDir . '/phpmailer/phpmailer/class.phpmaileroauthgoogle.php',
     'POP3' => $vendorDir . '/phpmailer/phpmailer/class.pop3.php',
-    'Psr\\Http\\Message\\MessageInterface' => $vendorDir . '/psr/http-message/src/MessageInterface.php',
-    'Psr\\Http\\Message\\RequestInterface' => $vendorDir . '/psr/http-message/src/RequestInterface.php',
-    'Psr\\Http\\Message\\ResponseInterface' => $vendorDir . '/psr/http-message/src/ResponseInterface.php',
-    'Psr\\Http\\Message\\ServerRequestInterface' => $vendorDir . '/psr/http-message/src/ServerRequestInterface.php',
-    'Psr\\Http\\Message\\StreamInterface' => $vendorDir . '/psr/http-message/src/StreamInterface.php',
-    'Psr\\Http\\Message\\UploadedFileInterface' => $vendorDir . '/psr/http-message/src/UploadedFileInterface.php',
-    'Psr\\Http\\Message\\UriInterface' => $vendorDir . '/psr/http-message/src/UriInterface.php',
     'SMTP' => $vendorDir . '/phpmailer/phpmailer/class.smtp.php',
-    'SparkPost\\Resource' => $vendorDir . '/sparkpost/sparkpost/lib/SparkPost/Resource.php',
-    'SparkPost\\ResourceBase' => $vendorDir . '/sparkpost/sparkpost/lib/SparkPost/ResourceBase.php',
-    'SparkPost\\SparkPost' => $vendorDir . '/sparkpost/sparkpost/lib/SparkPost/SparkPost.php',
-    'SparkPost\\SparkPostException' => $vendorDir . '/sparkpost/sparkpost/lib/SparkPost/SparkPostException.php',
-    'SparkPost\\SparkPostPromise' => $vendorDir . '/sparkpost/sparkpost/lib/SparkPost/SparkPostPromise.php',
-    'SparkPost\\SparkPostResponse' => $vendorDir . '/sparkpost/sparkpost/lib/SparkPost/SparkPostResponse.php',
-    'SparkPost\\Transmission' => $vendorDir . '/sparkpost/sparkpost/lib/SparkPost/Transmission.php',
     'ntlm_sasl_client_class' => $vendorDir . '/phpmailer/phpmailer/extras/ntlm_sasl_client.php',
     'phpmailerException' => $vendorDir . '/phpmailer/phpmailer/class.phpmailer.php',
 );

+ 1 - 0
vendor/composer/autoload_psr4.php

@@ -8,6 +8,7 @@ $baseDir = dirname($vendorDir);
 return array(
     'SparkPost\\' => array($vendorDir . '/sparkpost/sparkpost/lib/SparkPost'),
     'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
+    'Lcobucci\\JWT\\' => array($vendorDir . '/lcobucci/jwt/src'),
     'Kryptonit3\\Sonarr\\' => array($vendorDir . '/kryptonit3/sonarr/src'),
     'Kryptonit3\\SickRage\\' => array($vendorDir . '/kryptonit3/sickrage/src'),
     'Kryptonit3\\CouchPotato\\' => array($vendorDir . '/kryptonit3/couchpotato/src'),

+ 8 - 169
vendor/composer/autoload_static.php

@@ -23,6 +23,10 @@ class ComposerStaticInitbe7ec48d1178705ed9a8e33459c0af96
         array (
             'Psr\\Http\\Message\\' => 17,
         ),
+        'L' => 
+        array (
+            'Lcobucci\\JWT\\' => 13,
+        ),
         'K' => 
         array (
             'Kryptonit3\\Sonarr\\' => 18,
@@ -58,6 +62,10 @@ class ComposerStaticInitbe7ec48d1178705ed9a8e33459c0af96
         array (
             0 => __DIR__ . '/..' . '/psr/http-message/src',
         ),
+        'Lcobucci\\JWT\\' => 
+        array (
+            0 => __DIR__ . '/..' . '/lcobucci/jwt/src',
+        ),
         'Kryptonit3\\Sonarr\\' => 
         array (
             0 => __DIR__ . '/..' . '/kryptonit3/sonarr/src',
@@ -110,181 +118,12 @@ class ComposerStaticInitbe7ec48d1178705ed9a8e33459c0af96
     );
 
     public static $classMap = array (
-        'Clue\\StreamFilter\\CallbackFilter' => __DIR__ . '/..' . '/clue/stream-filter/src/CallbackFilter.php',
         'EasyPeasyICS' => __DIR__ . '/..' . '/phpmailer/phpmailer/extras/EasyPeasyICS.php',
-        'GuzzleHttp\\Client' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Client.php',
-        'GuzzleHttp\\ClientInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/ClientInterface.php',
-        'GuzzleHttp\\Cookie\\CookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
-        'GuzzleHttp\\Cookie\\CookieJarInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php',
-        'GuzzleHttp\\Cookie\\FileCookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php',
-        'GuzzleHttp\\Cookie\\SessionCookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php',
-        'GuzzleHttp\\Cookie\\SetCookie' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/SetCookie.php',
-        'GuzzleHttp\\Exception\\BadResponseException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/BadResponseException.php',
-        'GuzzleHttp\\Exception\\ClientException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ClientException.php',
-        'GuzzleHttp\\Exception\\ConnectException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ConnectException.php',
-        'GuzzleHttp\\Exception\\GuzzleException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/GuzzleException.php',
-        'GuzzleHttp\\Exception\\RequestException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/RequestException.php',
-        'GuzzleHttp\\Exception\\SeekException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/SeekException.php',
-        'GuzzleHttp\\Exception\\ServerException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ServerException.php',
-        'GuzzleHttp\\Exception\\TooManyRedirectsException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php',
-        'GuzzleHttp\\Exception\\TransferException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/TransferException.php',
-        'GuzzleHttp\\HandlerStack' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/HandlerStack.php',
-        'GuzzleHttp\\Handler\\CurlFactory' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php',
-        'GuzzleHttp\\Handler\\CurlFactoryInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php',
-        'GuzzleHttp\\Handler\\CurlHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php',
-        'GuzzleHttp\\Handler\\CurlMultiHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php',
-        'GuzzleHttp\\Handler\\EasyHandle' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/EasyHandle.php',
-        'GuzzleHttp\\Handler\\MockHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/MockHandler.php',
-        'GuzzleHttp\\Handler\\Proxy' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/Proxy.php',
-        'GuzzleHttp\\Handler\\StreamHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/StreamHandler.php',
-        'GuzzleHttp\\MessageFormatter' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/MessageFormatter.php',
-        'GuzzleHttp\\Middleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Middleware.php',
-        'GuzzleHttp\\Pool' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Pool.php',
-        'GuzzleHttp\\PrepareBodyMiddleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php',
-        'GuzzleHttp\\Promise\\AggregateException' => __DIR__ . '/..' . '/guzzlehttp/promises/src/AggregateException.php',
-        'GuzzleHttp\\Promise\\CancellationException' => __DIR__ . '/..' . '/guzzlehttp/promises/src/CancellationException.php',
-        'GuzzleHttp\\Promise\\Coroutine' => __DIR__ . '/..' . '/guzzlehttp/promises/src/Coroutine.php',
-        'GuzzleHttp\\Promise\\EachPromise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/EachPromise.php',
-        'GuzzleHttp\\Promise\\FulfilledPromise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/FulfilledPromise.php',
-        'GuzzleHttp\\Promise\\Promise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/Promise.php',
-        'GuzzleHttp\\Promise\\PromiseInterface' => __DIR__ . '/..' . '/guzzlehttp/promises/src/PromiseInterface.php',
-        'GuzzleHttp\\Promise\\PromisorInterface' => __DIR__ . '/..' . '/guzzlehttp/promises/src/PromisorInterface.php',
-        'GuzzleHttp\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/RejectedPromise.php',
-        'GuzzleHttp\\Promise\\RejectionException' => __DIR__ . '/..' . '/guzzlehttp/promises/src/RejectionException.php',
-        'GuzzleHttp\\Promise\\TaskQueue' => __DIR__ . '/..' . '/guzzlehttp/promises/src/TaskQueue.php',
-        'GuzzleHttp\\Promise\\TaskQueueInterface' => __DIR__ . '/..' . '/guzzlehttp/promises/src/TaskQueueInterface.php',
-        'GuzzleHttp\\Psr7\\AppendStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/AppendStream.php',
-        'GuzzleHttp\\Psr7\\BufferStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/BufferStream.php',
-        'GuzzleHttp\\Psr7\\CachingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/CachingStream.php',
-        'GuzzleHttp\\Psr7\\DroppingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/DroppingStream.php',
-        'GuzzleHttp\\Psr7\\FnStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/FnStream.php',
-        'GuzzleHttp\\Psr7\\InflateStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/InflateStream.php',
-        'GuzzleHttp\\Psr7\\LazyOpenStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LazyOpenStream.php',
-        'GuzzleHttp\\Psr7\\LimitStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LimitStream.php',
-        'GuzzleHttp\\Psr7\\MessageTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MessageTrait.php',
-        'GuzzleHttp\\Psr7\\MultipartStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MultipartStream.php',
-        'GuzzleHttp\\Psr7\\NoSeekStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/NoSeekStream.php',
-        'GuzzleHttp\\Psr7\\PumpStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/PumpStream.php',
-        'GuzzleHttp\\Psr7\\Request' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Request.php',
-        'GuzzleHttp\\Psr7\\Response' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Response.php',
-        'GuzzleHttp\\Psr7\\ServerRequest' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/ServerRequest.php',
-        'GuzzleHttp\\Psr7\\Stream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Stream.php',
-        'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php',
-        'GuzzleHttp\\Psr7\\StreamWrapper' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamWrapper.php',
-        'GuzzleHttp\\Psr7\\UploadedFile' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UploadedFile.php',
-        'GuzzleHttp\\Psr7\\Uri' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Uri.php',
-        'GuzzleHttp\\Psr7\\UriNormalizer' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriNormalizer.php',
-        'GuzzleHttp\\Psr7\\UriResolver' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriResolver.php',
-        'GuzzleHttp\\RedirectMiddleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RedirectMiddleware.php',
-        'GuzzleHttp\\RequestOptions' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RequestOptions.php',
-        'GuzzleHttp\\RetryMiddleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RetryMiddleware.php',
-        'GuzzleHttp\\TransferStats' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/TransferStats.php',
-        'GuzzleHttp\\UriTemplate' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/UriTemplate.php',
-        'Http\\Adapter\\Guzzle6\\Client' => __DIR__ . '/..' . '/php-http/guzzle6-adapter/src/Client.php',
-        'Http\\Adapter\\Guzzle6\\Promise' => __DIR__ . '/..' . '/php-http/guzzle6-adapter/src/Promise.php',
-        'Http\\Client\\Exception' => __DIR__ . '/..' . '/php-http/httplug/src/Exception.php',
-        'Http\\Client\\Exception\\HttpException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/HttpException.php',
-        'Http\\Client\\Exception\\NetworkException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/NetworkException.php',
-        'Http\\Client\\Exception\\RequestException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/RequestException.php',
-        'Http\\Client\\Exception\\TransferException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/TransferException.php',
-        'Http\\Client\\HttpAsyncClient' => __DIR__ . '/..' . '/php-http/httplug/src/HttpAsyncClient.php',
-        'Http\\Client\\HttpClient' => __DIR__ . '/..' . '/php-http/httplug/src/HttpClient.php',
-        'Http\\Client\\Promise\\HttpFulfilledPromise' => __DIR__ . '/..' . '/php-http/httplug/src/Promise/HttpFulfilledPromise.php',
-        'Http\\Client\\Promise\\HttpRejectedPromise' => __DIR__ . '/..' . '/php-http/httplug/src/Promise/HttpRejectedPromise.php',
-        'Http\\Discovery\\ClassDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/ClassDiscovery.php',
-        'Http\\Discovery\\Exception' => __DIR__ . '/..' . '/php-http/discovery/src/Exception.php',
-        'Http\\Discovery\\Exception\\ClassInstantiationFailedException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/ClassInstantiationFailedException.php',
-        'Http\\Discovery\\Exception\\DiscoveryFailedException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/DiscoveryFailedException.php',
-        'Http\\Discovery\\Exception\\NotFoundException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/NotFoundException.php',
-        'Http\\Discovery\\Exception\\PuliUnavailableException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/PuliUnavailableException.php',
-        'Http\\Discovery\\Exception\\StrategyUnavailableException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/StrategyUnavailableException.php',
-        'Http\\Discovery\\HttpAsyncClientDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/HttpAsyncClientDiscovery.php',
-        'Http\\Discovery\\HttpClientDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/HttpClientDiscovery.php',
-        'Http\\Discovery\\MessageFactoryDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/MessageFactoryDiscovery.php',
-        'Http\\Discovery\\NotFoundException' => __DIR__ . '/..' . '/php-http/discovery/src/NotFoundException.php',
-        'Http\\Discovery\\Strategy\\CommonClassesStrategy' => __DIR__ . '/..' . '/php-http/discovery/src/Strategy/CommonClassesStrategy.php',
-        'Http\\Discovery\\Strategy\\DiscoveryStrategy' => __DIR__ . '/..' . '/php-http/discovery/src/Strategy/DiscoveryStrategy.php',
-        'Http\\Discovery\\Strategy\\MockClientStrategy' => __DIR__ . '/..' . '/php-http/discovery/src/Strategy/MockClientStrategy.php',
-        'Http\\Discovery\\Strategy\\PuliBetaStrategy' => __DIR__ . '/..' . '/php-http/discovery/src/Strategy/PuliBetaStrategy.php',
-        'Http\\Discovery\\StreamFactoryDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/StreamFactoryDiscovery.php',
-        'Http\\Discovery\\UriFactoryDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/UriFactoryDiscovery.php',
-        'Http\\Message\\Authentication' => __DIR__ . '/..' . '/php-http/message/src/Authentication.php',
-        'Http\\Message\\Authentication\\AutoBasicAuth' => __DIR__ . '/..' . '/php-http/message/src/Authentication/AutoBasicAuth.php',
-        'Http\\Message\\Authentication\\BasicAuth' => __DIR__ . '/..' . '/php-http/message/src/Authentication/BasicAuth.php',
-        'Http\\Message\\Authentication\\Bearer' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Bearer.php',
-        'Http\\Message\\Authentication\\Chain' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Chain.php',
-        'Http\\Message\\Authentication\\Matching' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Matching.php',
-        'Http\\Message\\Authentication\\QueryParam' => __DIR__ . '/..' . '/php-http/message/src/Authentication/QueryParam.php',
-        'Http\\Message\\Authentication\\RequestConditional' => __DIR__ . '/..' . '/php-http/message/src/Authentication/RequestConditional.php',
-        'Http\\Message\\Authentication\\Wsse' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Wsse.php',
-        'Http\\Message\\Builder\\ResponseBuilder' => __DIR__ . '/..' . '/php-http/message/src/Builder/ResponseBuilder.php',
-        'Http\\Message\\Cookie' => __DIR__ . '/..' . '/php-http/message/src/Cookie.php',
-        'Http\\Message\\CookieJar' => __DIR__ . '/..' . '/php-http/message/src/CookieJar.php',
-        'Http\\Message\\Decorator\\MessageDecorator' => __DIR__ . '/..' . '/php-http/message/src/Decorator/MessageDecorator.php',
-        'Http\\Message\\Decorator\\RequestDecorator' => __DIR__ . '/..' . '/php-http/message/src/Decorator/RequestDecorator.php',
-        'Http\\Message\\Decorator\\ResponseDecorator' => __DIR__ . '/..' . '/php-http/message/src/Decorator/ResponseDecorator.php',
-        'Http\\Message\\Decorator\\StreamDecorator' => __DIR__ . '/..' . '/php-http/message/src/Decorator/StreamDecorator.php',
-        'Http\\Message\\Encoding\\ChunkStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/ChunkStream.php',
-        'Http\\Message\\Encoding\\CompressStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/CompressStream.php',
-        'Http\\Message\\Encoding\\DechunkStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/DechunkStream.php',
-        'Http\\Message\\Encoding\\DecompressStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/DecompressStream.php',
-        'Http\\Message\\Encoding\\DeflateStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/DeflateStream.php',
-        'Http\\Message\\Encoding\\Filter\\Chunk' => __DIR__ . '/..' . '/php-http/message/src/Encoding/Filter/Chunk.php',
-        'Http\\Message\\Encoding\\FilteredStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/FilteredStream.php',
-        'Http\\Message\\Encoding\\GzipDecodeStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/GzipDecodeStream.php',
-        'Http\\Message\\Encoding\\GzipEncodeStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/GzipEncodeStream.php',
-        'Http\\Message\\Encoding\\InflateStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/InflateStream.php',
-        'Http\\Message\\Formatter' => __DIR__ . '/..' . '/php-http/message/src/Formatter.php',
-        'Http\\Message\\Formatter\\CurlCommandFormatter' => __DIR__ . '/..' . '/php-http/message/src/Formatter/CurlCommandFormatter.php',
-        'Http\\Message\\Formatter\\FullHttpMessageFormatter' => __DIR__ . '/..' . '/php-http/message/src/Formatter/FullHttpMessageFormatter.php',
-        'Http\\Message\\Formatter\\SimpleFormatter' => __DIR__ . '/..' . '/php-http/message/src/Formatter/SimpleFormatter.php',
-        'Http\\Message\\MessageFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/MessageFactory.php',
-        'Http\\Message\\MessageFactory\\DiactorosMessageFactory' => __DIR__ . '/..' . '/php-http/message/src/MessageFactory/DiactorosMessageFactory.php',
-        'Http\\Message\\MessageFactory\\GuzzleMessageFactory' => __DIR__ . '/..' . '/php-http/message/src/MessageFactory/GuzzleMessageFactory.php',
-        'Http\\Message\\MessageFactory\\SlimMessageFactory' => __DIR__ . '/..' . '/php-http/message/src/MessageFactory/SlimMessageFactory.php',
-        'Http\\Message\\RequestFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/RequestFactory.php',
-        'Http\\Message\\RequestMatcher' => __DIR__ . '/..' . '/php-http/message/src/RequestMatcher.php',
-        'Http\\Message\\RequestMatcher\\CallbackRequestMatcher' => __DIR__ . '/..' . '/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php',
-        'Http\\Message\\RequestMatcher\\RegexRequestMatcher' => __DIR__ . '/..' . '/php-http/message/src/RequestMatcher/RegexRequestMatcher.php',
-        'Http\\Message\\RequestMatcher\\RequestMatcher' => __DIR__ . '/..' . '/php-http/message/src/RequestMatcher/RequestMatcher.php',
-        'Http\\Message\\ResponseFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/ResponseFactory.php',
-        'Http\\Message\\StreamFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/StreamFactory.php',
-        'Http\\Message\\StreamFactory\\DiactorosStreamFactory' => __DIR__ . '/..' . '/php-http/message/src/StreamFactory/DiactorosStreamFactory.php',
-        'Http\\Message\\StreamFactory\\GuzzleStreamFactory' => __DIR__ . '/..' . '/php-http/message/src/StreamFactory/GuzzleStreamFactory.php',
-        'Http\\Message\\StreamFactory\\SlimStreamFactory' => __DIR__ . '/..' . '/php-http/message/src/StreamFactory/SlimStreamFactory.php',
-        'Http\\Message\\Stream\\BufferedStream' => __DIR__ . '/..' . '/php-http/message/src/Stream/BufferedStream.php',
-        'Http\\Message\\UriFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/UriFactory.php',
-        'Http\\Message\\UriFactory\\DiactorosUriFactory' => __DIR__ . '/..' . '/php-http/message/src/UriFactory/DiactorosUriFactory.php',
-        'Http\\Message\\UriFactory\\GuzzleUriFactory' => __DIR__ . '/..' . '/php-http/message/src/UriFactory/GuzzleUriFactory.php',
-        'Http\\Message\\UriFactory\\SlimUriFactory' => __DIR__ . '/..' . '/php-http/message/src/UriFactory/SlimUriFactory.php',
-        'Http\\Promise\\FulfilledPromise' => __DIR__ . '/..' . '/php-http/promise/src/FulfilledPromise.php',
-        'Http\\Promise\\Promise' => __DIR__ . '/..' . '/php-http/promise/src/Promise.php',
-        'Http\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/php-http/promise/src/RejectedPromise.php',
-        'Kryptonit3\\CouchPotato\\CouchPotato' => __DIR__ . '/..' . '/kryptonit3/couchpotato/src/CouchPotato.php',
-        'Kryptonit3\\CouchPotato\\Exceptions\\InvalidException' => __DIR__ . '/..' . '/kryptonit3/couchpotato/src/Exceptions/InvalidException.php',
-        'Kryptonit3\\SickRage\\Exceptions\\InvalidException' => __DIR__ . '/..' . '/kryptonit3/sickrage/src/Exceptions/InvalidException.php',
-        'Kryptonit3\\SickRage\\SickRage' => __DIR__ . '/..' . '/kryptonit3/sickrage/src/SickRage.php',
-        'Kryptonit3\\Sonarr\\Exceptions\\InvalidException' => __DIR__ . '/..' . '/kryptonit3/sonarr/src/Exceptions/InvalidException.php',
-        'Kryptonit3\\Sonarr\\Sonarr' => __DIR__ . '/..' . '/kryptonit3/sonarr/src/Sonarr.php',
         'PHPMailer' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmailer.php',
         'PHPMailerOAuth' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmaileroauth.php',
         'PHPMailerOAuthGoogle' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmaileroauthgoogle.php',
         'POP3' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.pop3.php',
-        'Psr\\Http\\Message\\MessageInterface' => __DIR__ . '/..' . '/psr/http-message/src/MessageInterface.php',
-        'Psr\\Http\\Message\\RequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/RequestInterface.php',
-        'Psr\\Http\\Message\\ResponseInterface' => __DIR__ . '/..' . '/psr/http-message/src/ResponseInterface.php',
-        'Psr\\Http\\Message\\ServerRequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/ServerRequestInterface.php',
-        'Psr\\Http\\Message\\StreamInterface' => __DIR__ . '/..' . '/psr/http-message/src/StreamInterface.php',
-        'Psr\\Http\\Message\\UploadedFileInterface' => __DIR__ . '/..' . '/psr/http-message/src/UploadedFileInterface.php',
-        'Psr\\Http\\Message\\UriInterface' => __DIR__ . '/..' . '/psr/http-message/src/UriInterface.php',
         'SMTP' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.smtp.php',
-        'SparkPost\\Resource' => __DIR__ . '/..' . '/sparkpost/sparkpost/lib/SparkPost/Resource.php',
-        'SparkPost\\ResourceBase' => __DIR__ . '/..' . '/sparkpost/sparkpost/lib/SparkPost/ResourceBase.php',
-        'SparkPost\\SparkPost' => __DIR__ . '/..' . '/sparkpost/sparkpost/lib/SparkPost/SparkPost.php',
-        'SparkPost\\SparkPostException' => __DIR__ . '/..' . '/sparkpost/sparkpost/lib/SparkPost/SparkPostException.php',
-        'SparkPost\\SparkPostPromise' => __DIR__ . '/..' . '/sparkpost/sparkpost/lib/SparkPost/SparkPostPromise.php',
-        'SparkPost\\SparkPostResponse' => __DIR__ . '/..' . '/sparkpost/sparkpost/lib/SparkPost/SparkPostResponse.php',
-        'SparkPost\\Transmission' => __DIR__ . '/..' . '/sparkpost/sparkpost/lib/SparkPost/Transmission.php',
         'ntlm_sasl_client_class' => __DIR__ . '/..' . '/phpmailer/phpmailer/extras/ntlm_sasl_client.php',
         'phpmailerException' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.phpmailer.php',
     );

+ 60 - 0
vendor/composer/installed.json

@@ -886,5 +886,65 @@
             }
         ],
         "description": "Client library for interfacing with the SparkPost API."
+    },
+    {
+        "name": "lcobucci/jwt",
+        "version": "3.2.2",
+        "version_normalized": "3.2.2.0",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/lcobucci/jwt.git",
+            "reference": "0b5930be73582369e10c4d4bb7a12bac927a203c"
+        },
+        "dist": {
+            "type": "zip",
+            "url": "https://api.github.com/repos/lcobucci/jwt/zipball/0b5930be73582369e10c4d4bb7a12bac927a203c",
+            "reference": "0b5930be73582369e10c4d4bb7a12bac927a203c",
+            "shasum": ""
+        },
+        "require": {
+            "ext-openssl": "*",
+            "php": ">=5.5"
+        },
+        "require-dev": {
+            "mdanter/ecc": "~0.3.1",
+            "mikey179/vfsstream": "~1.5",
+            "phpmd/phpmd": "~2.2",
+            "phpunit/php-invoker": "~1.1",
+            "phpunit/phpunit": "~4.5",
+            "squizlabs/php_codesniffer": "~2.3"
+        },
+        "suggest": {
+            "mdanter/ecc": "Required to use Elliptic Curves based algorithms."
+        },
+        "time": "2017-09-01T08:23:26+00:00",
+        "type": "library",
+        "extra": {
+            "branch-alias": {
+                "dev-master": "3.1-dev"
+            }
+        },
+        "installation-source": "dist",
+        "autoload": {
+            "psr-4": {
+                "Lcobucci\\JWT\\": "src"
+            }
+        },
+        "notification-url": "https://packagist.org/downloads/",
+        "license": [
+            "BSD-3-Clause"
+        ],
+        "authors": [
+            {
+                "name": "Luís Otávio Cobucci Oblonczyk",
+                "email": "lcobucci@gmail.com",
+                "role": "Developer"
+            }
+        ],
+        "description": "A simple library to work with JSON Web Token and JSON Web Signature",
+        "keywords": [
+            "JWS",
+            "jwt"
+        ]
     }
 ]

+ 2 - 0
vendor/lcobucci/jwt/.gitignore

@@ -0,0 +1,2 @@
+vendor
+phpunit.xml

+ 56 - 0
vendor/lcobucci/jwt/.scrutinizer.yml

@@ -0,0 +1,56 @@
+build:
+    environment:
+        mysql: false
+        postgresql: false
+        redis: false
+        rabbitmq: false
+        php:
+            version: 5.6
+tools:
+    php_sim: true
+    php_pdepend: true
+    php_analyzer: true
+    php_changetracking: true
+    php_code_sniffer:
+        config:
+            standard: "PSR2"
+    php_mess_detector: true
+checks:
+    php:
+        code_rating: true
+        duplication: true
+        argument_type_checks: true
+        assignment_of_null_return: true
+        avoid_conflicting_incrementers: true
+        avoid_useless_overridden_methods: true
+        catch_class_exists: true
+        closure_use_modifiable: true
+        closure_use_not_conflicting: true
+        deprecated_code_usage: true
+        method_calls_on_non_object: true
+        missing_arguments: true
+        no_duplicate_arguments: true
+        no_non_implemented_abstract_methods: true
+        no_property_on_interface: true
+        parameter_non_unique: true
+        precedence_in_conditions: true
+        precedence_mistakes: true
+        require_php_tag_first: true
+        security_vulnerabilities: true
+        sql_injection_vulnerabilities: true
+        too_many_arguments: true
+        unreachable_code: true
+        unused_methods: true
+        unused_parameters: true
+        unused_properties: true
+        unused_variables: true
+        use_statement_alias_conflict: true
+        useless_calls: true
+        variable_existence: true
+        verify_access_scope_valid: true
+        verify_argument_usable_as_reference: true
+        verify_property_names: true
+
+filter:
+    excluded_paths:
+        - test/*

+ 15 - 0
vendor/lcobucci/jwt/.travis.yml

@@ -0,0 +1,15 @@
+language: php
+php:
+  - 5.5
+  - 5.6
+  - 7.0
+  - hhvm
+  - hhvm-nightly
+
+matrix:
+  allow_failures:
+    - php: hhvm-nightly
+
+before_script:
+  - composer selfupdate
+  - composer install --prefer-dist -o

+ 27 - 0
vendor/lcobucci/jwt/LICENSE

@@ -0,0 +1,27 @@
+Copyright (c) 2014-2015, Luís Otávio Cobucci Oblonczyk
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+* Neither the name of the {organization} nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 149 - 0
vendor/lcobucci/jwt/README.md

@@ -0,0 +1,149 @@
+# JWT
+[![Gitter](https://img.shields.io/badge/GITTER-JOIN%20CHAT%20%E2%86%92-brightgreen.svg?style=flat-square)](https://gitter.im/lcobucci/jwt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Total Downloads](https://img.shields.io/packagist/dt/lcobucci/jwt.svg?style=flat-square)](https://packagist.org/packages/lcobucci/jwt) [![Latest Stable Version](https://img.shields.io/packagist/v/lcobucci/jwt.svg?style=flat-square)](https://packagist.org/packages/lcobucci/jwt)
+
+![Branch master](https://img.shields.io/badge/branch-master-brightgreen.svg?style=flat-square)
+[![Build Status](https://img.shields.io/travis/lcobucci/jwt/master.svg?style=flat-square)](http://travis-ci.org/#!/lcobucci/jwt)
+[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/lcobucci/jwt/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/lcobucci/jwt/?branch=master)
+[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/lcobucci/jwt/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/lcobucci/jwt/?branch=master)
+
+A simple library to work with JSON Web Token and JSON Web Signature (requires PHP 5.5+).
+The implementation is based on the [current draft](http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32).
+
+## Installation
+
+Package is available on [Packagist](http://packagist.org/packages/lcobucci/jwt),
+you can install it using [Composer](http://getcomposer.org).
+
+```shell
+composer require lcobucci/jwt
+```
+
+### Dependencies
+
+- PHP 5.5+
+- OpenSSL Extension
+
+## Basic usage
+
+### Creating
+
+Just use the builder to create a new JWT/JWS tokens:
+
+```php
+use Lcobucci\JWT\Builder;
+
+$token = (new Builder())->setIssuer('http://example.com') // Configures the issuer (iss claim)
+                        ->setAudience('http://example.org') // Configures the audience (aud claim)
+                        ->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item
+                        ->setIssuedAt(time()) // Configures the time that the token was issue (iat claim)
+                        ->setNotBefore(time() + 60) // Configures the time that the token can be used (nbf claim)
+                        ->setExpiration(time() + 3600) // Configures the expiration time of the token (nbf claim)
+                        ->set('uid', 1) // Configures a new claim, called "uid"
+                        ->getToken(); // Retrieves the generated token
+
+
+$token->getHeaders(); // Retrieves the token headers
+$token->getClaims(); // Retrieves the token claims
+
+echo $token->getHeader('jti'); // will print "4f1g23a12aa"
+echo $token->getClaim('iss'); // will print "http://example.com"
+echo $token->getClaim('uid'); // will print "1"
+echo $token; // The string representation of the object is a JWT string (pretty easy, right?)
+```
+
+### Parsing from strings
+
+Use the parser to create a new token from a JWT string (using the previous token as example):
+
+```php
+use Lcobucci\JWT\Parser;
+
+$token = (new Parser())->parse((string) $token); // Parses from a string
+$token->getHeaders(); // Retrieves the token header
+$token->getClaims(); // Retrieves the token claims
+
+echo $token->getHeader('jti'); // will print "4f1g23a12aa"
+echo $token->getClaim('iss'); // will print "http://example.com"
+echo $token->getClaim('uid'); // will print "1"
+```
+
+### Validating
+
+We can easily validate if the token is valid (using the previous token as example):
+
+```php
+use Lcobucci\JWT\ValidationData;
+
+$data = new ValidationData(); // It will use the current time to validate (iat, nbf and exp)
+$data->setIssuer('http://example.com');
+$data->setAudience('http://example.org');
+$data->setId('4f1g23a12aa');
+
+var_dump($token->validate($data)); // false, because we created a token that cannot be used before of `time() + 60`
+
+$data->setCurrentTime(time() + 60); // changing the validation time to future
+
+var_dump($token->validate($data)); // true, because validation information is equals to data contained on the token
+
+$data->setCurrentTime(time() + 4000); // changing the validation time to future
+
+var_dump($token->validate($data)); // false, because token is expired since current time is greater than exp
+```
+
+## Token signature
+
+We can use signatures to be able to verify if the token was not modified after its generation. This library implements Hmac, RSA and ECDSA signatures (using 256, 384 and 512).
+
+### Hmac
+
+Hmac signatures are really simple to be used:
+
+```php
+use Lcobucci\JWT\Builder;
+use Lcobucci\JWT\Signer\Hmac\Sha256;
+
+$signer = new Sha256();
+
+$token = (new Builder())->setIssuer('http://example.com') // Configures the issuer (iss claim)
+                        ->setAudience('http://example.org') // Configures the audience (aud claim)
+                        ->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item
+                        ->setIssuedAt(time()) // Configures the time that the token was issue (iat claim)
+                        ->setNotBefore(time() + 60) // Configures the time that the token can be used (nbf claim)
+                        ->setExpiration(time() + 3600) // Configures the expiration time of the token (exp claim)
+                        ->set('uid', 1) // Configures a new claim, called "uid"
+                        ->sign($signer, 'testing') // creates a signature using "testing" as key
+                        ->getToken(); // Retrieves the generated token
+
+
+var_dump($token->verify($signer, 'testing 1')); // false, because the key is different
+var_dump($token->verify($signer, 'testing')); // true, because the key is the same
+```
+
+### RSA and ECDSA
+
+RSA and ECDSA signatures are based on public and private keys so you have to generate using the private key and verify using the public key:
+
+```php
+use Lcobucci\JWT\Builder;
+use Lcobucci\JWT\Signer\Keychain; // just to make our life simpler
+use Lcobucci\JWT\Signer\Rsa\Sha256; // you can use Lcobucci\JWT\Signer\Ecdsa\Sha256 if you're using ECDSA keys
+
+$signer = new Sha256();
+
+$keychain = new Keychain();
+
+$token = (new Builder())->setIssuer('http://example.com') // Configures the issuer (iss claim)
+                        ->setAudience('http://example.org') // Configures the audience (aud claim)
+                        ->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item
+                        ->setIssuedAt(time()) // Configures the time that the token was issue (iat claim)
+                        ->setNotBefore(time() + 60) // Configures the time that the token can be used (nbf claim)
+                        ->setExpiration(time() + 3600) // Configures the expiration time of the token (nbf claim)
+                        ->set('uid', 1) // Configures a new claim, called "uid"
+                        ->sign($signer,  $keychain->getPrivateKey('file://{path to your private key}')) // creates a signature using your private key
+                        ->getToken(); // Retrieves the generated token
+
+
+var_dump($token->verify($signer, $keychain->getPublicKey('file://{path to your public key}')); // true when the public key was generated by the private one =)
+```
+
+**It's important to say that if you're using RSA keys you shouldn't invoke ECDSA signers (and vice-versa), otherwise ```sign()``` and ```verify()``` will raise an exception!**

+ 52 - 0
vendor/lcobucci/jwt/composer.json

@@ -0,0 +1,52 @@
+{
+    "name": "lcobucci/jwt",
+    "description": "A simple library to work with JSON Web Token and JSON Web Signature",
+    "type": "library",
+    "authors": [
+        {
+            "name": "Luís Otávio Cobucci Oblonczyk",
+            "email": "lcobucci@gmail.com",
+            "role": "Developer"
+        }
+    ],
+    "keywords": [
+        "JWT",
+        "JWS"
+    ],
+    "license": [
+        "BSD-3-Clause"
+    ],
+    "require": {
+        "php": ">=5.5",
+        "ext-openssl": "*"
+    },
+    "require-dev": {
+        "phpunit/phpunit": "~4.5",
+        "squizlabs/php_codesniffer": "~2.3",
+        "phpmd/phpmd": "~2.2",
+        "phpunit/php-invoker": "~1.1",
+        "mikey179/vfsStream": "~1.5",
+        "mdanter/ecc": "~0.3.1"
+    },
+    "suggest":{
+        "mdanter/ecc": "Required to use Elliptic Curves based algorithms."
+    },
+    "autoload": {
+        "psr-4": {
+            "Lcobucci\\JWT\\": "src"
+        }
+    },
+    "autoload-dev": {
+        "psr-4": {
+            "Lcobucci\\JWT\\": [
+                "test/unit", 
+                "test/functional"
+            ]
+        }
+    },
+    "extra": {
+        "branch-alias": {
+            "dev-master": "3.1-dev"
+        }
+    }
+}

+ 1898 - 0
vendor/lcobucci/jwt/composer.lock

@@ -0,0 +1,1898 @@
+{
+    "_readme": [
+        "This file locks the dependencies of your project to a known state",
+        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+        "This file is @generated automatically"
+    ],
+    "hash": "82547d7474ec5fcbf6718c4f2dca46d6",
+    "content-hash": "1c87e501c8e2df5e27eac6bfefe0c1f9",
+    "packages": [],
+    "packages-dev": [
+        {
+            "name": "doctrine/instantiator",
+            "version": "1.0.5",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/doctrine/instantiator.git",
+                "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
+                "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3,<8.0-DEV"
+            },
+            "require-dev": {
+                "athletic/athletic": "~0.1.8",
+                "ext-pdo": "*",
+                "ext-phar": "*",
+                "phpunit/phpunit": "~4.0",
+                "squizlabs/php_codesniffer": "~2.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Marco Pivetta",
+                    "email": "ocramius@gmail.com",
+                    "homepage": "http://ocramius.github.com/"
+                }
+            ],
+            "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+            "homepage": "https://github.com/doctrine/instantiator",
+            "keywords": [
+                "constructor",
+                "instantiate"
+            ],
+            "time": "2015-06-14 21:17:01"
+        },
+        {
+            "name": "fgrosse/phpasn1",
+            "version": "1.3.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/fgrosse/PHPASN1.git",
+                "reference": "ee6d1abd18f8bcbaf0b55563ba87e5ed16cd0c98"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/ee6d1abd18f8bcbaf0b55563ba87e5ed16cd0c98",
+                "reference": "ee6d1abd18f8bcbaf0b55563ba87e5ed16cd0c98",
+                "shasum": ""
+            },
+            "require": {
+                "ext-gmp": "*",
+                "php": ">=5.3.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.5"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.3.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "FG\\": "lib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Friedrich Große",
+                    "email": "friedrich.grosse@gmail.com",
+                    "homepage": "https://github.com/FGrosse",
+                    "role": "Author"
+                },
+                {
+                    "name": "All contributors",
+                    "homepage": "https://github.com/FGrosse/PHPASN1/contributors"
+                }
+            ],
+            "description": "A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.",
+            "homepage": "https://github.com/FGrosse/PHPASN1",
+            "time": "2015-07-15 21:26:40"
+        },
+        {
+            "name": "mdanter/ecc",
+            "version": "v0.3.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpecc/phpecc.git",
+                "reference": "182d94bc3bbeee6a8591bde36e66a80d8b07ae4b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpecc/phpecc/zipball/182d94bc3bbeee6a8591bde36e66a80d8b07ae4b",
+                "reference": "182d94bc3bbeee6a8591bde36e66a80d8b07ae4b",
+                "shasum": ""
+            },
+            "require": {
+                "ext-gmp": "*",
+                "ext-mcrypt": "*",
+                "fgrosse/phpasn1": "~1.3.1",
+                "php": ">=5.4.0",
+                "symfony/console": "~2.6"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.1",
+                "squizlabs/php_codesniffer": "~2",
+                "symfony/yaml": "~2.6"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Mdanter\\Ecc\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Matyas Danter",
+                    "homepage": "http://matejdanter.com/",
+                    "role": "Author"
+                },
+                {
+                    "name": "Thibaud Fabre",
+                    "email": "thibaud@aztech.io",
+                    "homepage": "http://aztech.io",
+                    "role": "Maintainer"
+                },
+                {
+                    "name": "Drak",
+                    "email": "drak@zikula.org",
+                    "homepage": "http://zikula.org",
+                    "role": "Maintainer"
+                }
+            ],
+            "description": "PHP Elliptic Curve Cryptography library",
+            "homepage": "https://github.com/mdanter/phpecc",
+            "time": "2014-07-07 12:44:15"
+        },
+        {
+            "name": "mikey179/vfsStream",
+            "version": "v1.6.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/mikey179/vfsStream.git",
+                "reference": "0247f57b2245e8ad2e689d7cee754b45fbabd592"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/0247f57b2245e8ad2e689d7cee754b45fbabd592",
+                "reference": "0247f57b2245e8ad2e689d7cee754b45fbabd592",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.5"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.6.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "org\\bovigo\\vfs\\": "src/main/php"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Frank Kleine",
+                    "homepage": "http://frankkleine.de/",
+                    "role": "Developer"
+                }
+            ],
+            "description": "Virtual file system to mock the real file system in unit tests.",
+            "homepage": "http://vfs.bovigo.org/",
+            "time": "2016-07-18 14:02:57"
+        },
+        {
+            "name": "pdepend/pdepend",
+            "version": "2.2.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/pdepend/pdepend.git",
+                "reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/pdepend/pdepend/zipball/b086687f3a01dc6bb92d633aef071d2c5dd0db06",
+                "reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.7",
+                "symfony/config": "^2.3.0|^3",
+                "symfony/dependency-injection": "^2.3.0|^3",
+                "symfony/filesystem": "^2.3.0|^3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.4.0,<4.8",
+                "squizlabs/php_codesniffer": "^2.0.0"
+            },
+            "bin": [
+                "src/bin/pdepend"
+            ],
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "PDepend\\": "src/main/php/PDepend"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "description": "Official version of pdepend to be handled with Composer",
+            "time": "2016-03-10 15:15:04"
+        },
+        {
+            "name": "phpdocumentor/reflection-common",
+            "version": "1.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
+                "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
+                "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.6"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "phpDocumentor\\Reflection\\": [
+                        "src"
+                    ]
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jaap van Otterdijk",
+                    "email": "opensource@ijaap.nl"
+                }
+            ],
+            "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
+            "homepage": "http://www.phpdoc.org",
+            "keywords": [
+                "FQSEN",
+                "phpDocumentor",
+                "phpdoc",
+                "reflection",
+                "static analysis"
+            ],
+            "time": "2015-12-27 11:43:31"
+        },
+        {
+            "name": "phpdocumentor/reflection-docblock",
+            "version": "3.1.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+                "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e",
+                "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5",
+                "phpdocumentor/reflection-common": "^1.0@dev",
+                "phpdocumentor/type-resolver": "^0.2.0",
+                "webmozart/assert": "^1.0"
+            },
+            "require-dev": {
+                "mockery/mockery": "^0.9.4",
+                "phpunit/phpunit": "^4.4"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "phpDocumentor\\Reflection\\": [
+                        "src/"
+                    ]
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Mike van Riel",
+                    "email": "me@mikevanriel.com"
+                }
+            ],
+            "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
+            "time": "2016-09-30 07:12:33"
+        },
+        {
+            "name": "phpdocumentor/type-resolver",
+            "version": "0.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpDocumentor/TypeResolver.git",
+                "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443",
+                "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5",
+                "phpdocumentor/reflection-common": "^1.0"
+            },
+            "require-dev": {
+                "mockery/mockery": "^0.9.4",
+                "phpunit/phpunit": "^5.2||^4.8.24"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "phpDocumentor\\Reflection\\": [
+                        "src/"
+                    ]
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Mike van Riel",
+                    "email": "me@mikevanriel.com"
+                }
+            ],
+            "time": "2016-06-10 07:14:17"
+        },
+        {
+            "name": "phpmd/phpmd",
+            "version": "2.4.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpmd/phpmd.git",
+                "reference": "2b9c2417a18696dfb578b38c116cd0ddc19b256e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpmd/phpmd/zipball/2b9c2417a18696dfb578b38c116cd0ddc19b256e",
+                "reference": "2b9c2417a18696dfb578b38c116cd0ddc19b256e",
+                "shasum": ""
+            },
+            "require": {
+                "pdepend/pdepend": "^2.0.4",
+                "php": ">=5.3.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.0",
+                "squizlabs/php_codesniffer": "^2.0"
+            },
+            "bin": [
+                "src/bin/phpmd"
+            ],
+            "type": "project",
+            "autoload": {
+                "psr-0": {
+                    "PHPMD\\": "src/main/php"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Manuel Pichler",
+                    "email": "github@manuel-pichler.de",
+                    "homepage": "https://github.com/manuelpichler",
+                    "role": "Project Founder"
+                },
+                {
+                    "name": "Other contributors",
+                    "homepage": "https://github.com/phpmd/phpmd/graphs/contributors",
+                    "role": "Contributors"
+                },
+                {
+                    "name": "Marc Würth",
+                    "email": "ravage@bluewin.ch",
+                    "homepage": "https://github.com/ravage84",
+                    "role": "Project Maintainer"
+                }
+            ],
+            "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.",
+            "homepage": "http://phpmd.org/",
+            "keywords": [
+                "mess detection",
+                "mess detector",
+                "pdepend",
+                "phpmd",
+                "pmd"
+            ],
+            "time": "2016-04-04 11:52:04"
+        },
+        {
+            "name": "phpspec/prophecy",
+            "version": "v1.6.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpspec/prophecy.git",
+                "reference": "58a8137754bc24b25740d4281399a4a3596058e0"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0",
+                "reference": "58a8137754bc24b25740d4281399a4a3596058e0",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/instantiator": "^1.0.2",
+                "php": "^5.3|^7.0",
+                "phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
+                "sebastian/comparator": "^1.1",
+                "sebastian/recursion-context": "^1.0"
+            },
+            "require-dev": {
+                "phpspec/phpspec": "^2.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.6.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-0": {
+                    "Prophecy\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Konstantin Kudryashov",
+                    "email": "ever.zet@gmail.com",
+                    "homepage": "http://everzet.com"
+                },
+                {
+                    "name": "Marcello Duarte",
+                    "email": "marcello.duarte@gmail.com"
+                }
+            ],
+            "description": "Highly opinionated mocking framework for PHP 5.3+",
+            "homepage": "https://github.com/phpspec/prophecy",
+            "keywords": [
+                "Double",
+                "Dummy",
+                "fake",
+                "mock",
+                "spy",
+                "stub"
+            ],
+            "time": "2016-06-07 08:13:47"
+        },
+        {
+            "name": "phpunit/php-code-coverage",
+            "version": "2.2.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+                "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+                "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "phpunit/php-file-iterator": "~1.3",
+                "phpunit/php-text-template": "~1.2",
+                "phpunit/php-token-stream": "~1.3",
+                "sebastian/environment": "^1.3.2",
+                "sebastian/version": "~1.0"
+            },
+            "require-dev": {
+                "ext-xdebug": ">=2.1.4",
+                "phpunit/phpunit": "~4"
+            },
+            "suggest": {
+                "ext-dom": "*",
+                "ext-xdebug": ">=2.2.1",
+                "ext-xmlwriter": "*"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.2.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+            "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+            "keywords": [
+                "coverage",
+                "testing",
+                "xunit"
+            ],
+            "time": "2015-10-06 15:47:00"
+        },
+        {
+            "name": "phpunit/php-file-iterator",
+            "version": "1.4.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+                "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
+                "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.4.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+            "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+            "keywords": [
+                "filesystem",
+                "iterator"
+            ],
+            "time": "2015-06-21 13:08:43"
+        },
+        {
+            "name": "phpunit/php-invoker",
+            "version": "1.1.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-invoker.git",
+                "reference": "86074bf0fc2caf02ec8819a93f65a37cd0b44c8e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/86074bf0fc2caf02ec8819a93f65a37cd0b44c8e",
+                "reference": "86074bf0fc2caf02ec8819a93f65a37cd0b44c8e",
+                "shasum": ""
+            },
+            "require": {
+                "ext-pcntl": "*",
+                "php": ">=5.3.3",
+                "phpunit/php-timer": ">=1.0.6"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Utility class for invoking callables with a timeout.",
+            "homepage": "https://github.com/sebastianbergmann/php-invoker/",
+            "keywords": [
+                "process"
+            ],
+            "time": "2015-06-21 13:32:55"
+        },
+        {
+            "name": "phpunit/php-text-template",
+            "version": "1.2.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-text-template.git",
+                "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+                "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Simple template engine.",
+            "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+            "keywords": [
+                "template"
+            ],
+            "time": "2015-06-21 13:50:34"
+        },
+        {
+            "name": "phpunit/php-timer",
+            "version": "1.0.8",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-timer.git",
+                "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
+                "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4|~5"
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Utility class for timing",
+            "homepage": "https://github.com/sebastianbergmann/php-timer/",
+            "keywords": [
+                "timer"
+            ],
+            "time": "2016-05-12 18:03:57"
+        },
+        {
+            "name": "phpunit/php-token-stream",
+            "version": "1.4.8",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+                "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
+                "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
+                "shasum": ""
+            },
+            "require": {
+                "ext-tokenizer": "*",
+                "php": ">=5.3.3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.2"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.4-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de"
+                }
+            ],
+            "description": "Wrapper around PHP's tokenizer extension.",
+            "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
+            "keywords": [
+                "tokenizer"
+            ],
+            "time": "2015-09-15 10:49:45"
+        },
+        {
+            "name": "phpunit/phpunit",
+            "version": "4.8.27",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/phpunit.git",
+                "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c062dddcb68e44b563f66ee319ddae2b5a322a90",
+                "reference": "c062dddcb68e44b563f66ee319ddae2b5a322a90",
+                "shasum": ""
+            },
+            "require": {
+                "ext-dom": "*",
+                "ext-json": "*",
+                "ext-pcre": "*",
+                "ext-reflection": "*",
+                "ext-spl": "*",
+                "php": ">=5.3.3",
+                "phpspec/prophecy": "^1.3.1",
+                "phpunit/php-code-coverage": "~2.1",
+                "phpunit/php-file-iterator": "~1.4",
+                "phpunit/php-text-template": "~1.2",
+                "phpunit/php-timer": "^1.0.6",
+                "phpunit/phpunit-mock-objects": "~2.3",
+                "sebastian/comparator": "~1.1",
+                "sebastian/diff": "~1.2",
+                "sebastian/environment": "~1.3",
+                "sebastian/exporter": "~1.2",
+                "sebastian/global-state": "~1.0",
+                "sebastian/version": "~1.0",
+                "symfony/yaml": "~2.1|~3.0"
+            },
+            "suggest": {
+                "phpunit/php-invoker": "~1.1"
+            },
+            "bin": [
+                "phpunit"
+            ],
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "4.8.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "The PHP Unit Testing framework.",
+            "homepage": "https://phpunit.de/",
+            "keywords": [
+                "phpunit",
+                "testing",
+                "xunit"
+            ],
+            "time": "2016-07-21 06:48:14"
+        },
+        {
+            "name": "phpunit/phpunit-mock-objects",
+            "version": "2.3.8",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
+                "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
+                "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/instantiator": "^1.0.2",
+                "php": ">=5.3.3",
+                "phpunit/php-text-template": "~1.2",
+                "sebastian/exporter": "~1.2"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.4"
+            },
+            "suggest": {
+                "ext-soap": "*"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sb@sebastian-bergmann.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Mock Object library for PHPUnit",
+            "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
+            "keywords": [
+                "mock",
+                "xunit"
+            ],
+            "time": "2015-10-02 06:51:40"
+        },
+        {
+            "name": "psr/log",
+            "version": "1.0.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-fig/log.git",
+                "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+                "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Psr\\Log\\": "Psr/Log/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "PHP-FIG",
+                    "homepage": "http://www.php-fig.org/"
+                }
+            ],
+            "description": "Common interface for logging libraries",
+            "homepage": "https://github.com/php-fig/log",
+            "keywords": [
+                "log",
+                "psr",
+                "psr-3"
+            ],
+            "time": "2016-10-10 12:19:37"
+        },
+        {
+            "name": "sebastian/comparator",
+            "version": "1.2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/comparator.git",
+                "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
+                "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "sebastian/diff": "~1.2",
+                "sebastian/exporter": "~1.2"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.4"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.2.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Jeff Welch",
+                    "email": "whatthejeff@gmail.com"
+                },
+                {
+                    "name": "Volker Dusch",
+                    "email": "github@wallbash.com"
+                },
+                {
+                    "name": "Bernhard Schussek",
+                    "email": "bschussek@2bepublished.at"
+                },
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de"
+                }
+            ],
+            "description": "Provides the functionality to compare PHP values for equality",
+            "homepage": "http://www.github.com/sebastianbergmann/comparator",
+            "keywords": [
+                "comparator",
+                "compare",
+                "equality"
+            ],
+            "time": "2015-07-26 15:48:44"
+        },
+        {
+            "name": "sebastian/diff",
+            "version": "1.4.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/diff.git",
+                "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
+                "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.8"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.4-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Kore Nordmann",
+                    "email": "mail@kore-nordmann.de"
+                },
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de"
+                }
+            ],
+            "description": "Diff implementation",
+            "homepage": "https://github.com/sebastianbergmann/diff",
+            "keywords": [
+                "diff"
+            ],
+            "time": "2015-12-08 07:14:41"
+        },
+        {
+            "name": "sebastian/environment",
+            "version": "1.3.8",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/environment.git",
+                "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea",
+                "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^5.3.3 || ^7.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.8 || ^5.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.3.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de"
+                }
+            ],
+            "description": "Provides functionality to handle HHVM/PHP environments",
+            "homepage": "http://www.github.com/sebastianbergmann/environment",
+            "keywords": [
+                "Xdebug",
+                "environment",
+                "hhvm"
+            ],
+            "time": "2016-08-18 05:49:44"
+        },
+        {
+            "name": "sebastian/exporter",
+            "version": "1.2.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/exporter.git",
+                "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
+                "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "sebastian/recursion-context": "~1.0"
+            },
+            "require-dev": {
+                "ext-mbstring": "*",
+                "phpunit/phpunit": "~4.4"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.3.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Jeff Welch",
+                    "email": "whatthejeff@gmail.com"
+                },
+                {
+                    "name": "Volker Dusch",
+                    "email": "github@wallbash.com"
+                },
+                {
+                    "name": "Bernhard Schussek",
+                    "email": "bschussek@2bepublished.at"
+                },
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de"
+                },
+                {
+                    "name": "Adam Harvey",
+                    "email": "aharvey@php.net"
+                }
+            ],
+            "description": "Provides the functionality to export PHP variables for visualization",
+            "homepage": "http://www.github.com/sebastianbergmann/exporter",
+            "keywords": [
+                "export",
+                "exporter"
+            ],
+            "time": "2016-06-17 09:04:28"
+        },
+        {
+            "name": "sebastian/global-state",
+            "version": "1.1.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/global-state.git",
+                "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
+                "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.2"
+            },
+            "suggest": {
+                "ext-uopz": "*"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de"
+                }
+            ],
+            "description": "Snapshotting of global state",
+            "homepage": "http://www.github.com/sebastianbergmann/global-state",
+            "keywords": [
+                "global state"
+            ],
+            "time": "2015-10-12 03:26:01"
+        },
+        {
+            "name": "sebastian/recursion-context",
+            "version": "1.0.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/recursion-context.git",
+                "reference": "913401df809e99e4f47b27cdd781f4a258d58791"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
+                "reference": "913401df809e99e4f47b27cdd781f4a258d58791",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.4"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Jeff Welch",
+                    "email": "whatthejeff@gmail.com"
+                },
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de"
+                },
+                {
+                    "name": "Adam Harvey",
+                    "email": "aharvey@php.net"
+                }
+            ],
+            "description": "Provides functionality to recursively process PHP variables",
+            "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+            "time": "2015-11-11 19:50:13"
+        },
+        {
+            "name": "sebastian/version",
+            "version": "1.0.6",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/sebastianbergmann/version.git",
+                "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+                "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+                "shasum": ""
+            },
+            "type": "library",
+            "autoload": {
+                "classmap": [
+                    "src/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Sebastian Bergmann",
+                    "email": "sebastian@phpunit.de",
+                    "role": "lead"
+                }
+            ],
+            "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+            "homepage": "https://github.com/sebastianbergmann/version",
+            "time": "2015-06-21 13:59:46"
+        },
+        {
+            "name": "squizlabs/php_codesniffer",
+            "version": "2.7.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+                "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/571e27b6348e5b3a637b2abc82ac0d01e6d7bbed",
+                "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed",
+                "shasum": ""
+            },
+            "require": {
+                "ext-simplexml": "*",
+                "ext-tokenizer": "*",
+                "ext-xmlwriter": "*",
+                "php": ">=5.1.2"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.0"
+            },
+            "bin": [
+                "scripts/phpcs",
+                "scripts/phpcbf"
+            ],
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.x-dev"
+                }
+            },
+            "autoload": {
+                "classmap": [
+                    "CodeSniffer.php",
+                    "CodeSniffer/CLI.php",
+                    "CodeSniffer/Exception.php",
+                    "CodeSniffer/File.php",
+                    "CodeSniffer/Fixer.php",
+                    "CodeSniffer/Report.php",
+                    "CodeSniffer/Reporting.php",
+                    "CodeSniffer/Sniff.php",
+                    "CodeSniffer/Tokens.php",
+                    "CodeSniffer/Reports/",
+                    "CodeSniffer/Tokenizers/",
+                    "CodeSniffer/DocGenerators/",
+                    "CodeSniffer/Standards/AbstractPatternSniff.php",
+                    "CodeSniffer/Standards/AbstractScopeSniff.php",
+                    "CodeSniffer/Standards/AbstractVariableSniff.php",
+                    "CodeSniffer/Standards/IncorrectPatternException.php",
+                    "CodeSniffer/Standards/Generic/Sniffs/",
+                    "CodeSniffer/Standards/MySource/Sniffs/",
+                    "CodeSniffer/Standards/PEAR/Sniffs/",
+                    "CodeSniffer/Standards/PSR1/Sniffs/",
+                    "CodeSniffer/Standards/PSR2/Sniffs/",
+                    "CodeSniffer/Standards/Squiz/Sniffs/",
+                    "CodeSniffer/Standards/Zend/Sniffs/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Greg Sherwood",
+                    "role": "lead"
+                }
+            ],
+            "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+            "homepage": "http://www.squizlabs.com/php-codesniffer",
+            "keywords": [
+                "phpcs",
+                "standards"
+            ],
+            "time": "2016-09-01 23:53:02"
+        },
+        {
+            "name": "symfony/config",
+            "version": "v3.1.6",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/config.git",
+                "reference": "949e7e846743a7f9e46dc50eb639d5fde1f53341"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/config/zipball/949e7e846743a7f9e46dc50eb639d5fde1f53341",
+                "reference": "949e7e846743a7f9e46dc50eb639d5fde1f53341",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.9",
+                "symfony/filesystem": "~2.8|~3.0"
+            },
+            "suggest": {
+                "symfony/yaml": "To use the yaml reference dumper"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Component\\Config\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Config Component",
+            "homepage": "https://symfony.com",
+            "time": "2016-09-25 08:27:07"
+        },
+        {
+            "name": "symfony/console",
+            "version": "v2.8.13",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/console.git",
+                "reference": "7350016c8abcab897046f1aead2b766b84d3eff8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/console/zipball/7350016c8abcab897046f1aead2b766b84d3eff8",
+                "reference": "7350016c8abcab897046f1aead2b766b84d3eff8",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.9",
+                "symfony/debug": "~2.7,>=2.7.2|~3.0.0",
+                "symfony/polyfill-mbstring": "~1.0"
+            },
+            "require-dev": {
+                "psr/log": "~1.0",
+                "symfony/event-dispatcher": "~2.1|~3.0.0",
+                "symfony/process": "~2.1|~3.0.0"
+            },
+            "suggest": {
+                "psr/log": "For using the console logger",
+                "symfony/event-dispatcher": "",
+                "symfony/process": ""
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.8-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Component\\Console\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Console Component",
+            "homepage": "https://symfony.com",
+            "time": "2016-10-06 01:43:09"
+        },
+        {
+            "name": "symfony/debug",
+            "version": "v3.0.9",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/debug.git",
+                "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a",
+                "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.9",
+                "psr/log": "~1.0"
+            },
+            "conflict": {
+                "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
+            },
+            "require-dev": {
+                "symfony/class-loader": "~2.8|~3.0",
+                "symfony/http-kernel": "~2.8|~3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.0-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Component\\Debug\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Debug Component",
+            "homepage": "https://symfony.com",
+            "time": "2016-07-30 07:22:48"
+        },
+        {
+            "name": "symfony/dependency-injection",
+            "version": "v3.1.6",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/dependency-injection.git",
+                "reference": "c578891216090069cd6d2e573402e13e39b3ad5c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/c578891216090069cd6d2e573402e13e39b3ad5c",
+                "reference": "c578891216090069cd6d2e573402e13e39b3ad5c",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.9"
+            },
+            "require-dev": {
+                "symfony/config": "~2.8|~3.0",
+                "symfony/expression-language": "~2.8|~3.0",
+                "symfony/yaml": "~2.8.7|~3.0.7|~3.1.1|~3.2"
+            },
+            "suggest": {
+                "symfony/config": "",
+                "symfony/expression-language": "For using expressions in service container configuration",
+                "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them",
+                "symfony/yaml": ""
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Component\\DependencyInjection\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony DependencyInjection Component",
+            "homepage": "https://symfony.com",
+            "time": "2016-10-24 15:52:44"
+        },
+        {
+            "name": "symfony/filesystem",
+            "version": "v3.1.6",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/filesystem.git",
+                "reference": "0565b61bf098cb4dc09f4f103f033138ae4f42c6"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/filesystem/zipball/0565b61bf098cb4dc09f4f103f033138ae4f42c6",
+                "reference": "0565b61bf098cb4dc09f4f103f033138ae4f42c6",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.9"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Component\\Filesystem\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Filesystem Component",
+            "homepage": "https://symfony.com",
+            "time": "2016-10-18 04:30:12"
+        },
+        {
+            "name": "symfony/polyfill-mbstring",
+            "version": "v1.2.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/polyfill-mbstring.git",
+                "reference": "dff51f72b0706335131b00a7f49606168c582594"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594",
+                "reference": "dff51f72b0706335131b00a7f49606168c582594",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3"
+            },
+            "suggest": {
+                "ext-mbstring": "For best performance"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.2-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Polyfill\\Mbstring\\": ""
+                },
+                "files": [
+                    "bootstrap.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Nicolas Grekas",
+                    "email": "p@tchwork.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony polyfill for the Mbstring extension",
+            "homepage": "https://symfony.com",
+            "keywords": [
+                "compatibility",
+                "mbstring",
+                "polyfill",
+                "portable",
+                "shim"
+            ],
+            "time": "2016-05-18 14:26:46"
+        },
+        {
+            "name": "symfony/yaml",
+            "version": "v3.1.6",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/yaml.git",
+                "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/yaml/zipball/7ff51b06c6c3d5cc6686df69004a42c69df09e27",
+                "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.9"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Component\\Yaml\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Yaml Component",
+            "homepage": "https://symfony.com",
+            "time": "2016-10-24 18:41:13"
+        },
+        {
+            "name": "webmozart/assert",
+            "version": "1.1.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/webmozart/assert.git",
+                "reference": "bb2d123231c095735130cc8f6d31385a44c7b308"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308",
+                "reference": "bb2d123231c095735130cc8f6d31385a44c7b308",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^5.3.3|^7.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.6",
+                "sebastian/version": "^1.0.1"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.2-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Webmozart\\Assert\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Bernhard Schussek",
+                    "email": "bschussek@gmail.com"
+                }
+            ],
+            "description": "Assertions to validate method input/output with nice error messages.",
+            "keywords": [
+                "assert",
+                "check",
+                "validate"
+            ],
+            "time": "2016-08-09 15:02:57"
+        }
+    ],
+    "aliases": [],
+    "minimum-stability": "stable",
+    "stability-flags": [],
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": {
+        "php": ">=5.5",
+        "ext-openssl": "*"
+    },
+    "platform-dev": []
+}

+ 33 - 0
vendor/lcobucci/jwt/phpunit.xml.dist

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
+    backupGlobals="false" 
+    backupStaticAttributes="false" 
+    bootstrap="vendor/autoload.php"
+    colors="true" 
+    verbose="true"
+    beStrictAboutOutputDuringTests="true"
+    beStrictAboutTestSize="true"
+    beStrictAboutTestsThatDoNotTestAnything="true"
+    beStrictAboutTodoAnnotatedTests="true"
+    checkForUnintentionallyCoveredCode="true"
+    forceCoversAnnotation="true">
+	<testsuites>
+		<testsuite name="Unit Test Suite">
+			<directory>test/unit</directory>
+		</testsuite>
+		<testsuite name="Integration Test Suite">
+			<directory>test/functional</directory>
+		</testsuite>
+	</testsuites>
+    
+    <filter>
+        <whitelist processUncoveredFilesFromWhitelist="true">
+            <directory suffix=".php">src</directory>
+        </whitelist>
+        
+        <blacklist>
+            <directory suffix=".php">vendor</directory>
+        </blacklist>
+    </filter>
+</phpunit>

+ 277 - 0
vendor/lcobucci/jwt/src/Builder.php

@@ -0,0 +1,277 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use BadMethodCallException;
+use Lcobucci\JWT\Claim\Factory as ClaimFactory;
+use Lcobucci\JWT\Parsing\Encoder;
+use Lcobucci\JWT\Signer\Key;
+
+/**
+ * This class makes easier the token creation process
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Builder
+{
+    /**
+     * The token header
+     *
+     * @var array
+     */
+    private $headers;
+
+    /**
+     * The token claim set
+     *
+     * @var array
+     */
+    private $claims;
+
+    /**
+     * The token signature
+     *
+     * @var Signature
+     */
+    private $signature;
+
+    /**
+     * The data encoder
+     *
+     * @var Encoder
+     */
+    private $encoder;
+
+    /**
+     * The factory of claims
+     *
+     * @var ClaimFactory
+     */
+    private $claimFactory;
+
+    /**
+     * Initializes a new builder
+     *
+     * @param Encoder $encoder
+     * @param ClaimFactory $claimFactory
+     */
+    public function __construct(
+        Encoder $encoder = null,
+        ClaimFactory $claimFactory = null
+    ) {
+        $this->encoder = $encoder ?: new Encoder();
+        $this->claimFactory = $claimFactory ?: new ClaimFactory();
+        $this->headers = ['typ'=> 'JWT', 'alg' => 'none'];
+        $this->claims = [];
+    }
+
+    /**
+     * Configures the audience
+     *
+     * @param string $audience
+     * @param boolean $replicateAsHeader
+     *
+     * @return Builder
+     */
+    public function setAudience($audience, $replicateAsHeader = false)
+    {
+        return $this->setRegisteredClaim('aud', (string) $audience, $replicateAsHeader);
+    }
+
+    /**
+     * Configures the expiration time
+     *
+     * @param int $expiration
+     * @param boolean $replicateAsHeader
+     *
+     * @return Builder
+     */
+    public function setExpiration($expiration, $replicateAsHeader = false)
+    {
+        return $this->setRegisteredClaim('exp', (int) $expiration, $replicateAsHeader);
+    }
+
+    /**
+     * Configures the token id
+     *
+     * @param string $id
+     * @param boolean $replicateAsHeader
+     *
+     * @return Builder
+     */
+    public function setId($id, $replicateAsHeader = false)
+    {
+        return $this->setRegisteredClaim('jti', (string) $id, $replicateAsHeader);
+    }
+
+    /**
+     * Configures the time that the token was issued
+     *
+     * @param int $issuedAt
+     * @param boolean $replicateAsHeader
+     *
+     * @return Builder
+     */
+    public function setIssuedAt($issuedAt, $replicateAsHeader = false)
+    {
+        return $this->setRegisteredClaim('iat', (int) $issuedAt, $replicateAsHeader);
+    }
+
+    /**
+     * Configures the issuer
+     *
+     * @param string $issuer
+     * @param boolean $replicateAsHeader
+     *
+     * @return Builder
+     */
+    public function setIssuer($issuer, $replicateAsHeader = false)
+    {
+        return $this->setRegisteredClaim('iss', (string) $issuer, $replicateAsHeader);
+    }
+
+    /**
+     * Configures the time before which the token cannot be accepted
+     *
+     * @param int $notBefore
+     * @param boolean $replicateAsHeader
+     *
+     * @return Builder
+     */
+    public function setNotBefore($notBefore, $replicateAsHeader = false)
+    {
+        return $this->setRegisteredClaim('nbf', (int) $notBefore, $replicateAsHeader);
+    }
+
+    /**
+     * Configures the subject
+     *
+     * @param string $subject
+     * @param boolean $replicateAsHeader
+     *
+     * @return Builder
+     */
+    public function setSubject($subject, $replicateAsHeader = false)
+    {
+        return $this->setRegisteredClaim('sub', (string) $subject, $replicateAsHeader);
+    }
+
+    /**
+     * Configures a registed claim
+     *
+     * @param string $name
+     * @param mixed $value
+     * @param boolean $replicate
+     *
+     * @return Builder
+     */
+    protected function setRegisteredClaim($name, $value, $replicate)
+    {
+        $this->set($name, $value);
+
+        if ($replicate) {
+            $this->headers[$name] = $this->claims[$name];
+        }
+
+        return $this;
+    }
+
+    /**
+     * Configures a header item
+     *
+     * @param string $name
+     * @param mixed $value
+     *
+     * @return Builder
+     *
+     * @throws BadMethodCallException When data has been already signed
+     */
+    public function setHeader($name, $value)
+    {
+        if ($this->signature) {
+            throw new BadMethodCallException('You must unsign before make changes');
+        }
+
+        $this->headers[(string) $name] = $this->claimFactory->create($name, $value);
+
+        return $this;
+    }
+
+    /**
+     * Configures a claim item
+     *
+     * @param string $name
+     * @param mixed $value
+     *
+     * @return Builder
+     *
+     * @throws BadMethodCallException When data has been already signed
+     */
+    public function set($name, $value)
+    {
+        if ($this->signature) {
+            throw new BadMethodCallException('You must unsign before making changes');
+        }
+
+        $this->claims[(string) $name] = $this->claimFactory->create($name, $value);
+
+        return $this;
+    }
+
+    /**
+     * Signs the data
+     *
+     * @param Signer $signer
+     * @param Key|string $key
+     *
+     * @return Builder
+     */
+    public function sign(Signer $signer, $key)
+    {
+        $signer->modifyHeader($this->headers);
+
+        $this->signature = $signer->sign(
+            $this->getToken()->getPayload(),
+            $key
+        );
+
+        return $this;
+    }
+
+    /**
+     * Removes the signature from the builder
+     *
+     * @return Builder
+     */
+    public function unsign()
+    {
+        $this->signature = null;
+
+        return $this;
+    }
+
+    /**
+     * Returns the resultant token
+     *
+     * @return Token
+     */
+    public function getToken()
+    {
+        $payload = [
+            $this->encoder->base64UrlEncode($this->encoder->jsonEncode($this->headers)),
+            $this->encoder->base64UrlEncode($this->encoder->jsonEncode($this->claims))
+        ];
+
+        if ($this->signature !== null) {
+            $payload[] = $this->encoder->base64UrlEncode($this->signature);
+        }
+
+        return new Token($this->headers, $this->claims, $this->signature, $payload);
+    }
+}

+ 40 - 0
vendor/lcobucci/jwt/src/Claim.php

@@ -0,0 +1,40 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use JsonSerializable;
+
+/**
+ * Basic interface for token claims
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+interface Claim extends JsonSerializable
+{
+    /**
+     * Returns the claim name
+     *
+     * @return string
+     */
+    public function getName();
+
+    /**
+     * Returns the claim value
+     *
+     * @return string
+     */
+    public function getValue();
+
+    /**
+     * Returns the string representation of the claim
+     *
+     * @return string
+     */
+    public function __toString();
+}

+ 73 - 0
vendor/lcobucci/jwt/src/Claim/Basic.php

@@ -0,0 +1,73 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\Claim;
+
+/**
+ * The default claim
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class Basic implements Claim
+{
+    /**
+     * @var string
+     */
+    private $name;
+
+    /**
+     * @var mixed
+     */
+    private $value;
+
+    /**
+     * Initializes the claim
+     *
+     * @param string $name
+     * @param mixed $value
+     */
+    public function __construct($name, $value)
+    {
+        $this->name = $name;
+        $this->value = $value;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getName()
+    {
+        return $this->name;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getValue()
+    {
+        return $this->value;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function jsonSerialize()
+    {
+        return $this->value;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function __toString()
+    {
+        return (string) $this->value;
+    }
+}

+ 32 - 0
vendor/lcobucci/jwt/src/Claim/EqualsTo.php

@@ -0,0 +1,32 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\Claim;
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * Validatable claim that checks if value is strictly equals to the given data
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class EqualsTo extends Basic implements Claim, Validatable
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function validate(ValidationData $data)
+    {
+        if ($data->has($this->getName())) {
+            return $this->getValue() === $data->get($this->getName());
+        }
+
+        return true;
+    }
+}

+ 116 - 0
vendor/lcobucci/jwt/src/Claim/Factory.php

@@ -0,0 +1,116 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\Claim;
+
+/**
+ * Class that create claims
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class Factory
+{
+    /**
+     * The list of claim callbacks
+     *
+     * @var array
+     */
+    private $callbacks;
+
+    /**
+     * Initializes the factory, registering the default callbacks
+     *
+     * @param array $callbacks
+     */
+    public function __construct(array $callbacks = [])
+    {
+        $this->callbacks = array_merge(
+            [
+                'iat' => [$this, 'createLesserOrEqualsTo'],
+                'nbf' => [$this, 'createLesserOrEqualsTo'],
+                'exp' => [$this, 'createGreaterOrEqualsTo'],
+                'iss' => [$this, 'createEqualsTo'],
+                'aud' => [$this, 'createEqualsTo'],
+                'sub' => [$this, 'createEqualsTo'],
+                'jti' => [$this, 'createEqualsTo']
+            ],
+            $callbacks
+        );
+    }
+
+    /**
+     * Create a new claim
+     *
+     * @param string $name
+     * @param mixed $value
+     *
+     * @return Claim
+     */
+    public function create($name, $value)
+    {
+        if (!empty($this->callbacks[$name])) {
+            return call_user_func($this->callbacks[$name], $name, $value);
+        }
+
+        return $this->createBasic($name, $value);
+    }
+
+    /**
+     * Creates a claim that can be compared (greator or equals)
+     *
+     * @param string $name
+     * @param mixed $value
+     *
+     * @return GreaterOrEqualsTo
+     */
+    private function createGreaterOrEqualsTo($name, $value)
+    {
+        return new GreaterOrEqualsTo($name, $value);
+    }
+
+    /**
+     * Creates a claim that can be compared (greator or equals)
+     *
+     * @param string $name
+     * @param mixed $value
+     *
+     * @return LesserOrEqualsTo
+     */
+    private function createLesserOrEqualsTo($name, $value)
+    {
+        return new LesserOrEqualsTo($name, $value);
+    }
+
+    /**
+     * Creates a claim that can be compared (equals)
+     *
+     * @param string $name
+     * @param mixed $value
+     *
+     * @return EqualsTo
+     */
+    private function createEqualsTo($name, $value)
+    {
+        return new EqualsTo($name, $value);
+    }
+
+    /**
+     * Creates a basic claim
+     *
+     * @param string $name
+     * @param mixed $value
+     *
+     * @return Basic
+     */
+    private function createBasic($name, $value)
+    {
+        return new Basic($name, $value);
+    }
+}

+ 32 - 0
vendor/lcobucci/jwt/src/Claim/GreaterOrEqualsTo.php

@@ -0,0 +1,32 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\Claim;
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * Validatable claim that checks if value is greater or equals the given data
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class GreaterOrEqualsTo extends Basic implements Claim, Validatable
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function validate(ValidationData $data)
+    {
+        if ($data->has($this->getName())) {
+            return $this->getValue() >= $data->get($this->getName());
+        }
+
+        return true;
+    }
+}

+ 32 - 0
vendor/lcobucci/jwt/src/Claim/LesserOrEqualsTo.php

@@ -0,0 +1,32 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\Claim;
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * Validatable claim that checks if value is lesser or equals to the given data
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class LesserOrEqualsTo extends Basic implements Claim, Validatable
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function validate(ValidationData $data)
+    {
+        if ($data->has($this->getName())) {
+            return $this->getValue() <= $data->get($this->getName());
+        }
+
+        return true;
+    }
+}

+ 28 - 0
vendor/lcobucci/jwt/src/Claim/Validatable.php

@@ -0,0 +1,28 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * Basic interface for validatable token claims
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+interface Validatable
+{
+    /**
+     * Returns if claim is valid according with given data
+     *
+     * @param ValidationData $data
+     *
+     * @return boolean
+     */
+    public function validate(ValidationData $data);
+}

+ 157 - 0
vendor/lcobucci/jwt/src/Parser.php

@@ -0,0 +1,157 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use InvalidArgumentException;
+use Lcobucci\JWT\Claim\Factory as ClaimFactory;
+use Lcobucci\JWT\Parsing\Decoder;
+
+/**
+ * This class parses the JWT strings and convert them into tokens
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Parser
+{
+    /**
+     * The data decoder
+     *
+     * @var Decoder
+     */
+    private $decoder;
+
+    /**
+     * The claims factory
+     *
+     * @var ClaimFactory
+     */
+    private $claimFactory;
+
+    /**
+     * Initializes the object
+     *
+     * @param Decoder $decoder
+     * @param ClaimFactory $claimFactory
+     */
+    public function __construct(
+        Decoder $decoder = null,
+        ClaimFactory $claimFactory = null
+    ) {
+        $this->decoder = $decoder ?: new Decoder();
+        $this->claimFactory = $claimFactory ?: new ClaimFactory();
+    }
+
+    /**
+     * Parses the JWT and returns a token
+     *
+     * @param string $jwt
+     *
+     * @return Token
+     */
+    public function parse($jwt)
+    {
+        $data = $this->splitJwt($jwt);
+        $header = $this->parseHeader($data[0]);
+        $claims = $this->parseClaims($data[1]);
+        $signature = $this->parseSignature($header, $data[2]);
+
+        foreach ($claims as $name => $value) {
+            if (isset($header[$name])) {
+                $header[$name] = $value;
+            }
+        }
+
+        if ($signature === null) {
+            unset($data[2]);
+        }
+
+        return new Token($header, $claims, $signature, $data);
+    }
+
+    /**
+     * Splits the JWT string into an array
+     *
+     * @param string $jwt
+     *
+     * @return array
+     *
+     * @throws InvalidArgumentException When JWT is not a string or is invalid
+     */
+    protected function splitJwt($jwt)
+    {
+        if (!is_string($jwt)) {
+            throw new InvalidArgumentException('The JWT string must have two dots');
+        }
+
+        $data = explode('.', $jwt);
+
+        if (count($data) != 3) {
+            throw new InvalidArgumentException('The JWT string must have two dots');
+        }
+
+        return $data;
+    }
+
+    /**
+     * Parses the header from a string
+     *
+     * @param string $data
+     *
+     * @return array
+     *
+     * @throws InvalidArgumentException When an invalid header is informed
+     */
+    protected function parseHeader($data)
+    {
+        $header = (array) $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data));
+
+        if (isset($header['enc'])) {
+            throw new InvalidArgumentException('Encryption is not supported yet');
+        }
+
+        return $header;
+    }
+
+    /**
+     * Parses the claim set from a string
+     *
+     * @param string $data
+     *
+     * @return array
+     */
+    protected function parseClaims($data)
+    {
+        $claims = (array) $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data));
+
+        foreach ($claims as $name => &$value) {
+            $value = $this->claimFactory->create($name, $value);
+        }
+
+        return $claims;
+    }
+
+    /**
+     * Returns the signature from given data
+     *
+     * @param array $header
+     * @param string $data
+     *
+     * @return Signature
+     */
+    protected function parseSignature(array $header, $data)
+    {
+        if ($data == '' || !isset($header['alg']) || $header['alg'] == 'none') {
+            return null;
+        }
+
+        $hash = $this->decoder->base64UrlDecode($data);
+
+        return new Signature($hash);
+    }
+}

+ 56 - 0
vendor/lcobucci/jwt/src/Parsing/Decoder.php

@@ -0,0 +1,56 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Parsing;
+
+use RuntimeException;
+
+/**
+ * Class that decodes data according with the specs of RFC-4648
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ *
+ * @link http://tools.ietf.org/html/rfc4648#section-5
+ */
+class Decoder
+{
+    /**
+     * Decodes from JSON, validating the errors (will return an associative array
+     * instead of objects)
+     *
+     * @param string $json
+     * @return mixed
+     *
+     * @throws RuntimeException When something goes wrong while decoding
+     */
+    public function jsonDecode($json)
+    {
+        $data = json_decode($json);
+
+        if (json_last_error() != JSON_ERROR_NONE) {
+            throw new RuntimeException('Error while decoding to JSON: ' . json_last_error_msg());
+        }
+
+        return $data;
+    }
+
+    /**
+     * Decodes from base64url
+     *
+     * @param string $data
+     * @return string
+     */
+    public function base64UrlDecode($data)
+    {
+        if ($remainder = strlen($data) % 4) {
+            $data .= str_repeat('=', 4 - $remainder);
+        }
+
+        return base64_decode(strtr($data, '-_', '+/'));
+    }
+}

+ 51 - 0
vendor/lcobucci/jwt/src/Parsing/Encoder.php

@@ -0,0 +1,51 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Parsing;
+
+use RuntimeException;
+
+/**
+ * Class that encodes data according with the specs of RFC-4648
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ *
+ * @link http://tools.ietf.org/html/rfc4648#section-5
+ */
+class Encoder
+{
+    /**
+     * Encodes to JSON, validating the errors
+     *
+     * @param mixed $data
+     * @return string
+     *
+     * @throws RuntimeException When something goes wrong while encoding
+     */
+    public function jsonEncode($data)
+    {
+        $json = json_encode($data);
+
+        if (json_last_error() != JSON_ERROR_NONE) {
+            throw new RuntimeException('Error while encoding to JSON: ' . json_last_error_msg());
+        }
+
+        return $json;
+    }
+
+    /**
+     * Encodes to base64url
+     *
+     * @param string $data
+     * @return string
+     */
+    public function base64UrlEncode($data)
+    {
+        return str_replace('=', '', strtr(base64_encode($data), '+/', '-_'));
+    }
+}

+ 59 - 0
vendor/lcobucci/jwt/src/Signature.php

@@ -0,0 +1,59 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+/**
+ * This class represents a token signature
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Signature
+{
+    /**
+     * The resultant hash
+     *
+     * @var string
+     */
+    protected $hash;
+
+    /**
+     * Initializes the object
+     *
+     * @param string $hash
+     */
+    public function __construct($hash)
+    {
+        $this->hash = $hash;
+    }
+
+    /**
+     * Verifies if the current hash matches with with the result of the creation of
+     * a new signature with given data
+     *
+     * @param Signer $signer
+     * @param string $payload
+     * @param string $key
+     *
+     * @return boolean
+     */
+    public function verify(Signer $signer, $payload, $key)
+    {
+        return $signer->verify($this->hash, $payload, $key);
+    }
+
+    /**
+     * Returns the current hash as a string representation of the signature
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return $this->hash;
+    }
+}

+ 59 - 0
vendor/lcobucci/jwt/src/Signer.php

@@ -0,0 +1,59 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use InvalidArgumentException;
+use Lcobucci\JWT\Signer\Key;
+
+/**
+ * Basic interface for token signers
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+interface Signer
+{
+    /**
+     * Returns the algorithm id
+     *
+     * @return string
+     */
+    public function getAlgorithmId();
+
+    /**
+     * Apply changes on headers according with algorithm
+     *
+     * @param array $headers
+     */
+    public function modifyHeader(array &$headers);
+
+    /**
+     * Returns a signature for given data
+     *
+     * @param string $payload
+     * @param Key|string $key
+     *
+     * @return Signature
+     *
+     * @throws InvalidArgumentException When given key is invalid
+     */
+    public function sign($payload, $key);
+
+    /**
+     * Returns if the expected hash matches with the data and key
+     *
+     * @param string $expected
+     * @param string $payload
+     * @param Key|string $key
+     *
+     * @return boolean
+     *
+     * @throws InvalidArgumentException When given key is invalid
+     */
+    public function verify($expected, $payload, $key);
+}

+ 78 - 0
vendor/lcobucci/jwt/src/Signer/BaseSigner.php

@@ -0,0 +1,78 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use Lcobucci\JWT\Signature;
+use Lcobucci\JWT\Signer;
+
+/**
+ * Base class for signers
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+abstract class BaseSigner implements Signer
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function modifyHeader(array &$headers)
+    {
+        $headers['alg'] = $this->getAlgorithmId();
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function sign($payload, $key)
+    {
+        return new Signature($this->createHash($payload, $this->getKey($key)));
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function verify($expected, $payload, $key)
+    {
+        return $this->doVerify($expected, $payload, $this->getKey($key));
+    }
+
+    /**
+     * @param Key|string $key
+     *
+     * @return Key
+     */
+    private function getKey($key)
+    {
+        if (is_string($key)) {
+            $key = new Key($key);
+        }
+
+        return $key;
+    }
+
+    /**
+     * Creates a hash with the given data
+     *
+     * @param string $payload
+     * @param Key $key
+     *
+     * @return string
+     */
+    abstract public function createHash($payload, Key $key);
+
+    /**
+     * Creates a hash with the given data
+     *
+     * @param string $payload
+     * @param Key $key
+     *
+     * @return boolean
+     */
+    abstract public function doVerify($expected, $payload, Key $key);
+}

+ 149 - 0
vendor/lcobucci/jwt/src/Signer/Ecdsa.php

@@ -0,0 +1,149 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use Lcobucci\JWT\Signer\Ecdsa\KeyParser;
+use Mdanter\Ecc\Crypto\Signature\Signature;
+use Mdanter\Ecc\Crypto\Signature\Signer;
+use Mdanter\Ecc\EccFactory;
+use Mdanter\Ecc\Math\MathAdapterInterface as Adapter;
+use Mdanter\Ecc\Random\RandomGeneratorFactory;
+use Mdanter\Ecc\Random\RandomNumberGeneratorInterface;
+
+/**
+ * Base class for ECDSA signers
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+abstract class Ecdsa extends BaseSigner
+{
+    /**
+     * @var Adapter
+     */
+    private $adapter;
+
+    /**
+     * @var Signer
+     */
+    private $signer;
+
+    /**
+     * @var KeyParser
+     */
+    private $parser;
+
+    /**
+     * @param Adapter $adapter
+     * @param EcdsaSigner $signer
+     * @param KeyParser $parser
+     */
+    public function __construct(Adapter $adapter = null, Signer $signer = null, KeyParser $parser = null)
+    {
+        $this->adapter = $adapter ?: EccFactory::getAdapter();
+        $this->signer = $signer ?: EccFactory::getSigner($this->adapter);
+        $this->parser = $parser ?: new KeyParser($this->adapter);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function createHash(
+        $payload,
+        Key $key,
+        RandomNumberGeneratorInterface $generator = null
+    ) {
+        $privateKey = $this->parser->getPrivateKey($key);
+        $generator = $generator ?: RandomGeneratorFactory::getRandomGenerator();
+
+        return $this->createSignatureHash(
+            $this->signer->sign(
+                $privateKey,
+                $this->createSigningHash($payload),
+                $generator->generate($privateKey->getPoint()->getOrder())
+            )
+        );
+    }
+
+    /**
+     * Creates a binary signature with R and S coordinates
+     *
+     * @param Signature $signature
+     *
+     * @return string
+     */
+    private function createSignatureHash(Signature $signature)
+    {
+        $length = $this->getSignatureLength();
+
+        return pack(
+            'H*',
+            sprintf(
+                '%s%s',
+                str_pad($this->adapter->decHex($signature->getR()), $length, '0', STR_PAD_LEFT),
+                str_pad($this->adapter->decHex($signature->getS()), $length, '0', STR_PAD_LEFT)
+            )
+        );
+    }
+
+    /**
+     * Creates a hash using the signer algorithm with given payload
+     *
+     * @param string $payload
+     *
+     * @return int|string
+     */
+    private function createSigningHash($payload)
+    {
+        return $this->adapter->hexDec(hash($this->getAlgorithm(), $payload));
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function doVerify($expected, $payload, Key $key)
+    {
+        return $this->signer->verify(
+            $this->parser->getPublicKey($key),
+            $this->extractSignature($expected),
+            $this->createSigningHash($payload)
+        );
+    }
+
+    /**
+     * Extracts R and S values from given data
+     *
+     * @param string $value
+     *
+     * @return \Mdanter\Ecc\Crypto\Signature\Signature
+     */
+    private function extractSignature($value)
+    {
+        $length = $this->getSignatureLength();
+        $value = unpack('H*', $value)[1];
+
+        return new Signature(
+            $this->adapter->hexDec(substr($value, 0, $length)),
+            $this->adapter->hexDec(substr($value, $length))
+        );
+    }
+
+    /**
+     * Returns the lenght of signature parts
+     *
+     * @return int
+     */
+    abstract public function getSignatureLength();
+
+    /**
+     * Returns the name of algorithm to be used to create the signing hash
+     *
+     * @return string
+     */
+    abstract public function getAlgorithm();
+}

+ 102 - 0
vendor/lcobucci/jwt/src/Signer/Ecdsa/KeyParser.php

@@ -0,0 +1,102 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+use InvalidArgumentException;
+use Lcobucci\JWT\Signer\Key;
+use Mdanter\Ecc\Math\MathAdapterInterface;
+use Mdanter\Ecc\Serializer\PrivateKey\DerPrivateKeySerializer;
+use Mdanter\Ecc\Serializer\PrivateKey\PemPrivateKeySerializer;
+use Mdanter\Ecc\Serializer\PrivateKey\PrivateKeySerializerInterface;
+use Mdanter\Ecc\Serializer\PublicKey\DerPublicKeySerializer;
+use Mdanter\Ecc\Serializer\PublicKey\PemPublicKeySerializer;
+use Mdanter\Ecc\Serializer\PublicKey\PublicKeySerializerInterface;
+
+/**
+ * Base class for ECDSA signers
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 3.0.4
+ */
+class KeyParser
+{
+    /**
+     * @var PrivateKeySerializerInterface
+     */
+    private $privateKeySerializer;
+
+    /**
+     * @var PublicKeySerializerInterface
+     */
+    private $publicKeySerializer;
+
+    /**
+     * @param MathAdapterInterface $adapter
+     * @param PrivateKeySerializerInterface $privateKeySerializer
+     * @param PublicKeySerializerInterface $publicKeySerializer
+     */
+    public function __construct(
+        MathAdapterInterface $adapter,
+        PrivateKeySerializerInterface $privateKeySerializer = null,
+        PublicKeySerializerInterface $publicKeySerializer = null
+    ) {
+        $this->privateKeySerializer = $privateKeySerializer ?: new PemPrivateKeySerializer(new DerPrivateKeySerializer($adapter));
+        $this->publicKeySerializer = $publicKeySerializer ?: new PemPublicKeySerializer(new DerPublicKeySerializer($adapter));
+    }
+
+    /**
+     * Parses a public key from the given PEM content
+     *
+     * @param Key $key
+     *
+     * @return \Mdanter\Ecc\Crypto\Key\PublicKeyInterface
+     */
+    public function getPublicKey(Key $key)
+    {
+        return $this->publicKeySerializer->parse($this->getKeyContent($key, 'PUBLIC KEY'));
+    }
+
+    /**
+     * Parses a private key from the given PEM content
+     *
+     * @param Key $key
+     *
+     * @return \Mdanter\Ecc\Crypto\Key\PrivateKeyInterface
+     */
+    public function getPrivateKey(Key $key)
+    {
+        return $this->privateKeySerializer->parse($this->getKeyContent($key, 'EC PRIVATE KEY'));
+    }
+
+    /**
+     * Extracts the base 64 value from the PEM certificate
+     *
+     * @param Key $key
+     * @param string $header
+     *
+     * @return string
+     *
+     * @throws InvalidArgumentException When given key is not a ECDSA key
+     */
+    private function getKeyContent(Key $key, $header)
+    {
+        $match = null;
+
+        preg_match(
+            '/[\-]{5}BEGIN ' . $header . '[\-]{5}(.*)[\-]{5}END ' . $header . '[\-]{5}/',
+            str_replace([PHP_EOL, "\n", "\r"], '', $key->getContent()),
+            $match
+        );
+
+        if (isset($match[1])) {
+            return $match[1];
+        }
+
+        throw new InvalidArgumentException('This is not a valid ECDSA key.');
+    }
+}

+ 43 - 0
vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha256.php

@@ -0,0 +1,43 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+use Lcobucci\JWT\Signer\Ecdsa;
+
+/**
+ * Signer for ECDSA SHA-256
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha256 extends Ecdsa
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithmId()
+    {
+        return 'ES256';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithm()
+    {
+        return 'sha256';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getSignatureLength()
+    {
+        return 64;
+    }
+}

+ 43 - 0
vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha384.php

@@ -0,0 +1,43 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+use Lcobucci\JWT\Signer\Ecdsa;
+
+/**
+ * Signer for ECDSA SHA-384
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha384 extends Ecdsa
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithmId()
+    {
+        return 'ES384';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithm()
+    {
+        return 'sha384';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getSignatureLength()
+    {
+        return 96;
+    }
+}

+ 43 - 0
vendor/lcobucci/jwt/src/Signer/Ecdsa/Sha512.php

@@ -0,0 +1,43 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+use Lcobucci\JWT\Signer\Ecdsa;
+
+/**
+ * Signer for ECDSA SHA-512
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha512 extends Ecdsa
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithmId()
+    {
+        return 'ES512';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithm()
+    {
+        return 'sha512';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getSignatureLength()
+    {
+        return 132;
+    }
+}

+ 71 - 0
vendor/lcobucci/jwt/src/Signer/Hmac.php

@@ -0,0 +1,71 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+/**
+ * Base class for hmac signers
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+abstract class Hmac extends BaseSigner
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function createHash($payload, Key $key)
+    {
+        return hash_hmac($this->getAlgorithm(), $payload, $key->getContent(), true);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function doVerify($expected, $payload, Key $key)
+    {
+        if (!is_string($expected)) {
+            return false;
+        }
+
+        $callback = function_exists('hash_equals') ? 'hash_equals' : [$this, 'hashEquals'];
+
+        return call_user_func($callback, $expected, $this->createHash($payload, $key));
+    }
+
+    /**
+     * PHP < 5.6 timing attack safe hash comparison
+     *
+     * @param string $expected
+     * @param string $generated
+     *
+     * @return boolean
+     */
+    public function hashEquals($expected, $generated)
+    {
+        $expectedLength = strlen($expected);
+
+        if ($expectedLength !== strlen($generated)) {
+            return false;
+        }
+
+        $res = 0;
+
+        for ($i = 0; $i < $expectedLength; ++$i) {
+            $res |= ord($expected[$i]) ^ ord($generated[$i]);
+        }
+
+        return $res === 0;
+    }
+
+    /**
+     * Returns the algorithm name
+     *
+     * @return string
+     */
+    abstract public function getAlgorithm();
+}

+ 35 - 0
vendor/lcobucci/jwt/src/Signer/Hmac/Sha256.php

@@ -0,0 +1,35 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Hmac;
+
+use Lcobucci\JWT\Signer\Hmac;
+
+/**
+ * Signer for HMAC SHA-256
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Sha256 extends Hmac
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithmId()
+    {
+        return 'HS256';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithm()
+    {
+        return 'sha256';
+    }
+}

+ 35 - 0
vendor/lcobucci/jwt/src/Signer/Hmac/Sha384.php

@@ -0,0 +1,35 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Hmac;
+
+use Lcobucci\JWT\Signer\Hmac;
+
+/**
+ * Signer for HMAC SHA-384
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Sha384 extends Hmac
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithmId()
+    {
+        return 'HS384';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithm()
+    {
+        return 'sha384';
+    }
+}

+ 35 - 0
vendor/lcobucci/jwt/src/Signer/Hmac/Sha512.php

@@ -0,0 +1,35 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Hmac;
+
+use Lcobucci\JWT\Signer\Hmac;
+
+/**
+ * Signer for HMAC SHA-512
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Sha512 extends Hmac
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithmId()
+    {
+        return 'HS512';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithm()
+    {
+        return 'sha512';
+    }
+}

+ 85 - 0
vendor/lcobucci/jwt/src/Signer/Key.php

@@ -0,0 +1,85 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use InvalidArgumentException;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 3.0.4
+ */
+final class Key
+{
+    /**
+     * @var string
+     */
+    private $content;
+
+    /**
+     * @var string
+     */
+    private $passphrase;
+
+    /**
+     * @param string $content
+     * @param string $passphrase
+     */
+    public function __construct($content, $passphrase = null)
+    {
+        $this->setContent($content);
+        $this->passphrase = $passphrase;
+    }
+
+    /**
+     * @param string $content
+     *
+     * @throws InvalidArgumentException
+     */
+    private function setContent($content)
+    {
+        if (strpos($content, 'file://') === 0) {
+            $content = $this->readFile($content);
+        }
+
+        $this->content = $content;
+    }
+
+    /**
+     * @param string $content
+     *
+     * @return string
+     *
+     * @throws \InvalidArgumentException
+     */
+    private function readFile($content)
+    {
+        $file = substr($content, 7);
+
+        if (!is_readable($file)) {
+            throw new \InvalidArgumentException('You must inform a valid key file');
+        }
+
+        return file_get_contents($file);
+    }
+
+    /**
+     * @return string
+     */
+    public function getContent()
+    {
+        return $this->content;
+    }
+
+    /**
+     * @return string
+     */
+    public function getPassphrase()
+    {
+        return $this->passphrase;
+    }
+}

+ 44 - 0
vendor/lcobucci/jwt/src/Signer/Keychain.php

@@ -0,0 +1,44 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+/**
+ * A utilitarian class that encapsulates the retrieval of public and private keys
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ *
+ * @deprecated Since we've removed OpenSSL from ECDSA there's no reason to use this class
+ */
+class Keychain
+{
+    /**
+     * Returns a private key from file path or content
+     *
+     * @param string $key
+     * @param string $passphrase
+     *
+     * @return Key
+     */
+    public function getPrivateKey($key, $passphrase = null)
+    {
+        return new Key($key, $passphrase);
+    }
+
+    /**
+     * Returns a public key from file path or content
+     *
+     * @param string $certificate
+     *
+     * @return Key
+     */
+    public function getPublicKey($certificate)
+    {
+        return new Key($certificate);
+    }
+}

+ 78 - 0
vendor/lcobucci/jwt/src/Signer/Rsa.php

@@ -0,0 +1,78 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use InvalidArgumentException;
+
+/**
+ * Base class for RSASSA-PKCS1 signers
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+abstract class Rsa extends BaseSigner
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function createHash($payload, Key $key)
+    {
+        $key = openssl_get_privatekey($key->getContent(), $key->getPassphrase());
+        $this->validateKey($key);
+
+        $signature = '';
+
+        if (!openssl_sign($payload, $signature, $key, $this->getAlgorithm())) {
+            throw new InvalidArgumentException(
+                'There was an error while creating the signature: ' . openssl_error_string()
+            );
+        }
+
+        return $signature;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function doVerify($expected, $payload, Key $key)
+    {
+        $key = openssl_get_publickey($key->getContent());
+        $this->validateKey($key);
+
+        return openssl_verify($payload, $expected, $key, $this->getAlgorithm()) === 1;
+    }
+
+    /**
+     * Validates if the given key is a valid RSA public/private key
+     *
+     * @param resource $key
+     *
+     * @throws InvalidArgumentException
+     */
+    private function validateKey($key)
+    {
+        if ($key === false) {
+            throw new InvalidArgumentException(
+                'It was not possible to parse your key, reason: ' . openssl_error_string()
+            );
+        }
+
+        $details = openssl_pkey_get_details($key);
+
+        if (!isset($details['key']) || $details['type'] !== OPENSSL_KEYTYPE_RSA) {
+            throw new InvalidArgumentException('This key is not compatible with RSA signatures');
+        }
+    }
+
+    /**
+     * Returns the algorithm name
+     *
+     * @return string
+     */
+    abstract public function getAlgorithm();
+}

+ 35 - 0
vendor/lcobucci/jwt/src/Signer/Rsa/Sha256.php

@@ -0,0 +1,35 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Rsa;
+
+use Lcobucci\JWT\Signer\Rsa;
+
+/**
+ * Signer for RSA SHA-256
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha256 extends Rsa
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithmId()
+    {
+        return 'RS256';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithm()
+    {
+        return OPENSSL_ALGO_SHA256;
+    }
+}

+ 35 - 0
vendor/lcobucci/jwt/src/Signer/Rsa/Sha384.php

@@ -0,0 +1,35 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Rsa;
+
+use Lcobucci\JWT\Signer\Rsa;
+
+/**
+ * Signer for RSA SHA-384
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha384 extends Rsa
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithmId()
+    {
+        return 'RS384';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithm()
+    {
+        return OPENSSL_ALGO_SHA384;
+    }
+}

+ 35 - 0
vendor/lcobucci/jwt/src/Signer/Rsa/Sha512.php

@@ -0,0 +1,35 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Rsa;
+
+use Lcobucci\JWT\Signer\Rsa;
+
+/**
+ * Signer for RSA SHA-512
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha512 extends Rsa
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithmId()
+    {
+        return 'RS512';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getAlgorithm()
+    {
+        return OPENSSL_ALGO_SHA512;
+    }
+}

+ 284 - 0
vendor/lcobucci/jwt/src/Token.php

@@ -0,0 +1,284 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use BadMethodCallException;
+use DateTime;
+use DateTimeInterface;
+use Generator;
+use Lcobucci\JWT\Claim\Validatable;
+use OutOfBoundsException;
+
+/**
+ * Basic structure of the JWT
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Token
+{
+    /**
+     * The token headers
+     *
+     * @var array
+     */
+    private $headers;
+
+    /**
+     * The token claim set
+     *
+     * @var array
+     */
+    private $claims;
+
+    /**
+     * The token signature
+     *
+     * @var Signature
+     */
+    private $signature;
+
+    /**
+     * The encoded data
+     *
+     * @var array
+     */
+    private $payload;
+
+    /**
+     * Initializes the object
+     *
+     * @param array $headers
+     * @param array $claims
+     * @param array $payload
+     * @param Signature $signature
+     */
+    public function __construct(
+        array $headers = ['alg' => 'none'],
+        array $claims = [],
+        Signature $signature = null,
+        array $payload = ['', '']
+    ) {
+        $this->headers = $headers;
+        $this->claims = $claims;
+        $this->signature = $signature;
+        $this->payload = $payload;
+    }
+
+    /**
+     * Returns the token headers
+     *
+     * @return array
+     */
+    public function getHeaders()
+    {
+        return $this->headers;
+    }
+
+    /**
+     * Returns if the header is configured
+     *
+     * @param string $name
+     *
+     * @return boolean
+     */
+    public function hasHeader($name)
+    {
+        return array_key_exists($name, $this->headers);
+    }
+
+    /**
+     * Returns the value of a token header
+     *
+     * @param string $name
+     * @param mixed $default
+     *
+     * @return mixed
+     *
+     * @throws OutOfBoundsException
+     */
+    public function getHeader($name, $default = null)
+    {
+        if ($this->hasHeader($name)) {
+            return $this->getHeaderValue($name);
+        }
+
+        if ($default === null) {
+            throw new OutOfBoundsException('Requested header is not configured');
+        }
+
+        return $default;
+    }
+
+    /**
+     * Returns the value stored in header
+     *
+     * @param string $name
+     *
+     * @return mixed
+     */
+    private function getHeaderValue($name)
+    {
+        $header = $this->headers[$name];
+
+        if ($header instanceof Claim) {
+            return $header->getValue();
+        }
+
+        return $header;
+    }
+
+    /**
+     * Returns the token claim set
+     *
+     * @return array
+     */
+    public function getClaims()
+    {
+        return $this->claims;
+    }
+
+    /**
+     * Returns if the claim is configured
+     *
+     * @param string $name
+     *
+     * @return boolean
+     */
+    public function hasClaim($name)
+    {
+        return array_key_exists($name, $this->claims);
+    }
+
+    /**
+     * Returns the value of a token claim
+     *
+     * @param string $name
+     * @param mixed $default
+     *
+     * @return mixed
+     *
+     * @throws OutOfBoundsException
+     */
+    public function getClaim($name, $default = null)
+    {
+        if ($this->hasClaim($name)) {
+            return $this->claims[$name]->getValue();
+        }
+
+        if ($default === null) {
+            throw new OutOfBoundsException('Requested claim is not configured');
+        }
+
+        return $default;
+    }
+
+    /**
+     * Verify if the key matches with the one that created the signature
+     *
+     * @param Signer $signer
+     * @param string $key
+     *
+     * @return boolean
+     *
+     * @throws BadMethodCallException When token is not signed
+     */
+    public function verify(Signer $signer, $key)
+    {
+        if ($this->signature === null) {
+            throw new BadMethodCallException('This token is not signed');
+        }
+
+        if ($this->headers['alg'] !== $signer->getAlgorithmId()) {
+            return false;
+        }
+
+        return $this->signature->verify($signer, $this->getPayload(), $key);
+    }
+
+    /**
+     * Validates if the token is valid
+     *
+     * @param ValidationData $data
+     *
+     * @return boolean
+     */
+    public function validate(ValidationData $data)
+    {
+        foreach ($this->getValidatableClaims() as $claim) {
+            if (!$claim->validate($data)) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Determine if the token is expired.
+     *
+     * @param DateTimeInterface $now Defaults to the current time.
+     *
+     * @return bool
+     */
+    public function isExpired(DateTimeInterface $now = null)
+    {
+        $exp = $this->getClaim('exp', false);
+
+        if ($exp === false) {
+            return false;
+        }
+
+        $now = $now ?: new DateTime();
+
+        $expiresAt = new DateTime();
+        $expiresAt->setTimestamp($exp);
+
+        return $now > $expiresAt;
+    }
+
+    /**
+     * Yields the validatable claims
+     *
+     * @return Generator
+     */
+    private function getValidatableClaims()
+    {
+        foreach ($this->claims as $claim) {
+            if ($claim instanceof Validatable) {
+                yield $claim;
+            }
+        }
+    }
+
+    /**
+     * Returns the token payload
+     *
+     * @return string
+     */
+    public function getPayload()
+    {
+        return $this->payload[0] . '.' . $this->payload[1];
+    }
+
+    /**
+     * Returns an encoded representation of the token
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        $data = implode('.', $this->payload);
+
+        if ($this->signature === null) {
+            $data .= '.';
+        }
+
+        return $data;
+    }
+}

+ 120 - 0
vendor/lcobucci/jwt/src/ValidationData.php

@@ -0,0 +1,120 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+/**
+ * Class that wraps validation values
+ *
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class ValidationData
+{
+    /**
+     * The list of things to be validated
+     *
+     * @var array
+     */
+    private $items;
+
+    /**
+     * Initializes the object
+     *
+     * @param int $currentTime
+     */
+    public function __construct($currentTime = null)
+    {
+        $currentTime = $currentTime ?: time();
+
+        $this->items = [
+            'jti' => null,
+            'iss' => null,
+            'aud' => null,
+            'sub' => null,
+            'iat' => $currentTime,
+            'nbf' => $currentTime,
+            'exp' => $currentTime
+        ];
+    }
+
+    /**
+     * Configures the id
+     *
+     * @param string $id
+     */
+    public function setId($id)
+    {
+        $this->items['jti'] = (string) $id;
+    }
+
+    /**
+     * Configures the issuer
+     *
+     * @param string $issuer
+     */
+    public function setIssuer($issuer)
+    {
+        $this->items['iss'] = (string) $issuer;
+    }
+
+    /**
+     * Configures the audience
+     *
+     * @param string $audience
+     */
+    public function setAudience($audience)
+    {
+        $this->items['aud'] = (string) $audience;
+    }
+
+    /**
+     * Configures the subject
+     *
+     * @param string $subject
+     */
+    public function setSubject($subject)
+    {
+        $this->items['sub'] = (string) $subject;
+    }
+
+    /**
+     * Configures the time that "iat", "nbf" and "exp" should be based on
+     *
+     * @param int $currentTime
+     */
+    public function setCurrentTime($currentTime)
+    {
+        $this->items['iat'] = (int) $currentTime;
+        $this->items['nbf'] = (int) $currentTime;
+        $this->items['exp'] = (int) $currentTime;
+    }
+
+    /**
+     * Returns the requested item
+     *
+     * @param string $name
+     *
+     * @return mixed
+     */
+    public function get($name)
+    {
+        return isset($this->items[$name]) ? $this->items[$name] : null;
+    }
+
+    /**
+     * Returns if the item is present
+     *
+     * @param string $name
+     *
+     * @return boolean
+     */
+    public function has($name)
+    {
+        return !empty($this->items[$name]);
+    }
+}

+ 320 - 0
vendor/lcobucci/jwt/test/functional/EcdsaTokenTest.php

@@ -0,0 +1,320 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\FunctionalTests;
+
+use Lcobucci\JWT\Builder;
+use Lcobucci\JWT\Parser;
+use Lcobucci\JWT\Signer\Key;
+use Lcobucci\JWT\Token;
+use Lcobucci\JWT\Signature;
+use Lcobucci\JWT\Signer\Ecdsa\Sha256;
+use Lcobucci\JWT\Signer\Ecdsa\Sha512;
+use Lcobucci\JWT\Signer\Keychain;
+use Lcobucci\JWT\Keys;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class EcdsaTokenTest extends \PHPUnit_Framework_TestCase
+{
+    use Keys;
+
+    /**
+     * @var Sha256
+     */
+    private $signer;
+
+    /**
+     * @before
+     */
+    public function createSigner()
+    {
+        $this->signer = new Sha256();
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256
+     */
+    public function builderShouldRaiseExceptionWhenKeyIsInvalid()
+    {
+        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
+
+        (new Builder())->setId(1)
+                       ->setAudience('http://client.abc.com')
+                       ->setIssuer('http://api.abc.com')
+                       ->set('user', $user)
+                       ->sign($this->signer, new Key('testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256
+     */
+    public function builderShouldRaiseExceptionWhenKeyIsNotEcdsaCompatible()
+    {
+        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
+
+        (new Builder())->setId(1)
+                       ->setAudience('http://client.abc.com')
+                       ->setIssuer('http://api.abc.com')
+                       ->set('user', $user)
+                       ->sign($this->signer, static::$rsaKeys['private']);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256
+     */
+    public function builderCanGenerateAToken()
+    {
+        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
+
+        $token = (new Builder())->setId(1)
+                              ->setAudience('http://client.abc.com')
+                              ->setIssuer('http://api.abc.com')
+                              ->set('user', $user)
+                              ->setHeader('jki', '1234')
+                              ->sign($this->signer, static::$ecdsaKeys['private'])
+                              ->getToken();
+
+        $this->assertAttributeInstanceOf(Signature::class, 'signature', $token);
+        $this->assertEquals('1234', $token->getHeader('jki'));
+        $this->assertEquals('http://client.abc.com', $token->getClaim('aud'));
+        $this->assertEquals('http://api.abc.com', $token->getClaim('iss'));
+        $this->assertEquals($user, $token->getClaim('user'));
+
+        return $token;
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Parsing\Decoder
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     */
+    public function parserCanReadAToken(Token $generated)
+    {
+        $read = (new Parser())->parse((string) $generated);
+
+        $this->assertEquals($generated, $read);
+        $this->assertEquals('testing', $read->getClaim('user')->name);
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256
+     */
+    public function verifyShouldReturnFalseWhenKeyIsNotRight(Token $token)
+    {
+        $this->assertFalse($token->verify($this->signer, static::$ecdsaKeys['public2']));
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512
+     */
+    public function verifyShouldReturnFalseWhenAlgorithmIsDifferent(Token $token)
+    {
+        $this->assertFalse($token->verify(new Sha512(), static::$ecdsaKeys['public1']));
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \RuntimeException
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256
+     */
+    public function verifyShouldRaiseExceptionWhenKeyIsNotEcdsaCompatible(Token $token)
+    {
+        $this->assertFalse($token->verify($this->signer, static::$rsaKeys['public']));
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256
+     */
+    public function verifyShouldReturnTrueWhenKeyIsRight(Token $token)
+    {
+        $this->assertTrue($token->verify($this->signer, static::$ecdsaKeys['public1']));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256
+     */
+    public function everythingShouldWorkWithAKeyWithParams()
+    {
+        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
+
+        $token = (new Builder())->setId(1)
+                                ->setAudience('http://client.abc.com')
+                                ->setIssuer('http://api.abc.com')
+                                ->set('user', $user)
+                                ->setHeader('jki', '1234')
+                                ->sign($this->signer, static::$ecdsaKeys['private-params'])
+                                ->getToken();
+
+        $this->assertTrue($token->verify($this->signer, static::$ecdsaKeys['public-params']));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Ecdsa
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512
+     * @covers Lcobucci\JWT\Signer\Keychain
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Parsing\Decoder
+     */
+    public function everythingShouldWorkWhenUsingATokenGeneratedByOtherLibs()
+    {
+        $data = 'eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJoZWxsbyI6IndvcmxkIn0.'
+                . 'AQx1MqdTni6KuzfOoedg2-7NUiwe-b88SWbdmviz40GTwrM0Mybp1i1tVtm'
+                . 'TSQ91oEXGXBdtwsN6yalzP9J-sp2YATX_Tv4h-BednbdSvYxZsYnUoZ--ZU'
+                . 'dL10t7g8Yt3y9hdY_diOjIptcha6ajX8yzkDGYG42iSe3f5LywSuD6FO5c';
+
+        $key = '-----BEGIN PUBLIC KEY-----' . PHP_EOL
+               . 'MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAcpkss6wI7PPlxj3t7A1RqMH3nvL4' . PHP_EOL
+               . 'L5Tzxze/XeeYZnHqxiX+gle70DlGRMqqOq+PJ6RYX7vK0PJFdiAIXlyPQq0B3KaU' . PHP_EOL
+               . 'e86IvFeQSFrJdCc0K8NfiH2G1loIk3fiR+YLqlXk6FAeKtpXJKxR1pCQCAM+vBCs' . PHP_EOL
+               . 'mZudf1zCUZ8/4eodlHU=' . PHP_EOL
+               . '-----END PUBLIC KEY-----';
+
+        $keychain = new Keychain();
+        $token = (new Parser())->parse((string) $data);
+
+        $this->assertEquals('world', $token->getClaim('hello'));
+        $this->assertTrue($token->verify(new Sha512(), $keychain->getPublicKey($key)));
+    }
+}

+ 186 - 0
vendor/lcobucci/jwt/test/functional/HmacTokenTest.php

@@ -0,0 +1,186 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\FunctionalTests;
+
+use Lcobucci\JWT\Builder;
+use Lcobucci\JWT\Parser;
+use Lcobucci\JWT\Token;
+use Lcobucci\JWT\Signature;
+use Lcobucci\JWT\Signer\Hmac\Sha256;
+use Lcobucci\JWT\Signer\Hmac\Sha512;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class HmacTokenTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Sha256
+     */
+    private $signer;
+
+    /**
+     * @before
+     */
+    public function createSigner()
+    {
+        $this->signer = new Sha256();
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Hmac
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
+     */
+    public function builderCanGenerateAToken()
+    {
+        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
+
+        $token = (new Builder())->setId(1)
+                              ->setAudience('http://client.abc.com')
+                              ->setIssuer('http://api.abc.com')
+                              ->set('user', $user)
+                              ->setHeader('jki', '1234')
+                              ->sign($this->signer, 'testing')
+                              ->getToken();
+
+        $this->assertAttributeInstanceOf(Signature::class, 'signature', $token);
+        $this->assertEquals('1234', $token->getHeader('jki'));
+        $this->assertEquals('http://client.abc.com', $token->getClaim('aud'));
+        $this->assertEquals('http://api.abc.com', $token->getClaim('iss'));
+        $this->assertEquals($user, $token->getClaim('user'));
+
+        return $token;
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Parsing\Decoder
+     */
+    public function parserCanReadAToken(Token $generated)
+    {
+        $read = (new Parser())->parse((string) $generated);
+
+        $this->assertEquals($generated, $read);
+        $this->assertEquals('testing', $read->getClaim('user')->name);
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Hmac
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
+     */
+    public function verifyShouldReturnFalseWhenKeyIsNotRight(Token $token)
+    {
+        $this->assertFalse($token->verify($this->signer, 'testing1'));
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Hmac
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha512
+     */
+    public function verifyShouldReturnFalseWhenAlgorithmIsDifferent(Token $token)
+    {
+        $this->assertFalse($token->verify(new Sha512(), 'testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Hmac
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
+     */
+    public function verifyShouldReturnTrueWhenKeyIsRight(Token $token)
+    {
+        $this->assertTrue($token->verify($this->signer, 'testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Hmac
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Parsing\Decoder
+     */
+    public function everythingShouldWorkWhenUsingATokenGeneratedByOtherLibs()
+    {
+        $data = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJoZWxsbyI6IndvcmxkIn0.Rh'
+                . '7AEgqCB7zae1PkgIlvOpeyw9Ab8NGTbeOH7heHO0o';
+
+        $token = (new Parser())->parse((string) $data);
+
+        $this->assertEquals('world', $token->getClaim('hello'));
+        $this->assertTrue($token->verify($this->signer, 'testing'));
+    }
+}

+ 53 - 0
vendor/lcobucci/jwt/test/functional/Keys.php

@@ -0,0 +1,53 @@
+<?php
+namespace Lcobucci\JWT;
+
+use Lcobucci\JWT\Signer\Keychain;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ */
+trait Keys
+{
+    /**
+     * @var array
+     */
+    protected static $rsaKeys;
+
+    /**
+     * @var array
+     */
+    protected static $ecdsaKeys;
+
+    /**
+     * @beforeClass
+     */
+    public static function createRsaKeys()
+    {
+        $keychain = new Keychain();
+        $dir = 'file://' . __DIR__;
+
+        static::$rsaKeys = [
+            'private' => $keychain->getPrivateKey($dir . '/rsa/private.key'),
+            'public' => $keychain->getPublicKey($dir . '/rsa/public.key'),
+            'encrypted-private' => $keychain->getPrivateKey($dir . '/rsa/encrypted-private.key', 'testing'),
+            'encrypted-public' => $keychain->getPublicKey($dir . '/rsa/encrypted-public.key')
+        ];
+    }
+
+    /**
+     * @beforeClass
+     */
+    public static function createEcdsaKeys()
+    {
+        $keychain = new Keychain();
+        $dir = 'file://' . __DIR__;
+
+        static::$ecdsaKeys = [
+            'private' => $keychain->getPrivateKey($dir . '/ecdsa/private.key'),
+            'private-params' => $keychain->getPrivateKey($dir . '/ecdsa/private2.key'),
+            'public1' => $keychain->getPublicKey($dir . '/ecdsa/public1.key'),
+            'public2' => $keychain->getPublicKey($dir . '/ecdsa/public2.key'),
+            'public-params' => $keychain->getPublicKey($dir . '/ecdsa/public3.key'),
+        ];
+    }
+}

+ 272 - 0
vendor/lcobucci/jwt/test/functional/RsaTokenTest.php

@@ -0,0 +1,272 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\FunctionalTests;
+
+use Lcobucci\JWT\Builder;
+use Lcobucci\JWT\Keys;
+use Lcobucci\JWT\Parser;
+use Lcobucci\JWT\Signer\Key;
+use Lcobucci\JWT\Token;
+use Lcobucci\JWT\Signature;
+use Lcobucci\JWT\Signer\Rsa\Sha256;
+use Lcobucci\JWT\Signer\Rsa\Sha512;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class RsaTokenTest extends \PHPUnit_Framework_TestCase
+{
+    use Keys;
+
+    /**
+     * @var Sha256
+     */
+    private $signer;
+
+    /**
+     * @before
+     */
+    public function createSigner()
+    {
+        $this->signer = new Sha256();
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Rsa
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256
+     */
+    public function builderShouldRaiseExceptionWhenKeyIsInvalid()
+    {
+        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
+
+        (new Builder())->setId(1)
+                       ->setAudience('http://client.abc.com')
+                       ->setIssuer('http://api.abc.com')
+                       ->set('user', $user)
+                       ->sign($this->signer, new Key('testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Rsa
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256
+     */
+    public function builderShouldRaiseExceptionWhenKeyIsNotRsaCompatible()
+    {
+        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
+
+        (new Builder())->setId(1)
+                       ->setAudience('http://client.abc.com')
+                       ->setIssuer('http://api.abc.com')
+                       ->set('user', $user)
+                       ->sign($this->signer, static::$ecdsaKeys['private']);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Rsa
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256
+     */
+    public function builderCanGenerateAToken()
+    {
+        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
+
+        $token = (new Builder())->setId(1)
+                              ->setAudience('http://client.abc.com')
+                              ->setIssuer('http://api.abc.com')
+                              ->set('user', $user)
+                              ->setHeader('jki', '1234')
+                              ->sign($this->signer, static::$rsaKeys['private'])
+                              ->getToken();
+
+        $this->assertAttributeInstanceOf(Signature::class, 'signature', $token);
+        $this->assertEquals('1234', $token->getHeader('jki'));
+        $this->assertEquals('http://client.abc.com', $token->getClaim('aud'));
+        $this->assertEquals('http://api.abc.com', $token->getClaim('iss'));
+        $this->assertEquals($user, $token->getClaim('user'));
+
+        return $token;
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Parsing\Decoder
+     */
+    public function parserCanReadAToken(Token $generated)
+    {
+        $read = (new Parser())->parse((string) $generated);
+
+        $this->assertEquals($generated, $read);
+        $this->assertEquals('testing', $read->getClaim('user')->name);
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Rsa
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256
+     */
+    public function verifyShouldReturnFalseWhenKeyIsNotRight(Token $token)
+    {
+        $this->assertFalse($token->verify($this->signer, self::$rsaKeys['encrypted-public']));
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Rsa
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha512
+     */
+    public function verifyShouldReturnFalseWhenAlgorithmIsDifferent(Token $token)
+    {
+        $this->assertFalse($token->verify(new Sha512(), self::$rsaKeys['public']));
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Rsa
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256
+     */
+    public function verifyShouldRaiseExceptionWhenKeyIsNotRsaCompatible(Token $token)
+    {
+        $this->assertFalse($token->verify($this->signer, self::$ecdsaKeys['public1']));
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Rsa
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256
+     */
+    public function verifyShouldReturnTrueWhenKeyIsRight(Token $token)
+    {
+        $this->assertTrue($token->verify($this->signer, self::$rsaKeys['public']));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Signature
+     * @covers Lcobucci\JWT\Signer\Key
+     * @covers Lcobucci\JWT\Signer\BaseSigner
+     * @covers Lcobucci\JWT\Signer\Rsa
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Parsing\Decoder
+     */
+    public function everythingShouldWorkWhenUsingATokenGeneratedByOtherLibs()
+    {
+        $data = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9.eyJoZWxsbyI6IndvcmxkIn0.s'
+                . 'GYbB1KrmnESNfJ4D9hOe1Zad_BMyxdb8G4p4LNP7StYlOyBWck6q7XPpPj_6gB'
+                . 'Bo1ohD3MA2o0HY42lNIrAStaVhfsFKGdIou8TarwMGZBPcif_3ThUV1pGS3fZc'
+                . 'lFwF2SP7rqCngQis_xcUVCyqa8E1Wa_v28grnl1QZrnmQFO8B5JGGLqcrfUHJO'
+                . 'nJCupP-Lqh4TmIhftIimSCgLNmJg80wyrpUEfZYReE7hPuEmY0ClTqAGIMQoNS'
+                . '98ljwDxwhfbSuL2tAdbV4DekbTpWzspe3dOJ7RSzmPKVZ6NoezaIazKqyqkmHZfcMaHI1lQeGia6LTbHU1bp0gINi74Vw';
+
+        $token = (new Parser())->parse((string) $data);
+
+        $this->assertEquals('world', $token->getClaim('hello'));
+        $this->assertTrue($token->verify($this->signer, self::$rsaKeys['public']));
+    }
+}

+ 137 - 0
vendor/lcobucci/jwt/test/functional/UnsignedTokenTest.php

@@ -0,0 +1,137 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\FunctionalTests;
+
+use Lcobucci\JWT\Builder;
+use Lcobucci\JWT\Parser;
+use Lcobucci\JWT\Token;
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class UnsignedTokenTest extends \PHPUnit_Framework_TestCase
+{
+    const CURRENT_TIME = 100000;
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     */
+    public function builderCanGenerateAToken()
+    {
+        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
+
+        $token = (new Builder())->setId(1)
+                              ->setAudience('http://client.abc.com')
+                              ->setIssuer('http://api.abc.com')
+                              ->setExpiration(self::CURRENT_TIME + 3000)
+                              ->set('user', $user)
+                              ->getToken();
+
+        $this->assertAttributeEquals(null, 'signature', $token);
+        $this->assertEquals('http://client.abc.com', $token->getClaim('aud'));
+        $this->assertEquals('http://api.abc.com', $token->getClaim('iss'));
+        $this->assertEquals(self::CURRENT_TIME + 3000, $token->getClaim('exp'));
+        $this->assertEquals($user, $token->getClaim('user'));
+
+        return $token;
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Parsing\Decoder
+     */
+    public function parserCanReadAToken(Token $generated)
+    {
+        $read = (new Parser())->parse((string) $generated);
+
+        $this->assertEquals($generated, $read);
+        $this->assertEquals('testing', $read->getClaim('user')->name);
+    }
+
+    /**
+     * @test
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\ValidationData
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Claim\EqualsTo
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Parsing\Decoder
+     */
+    public function tokenValidationShouldReturnWhenEverythingIsFine(Token $generated)
+    {
+        $data = new ValidationData(self::CURRENT_TIME - 10);
+        $data->setAudience('http://client.abc.com');
+        $data->setIssuer('http://api.abc.com');
+
+        $this->assertTrue($generated->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @dataProvider invalidValidationData
+     *
+     * @depends builderCanGenerateAToken
+     *
+     * @covers Lcobucci\JWT\Builder
+     * @covers Lcobucci\JWT\Parser
+     * @covers Lcobucci\JWT\Token
+     * @covers Lcobucci\JWT\ValidationData
+     * @covers Lcobucci\JWT\Claim\Factory
+     * @covers Lcobucci\JWT\Claim\Basic
+     * @covers Lcobucci\JWT\Claim\EqualsTo
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     * @covers Lcobucci\JWT\Parsing\Encoder
+     * @covers Lcobucci\JWT\Parsing\Decoder
+     */
+    public function tokenValidationShouldReturnFalseWhenExpectedDataDontMatch(ValidationData $data, Token $generated)
+    {
+        $this->assertFalse($generated->validate($data));
+    }
+
+    public function invalidValidationData()
+    {
+        $expired = new ValidationData(self::CURRENT_TIME + 3020);
+        $expired->setAudience('http://client.abc.com');
+        $expired->setIssuer('http://api.abc.com');
+
+        $invalidAudience = new ValidationData(self::CURRENT_TIME - 10);
+        $invalidAudience->setAudience('http://cclient.abc.com');
+        $invalidAudience->setIssuer('http://api.abc.com');
+
+        $invalidIssuer = new ValidationData(self::CURRENT_TIME - 10);
+        $invalidIssuer->setAudience('http://client.abc.com');
+        $invalidIssuer->setIssuer('http://aapi.abc.com');
+
+        return [[$expired], [$invalidAudience], [$invalidIssuer]];
+    }
+}

+ 5 - 0
vendor/lcobucci/jwt/test/functional/ecdsa/private.key

@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIBGpMoZJ64MMSzuo5JbmXpf9V4qSWdLIl/8RmJLcfn/qoAoGCCqGSM49
+AwEHoUQDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpnd0wxa2iFruiI2tsEdGFTLTsy
+U+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==
+-----END EC PRIVATE KEY-----

+ 8 - 0
vendor/lcobucci/jwt/test/functional/ecdsa/private2.key

@@ -0,0 +1,8 @@
+-----BEGIN EC PARAMETERS-----
+BggqhkjOPQMBBw==
+-----END EC PARAMETERS-----
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIM6G7WZ6SqoPwrHwGXhOJkYD+ErT8dfRvrNifgBQvSb7oAoGCCqGSM49
+AwEHoUQDQgAE09Hkp/u0tIGdzlQ99R/sXCOr9DTZAfLex4D4Po0C1L3qUqHrzZ0m
+B3bAhe+pwEDQ/jqVqdzxhA9i4PqT7F4Aew==
+-----END EC PRIVATE KEY-----

+ 4 - 0
vendor/lcobucci/jwt/test/functional/ecdsa/public1.key

@@ -0,0 +1,4 @@
+-----BEGIN PUBLIC KEY-----
+MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpn
+d0wxa2iFruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==
+-----END PUBLIC KEY-----

+ 4 - 0
vendor/lcobucci/jwt/test/functional/ecdsa/public2.key

@@ -0,0 +1,4 @@
+-----BEGIN PUBLIC KEY-----
+MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdgxRxlhzhHGj+v6S2ikp+33LoGp5
+QWbEWv8BORsr2Ayg6C7deDDRM/s/f0R++4zZqXro1gDTVF5VDv7nE+EfEw==
+-----END PUBLIC KEY-----

+ 4 - 0
vendor/lcobucci/jwt/test/functional/ecdsa/public3.key

@@ -0,0 +1,4 @@
+-----BEGIN PUBLIC KEY-----
+MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE09Hkp/u0tIGdzlQ99R/sXCOr9DTZ
+AfLex4D4Po0C1L3qUqHrzZ0mB3bAhe+pwEDQ/jqVqdzxhA9i4PqT7F4Aew==
+-----END PUBLIC KEY-----

+ 30 - 0
vendor/lcobucci/jwt/test/functional/rsa/encrypted-private.key

@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: AES-128-CBC,0D71668CE71033CB9150ED82FC87F4A1
+
+uLzPNDdlHnZ77tAGMHyPYERDMBcdV4SsQJYcSjiHhR2o0dLGTdgOpQrXTHPX4GJF
+LlEWLhAAV9wx2mM/2kHDWB4uZwThtT9/v+RFoW1WbVO/d3lhI9fg4/73/DWAH/7/
+afMRc7ZOVoAmVCESotPx4khCHoE97RdY/JtkLTzc3+peqmL53AbYXrg9rTN1B+ZV
+U3w4ciQS8Uki87zDYIBjYtaOCyMUTvug25CvdssvUMBoc/Jc0xps6/vAyXrnzlGT
+pZD0Tst8idswfDi613BhAaxJspeY0AErWA59qJ3eGzbiQq5RDWcbJe/Tz5r/6+NN
+DkvNQ7DaEZ6LpeWX0MUq6/QWfrM8yE95XhjyC1d3LYn32lXHUygbgTFWIgLDoOE6
+nBhu34SWtbLAnqYGewaJFxhlYVS9rb/uvYQg70r5X9Sx6alCQPiPyIv39IItezn2
+HF2GRfE91MPZUeDhdqdvvOlSZVM5KnYc1fhamGAwM48gdDDXe8Czu/JEGoANNvC3
+l/Z1p5RtGF4hrel9WpeX9zQq3pvtfVcVIiWuRUwCOSQytXlieRK37sMuYeggvmjV
+VvaCods3mS/panWg9T/D/deIXjhzNJLvyiJg8+3sY5H4yNe0XpbaAc/ySwt9Rcxy
+FzFQ+5pghLSZgR1uV3AhdcnzXBU2GkYhdGKt2tUsH0UeVQ2BXxTlBFsCOh2dWqcj
+y3suIG65bukDAAWidQ4q3S6ZIMpXBhhCj7nwB5jQ7wSlU3U9So0ndr7zxdUILiMm
+chHi3q5apVZnMGcwv2B33rt4nD7HgGEmRKkCelrSrBATY1ut+T4rCDzKDqDs3jpv
+hYIWrlNPTkJyQz3eWly6Db+FJEfdYGadYJusc7/nOxCh/QmUu8Sh3NhKT6TH0bS7
+1AAqd8H+2hJ9I32Dhd2qwAF7PkNe2LGi+P8tbAtepKGim5w65wnsPePMnrfxumsG
+PeDnMrqeCKy+fME7a/MS5kmEBpmD4BMhVC6/OhFVz8gBty1f8yIEZggHNQN2QK7m
+NIrG+PwqW2w8HoxOlAi2Ix4LTPifrdfsH02U7aM1pgo1rZzD4AOzqvzCaK43H2VB
+BHLeTBGoLEUxXA9C+iGbeQlKXkMC00QKkjK5+nvkvnvePFfsrTQIpuyGufD/MoPb
+6fpwsyHZDxhxMN1PJk1b1lPq2Ui4hXpVNOYd4Q6OQz7bwxTMRX9XQromUlKMMgAT
+edX8v2NdM7Ssy1IwHuGVbDEpZdjoeaWZ1iNRV17i/EaJAqwYDQLfsuHBlzZL1ov1
+xkKVJdL8Y3q80oRAzTQDVdzL/rI44LLAfv609YByCnw29feYJY2W6gV0O7ZSw413
+XUkc5CaEbR1LuG8NtnOOPJV4Tb/hNsIDtvVm7Hl5npBKBe4iVgQ2LNuC2eT69d/z
+uvzgjISlumPiO5ivuYe0QtLPuJSc+/Bl8bPL8gcNQEtqkzj7IftHPPZNs+bJC2uY
+bPjq5KoDNAMF6VHuKHwu48MBYpnXDIg3ZenmJwGRULRBhK6324hDS6NJ7ULTBU2M
+TZCHmg89ySLBfCAspVeo63o/R7bs9a7BP9x2h5uwCBogSvkEwhhPKnboVN45bp9c
+-----END RSA PRIVATE KEY-----

+ 9 - 0
vendor/lcobucci/jwt/test/functional/rsa/encrypted-public.key

@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwLpbUP8a9yflt5LKUUS3
+NPuRM7yEouPWg0VKeY5AURu4i8bqQ20K5jwfRJ+w05FvlywG4EuxpnpTFTVS2/do
+q3xufzTf/C3KIDOAHEifkdx4140btKxxm4mD9Eu2CQ32adZyScha50KUFlfnAAic
+Hb8wYxjFyWo3PAbGYmCQCn2z97Ab0Ar6NR1e+V9f8EL9Orr2f04puKJfQTZdWVDF
+UJR4w7QZ/CPY0LEsiFLW3QQCNraka1mtrLJwPqreBtDEkj8IoISNkrguu/97RQZz
+miJgBQkVjr6OfqG5WIFr0MzbRZc1/aK9g8ft88nhhQm0E3GqkCxBKTwgA03HtK07
+qQIDAQAB
+-----END PUBLIC KEY-----

+ 28 - 0
vendor/lcobucci/jwt/test/functional/rsa/private.key

@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDTvwE87MtgREYL
+TL4aHhQo3ZzogmxxvMUsKnPzyxRs1YrXOSOpwN0npsXarBKKVIUMNLfFODp/vnQn
+2Zp06N8XG59WAOKwvC4MfxLDQkA+JXggzHlkbVoTN+dUkdYIFqSKuAPGwiWToRK2
+SxEhij3rE2FON8jQZvDxZkiP9a4vxJO3OTPQwKredXFiObsXD/c3RtLFhKctjCyH
+OIrP0bQEsee/m7JNtG4ry6BPusN6wb+vJo5ieBYPa3c19akNq6q/nYWhplhkkJSu
+aOrL5xXEFzI5TvcvnXR568GVcxK8YLfFkdxpsXGt5rAbeh0h/U5kILEAqv8P9PGT
+ZpicKbrnAgMBAAECggEAd3yTQEQHR91/ASVfKPHMQns77eCbPVtekFusbugsMHYY
+EPdHbqVMpvFvOMRc+f5Tzd15ziq6qBdbCJm8lThLm4iU0z1QrpaiDZ8vgUvDYM5Y
+CXoZDli+uZWUTp60/n94fmb0ipZIChScsI2PrzOJWTvobvD/uso8MJydWc8zafQm
+uqYzygOfjFZvU4lSfgzpefhpquy0JUy5TiKRmGUnwLb3TtcsVavjsn4QmNwLYgOF
+2OE+R12ex3pAKTiRE6FcnE1xFIo1GKhBa2Otgw3MDO6Gg+kn8Q4alKz6C6RRlgaH
+R7sYzEfJhsk/GGFTYOzXKQz2lSaStKt9wKCor04RcQKBgQDzPOu5jCTfayUo7xY2
+jHtiogHyKLLObt9l3qbwgXnaD6rnxYNvCrA0OMvT+iZXsFZKJkYzJr8ZOxOpPROk
+10WdOaefiwUyL5dypueSwlIDwVm+hI4Bs82MajHtzOozh+73wA+aw5rPs84Uix9w
+VbbwaVR6qP/BV09yJYS5kQ7fmwKBgQDe2xjywX2d2MC+qzRr+LfU+1+gq0jjhBCX
+WHqRN6IECB0xTnXUf9WL/VCoI1/55BhdbbEja+4btYgcXSPmlXBIRKQ4VtFfVmYB
+kPXeD8oZ7LyuNdCsbKNe+x1IHXDe6Wfs3L9ulCfXxeIE84wy3fd66mQahyXV9iD9
+CkuifMqUpQKBgQCiydHlY1LGJ/o9tA2Ewm5Na6mrvOs2V2Ox1NqbObwoYbX62eiF
+53xX5u8bVl5U75JAm+79it/4bd5RtKux9dUETbLOhwcaOFm+hM+VG/IxyzRZ2nMD
+1qcpY2U5BpxzknUvYF3RMTop6edxPk7zKpp9ubCtSu+oINvtxAhY/SkcIwKBgGP1
+upcImyO2GZ5shLL5eNubdSVILwV+M0LveOqyHYXZbd6z5r5OKKcGFKuWUnJwEU22
+6gGNY9wh7M9sJ7JBzX9c6pwqtPcidda2AtJ8GpbOTUOG9/afNBhiYpv6OKqD3w2r
+ZmJfKg/qvpqh83zNezgy8nvDqwDxyZI2j/5uIx/RAoGBAMWRmxtv6H2cKhibI/aI
+MTJM4QRjyPNxQqvAQsv+oHUbid06VK3JE+9iQyithjcfNOwnCaoO7I7qAj9QEfJS
+MZQc/W/4DHJebo2kd11yoXPVTXXOuEwLSKCejBXABBY0MPNuPUmiXeU0O3Tyi37J
+TUKzrgcd7NvlA41Y4xKcOqEA
+-----END PRIVATE KEY-----

+ 9 - 0
vendor/lcobucci/jwt/test/functional/rsa/public.key

@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA078BPOzLYERGC0y+Gh4U
+KN2c6IJscbzFLCpz88sUbNWK1zkjqcDdJ6bF2qwSilSFDDS3xTg6f750J9madOjf
+FxufVgDisLwuDH8Sw0JAPiV4IMx5ZG1aEzfnVJHWCBakirgDxsIlk6EStksRIYo9
+6xNhTjfI0Gbw8WZIj/WuL8STtzkz0MCq3nVxYjm7Fw/3N0bSxYSnLYwshziKz9G0
+BLHnv5uyTbRuK8ugT7rDesG/ryaOYngWD2t3NfWpDauqv52FoaZYZJCUrmjqy+cV
+xBcyOU73L510eevBlXMSvGC3xZHcabFxreawG3odIf1OZCCxAKr/D/Txk2aYnCm6
+5wIDAQAB
+-----END PUBLIC KEY-----

+ 699 - 0
vendor/lcobucci/jwt/test/unit/BuilderTest.php

@@ -0,0 +1,699 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use Lcobucci\JWT\Claim\Factory as ClaimFactory;
+use Lcobucci\JWT\Parsing\Encoder;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class BuilderTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Encoder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $encoder;
+
+    /**
+     * @var ClaimFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $claimFactory;
+
+    /**
+     * @var Claim|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $defaultClaim;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->encoder = $this->getMock(Encoder::class);
+        $this->claimFactory = $this->getMock(ClaimFactory::class, [], [], '', false);
+        $this->defaultClaim = $this->getMock(Claim::class);
+
+        $this->claimFactory->expects($this->any())
+                           ->method('create')
+                           ->willReturn($this->defaultClaim);
+    }
+
+    /**
+     * @return Builder
+     */
+    private function createBuilder()
+    {
+        return new Builder($this->encoder, $this->claimFactory);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Builder::__construct
+     */
+    public function constructMustInitializeTheAttributes()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals([], 'claims', $builder);
+        $this->assertAttributeEquals(null, 'signature', $builder);
+        $this->assertAttributeSame($this->encoder, 'encoder', $builder);
+        $this->assertAttributeSame($this->claimFactory, 'claimFactory', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setAudience
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setAudienceMustChangeTheAudClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->setAudience('test');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setAudience
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setAudienceCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->setAudience('test', true);
+
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'aud' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setAudience
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setAudienceMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->setAudience('test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setExpiration
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setExpirationMustChangeTheExpClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->setExpiration('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['exp' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setExpiration
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setExpirationCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->setExpiration('2', true);
+
+        $this->assertAttributeEquals(['exp' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'exp' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setExpiration
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setExpirationMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->setExpiration('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setId
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setIdMustChangeTheJtiClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->setId('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['jti' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setId
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setIdCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->setId('2', true);
+
+        $this->assertAttributeEquals(['jti' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'jti' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setId
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setIdMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->setId('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setIssuedAt
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setIssuedAtMustChangeTheIatClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->setIssuedAt('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['iat' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setIssuedAt
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setIssuedAtCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->setIssuedAt('2', true);
+
+        $this->assertAttributeEquals(['iat' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'iat' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setIssuedAt
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setIssuedAtMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->setIssuedAt('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setIssuer
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setIssuerMustChangeTheIssClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->setIssuer('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['iss' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setIssuer
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setIssuerCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->setIssuer('2', true);
+
+        $this->assertAttributeEquals(['iss' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'iss' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setIssuer
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setIssuerMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->setIssuer('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setNotBefore
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setNotBeforeMustChangeTheNbfClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->setNotBefore('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['nbf' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setNotBefore
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setNotBeforeCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->setNotBefore('2', true);
+
+        $this->assertAttributeEquals(['nbf' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'nbf' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setNotBefore
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setNotBeforeMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->setNotBefore('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setSubject
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setSubjectMustChangeTheSubClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->setSubject('2');
+
+        $this->assertAttributeEquals(['alg' => 'none', 'typ' => 'JWT'], 'headers', $builder);
+        $this->assertAttributeEquals(['sub' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setSubject
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setSubjectCanReplicateItemOnHeader()
+    {
+        $builder = $this->createBuilder();
+        $builder->setSubject('2', true);
+
+        $this->assertAttributeEquals(['sub' => $this->defaultClaim], 'claims', $builder);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'sub' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     *
+     * @covers Lcobucci\JWT\Builder::setSubject
+     * @covers Lcobucci\JWT\Builder::setRegisteredClaim
+     */
+    public function setSubjectMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->setSubject('2'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     *
+     * @covers Lcobucci\JWT\Builder::set
+     */
+    public function setMustConfigureTheGivenClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->set('userId', 2);
+
+        $this->assertAttributeEquals(['userId' => $this->defaultClaim], 'claims', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     *
+     * @covers Lcobucci\JWT\Builder::set
+     */
+    public function setMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->set('userId', 2));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     *
+     * @covers Lcobucci\JWT\Builder::setHeader
+     */
+    public function setHeaderMustConfigureTheGivenClaim()
+    {
+        $builder = $this->createBuilder();
+        $builder->setHeader('userId', 2);
+
+        $this->assertAttributeEquals(
+            ['alg' => 'none', 'typ' => 'JWT', 'userId' => $this->defaultClaim],
+            'headers',
+            $builder
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     *
+     * @covers Lcobucci\JWT\Builder::setHeader
+     */
+    public function setHeaderMustKeepAFluentInterface()
+    {
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->setHeader('userId', 2));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::getToken
+     * @uses Lcobucci\JWT\Token
+     *
+     * @covers Lcobucci\JWT\Builder::sign
+     */
+    public function signMustChangeTheSignature()
+    {
+        $signer = $this->getMock(Signer::class);
+        $signature = $this->getMock(Signature::class, [], [], '', false);
+
+        $signer->expects($this->any())
+               ->method('sign')
+               ->willReturn($signature);
+
+        $builder = $this->createBuilder();
+        $builder->sign($signer, 'test');
+
+        $this->assertAttributeSame($signature, 'signature', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::getToken
+     * @uses Lcobucci\JWT\Token
+     *
+     * @covers Lcobucci\JWT\Builder::sign
+     */
+    public function signMustKeepAFluentInterface()
+    {
+        $signer = $this->getMock(Signer::class);
+        $signature = $this->getMock(Signature::class, [], [], '', false);
+
+        $signer->expects($this->any())
+               ->method('sign')
+               ->willReturn($signature);
+
+        $builder = $this->createBuilder();
+
+        $this->assertSame($builder, $builder->sign($signer, 'test'));
+
+        return $builder;
+    }
+
+    /**
+     * @test
+     *
+     * @depends signMustKeepAFluentInterface
+     *
+     * @covers Lcobucci\JWT\Builder::unsign
+     */
+    public function unsignMustRemoveTheSignature(Builder $builder)
+    {
+        $builder->unsign();
+
+        $this->assertAttributeSame(null, 'signature', $builder);
+    }
+
+    /**
+     * @test
+     *
+     * @depends signMustKeepAFluentInterface
+     *
+     * @covers Lcobucci\JWT\Builder::unsign
+     */
+    public function unsignMustKeepAFluentInterface(Builder $builder)
+    {
+        $this->assertSame($builder, $builder->unsign());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::sign
+     * @uses Lcobucci\JWT\Builder::getToken
+     * @uses Lcobucci\JWT\Token
+     *
+     * @covers Lcobucci\JWT\Builder::set
+     *
+     * @expectedException BadMethodCallException
+     */
+    public function setMustRaiseExceptionWhenTokenHasBeenSigned()
+    {
+        $signer = $this->getMock(Signer::class);
+        $signature = $this->getMock(Signature::class, [], [], '', false);
+
+        $signer->expects($this->any())
+               ->method('sign')
+               ->willReturn($signature);
+
+        $builder = $this->createBuilder();
+        $builder->sign($signer, 'test');
+        $builder->set('test', 123);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::sign
+     * @uses Lcobucci\JWT\Builder::getToken
+     * @uses Lcobucci\JWT\Token
+     *
+     * @covers Lcobucci\JWT\Builder::setHeader
+     *
+     * @expectedException BadMethodCallException
+     */
+    public function setHeaderMustRaiseExceptionWhenTokenHasBeenSigned()
+    {
+        $signer = $this->getMock(Signer::class);
+        $signature = $this->getMock(Signature::class, [], [], '', false);
+
+        $signer->expects($this->any())
+               ->method('sign')
+               ->willReturn($signature);
+
+        $builder = $this->createBuilder();
+        $builder->sign($signer, 'test');
+        $builder->setHeader('test', 123);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Builder::__construct
+     * @uses Lcobucci\JWT\Builder::set
+     * @uses Lcobucci\JWT\Token
+     *
+     * @covers Lcobucci\JWT\Builder::getToken
+     */
+    public function getTokenMustReturnANewTokenWithCurrentConfiguration()
+    {
+        $signature = $this->getMock(Signature::class, [], [], '', false);
+
+        $this->encoder->expects($this->exactly(2))
+                      ->method('jsonEncode')
+                      ->withConsecutive([['typ'=> 'JWT', 'alg' => 'none']], [['test' => $this->defaultClaim]])
+                      ->willReturnOnConsecutiveCalls('1', '2');
+
+        $this->encoder->expects($this->exactly(3))
+                      ->method('base64UrlEncode')
+                      ->withConsecutive(['1'], ['2'], [$signature])
+                      ->willReturnOnConsecutiveCalls('1', '2', '3');
+
+        $builder = $this->createBuilder()->set('test', 123);
+
+        $builderSign = new \ReflectionProperty($builder, 'signature');
+        $builderSign->setAccessible(true);
+        $builderSign->setValue($builder, $signature);
+
+        $token = $builder->getToken();
+
+        $tokenSign = new \ReflectionProperty($token, 'signature');
+        $tokenSign->setAccessible(true);
+
+        $this->assertAttributeEquals(['1', '2', '3'], 'payload', $token);
+        $this->assertAttributeEquals($token->getHeaders(), 'headers', $builder);
+        $this->assertAttributeEquals($token->getClaims(), 'claims', $builder);
+        $this->assertAttributeSame($tokenSign->getValue($token), 'signature', $builder);
+    }
+}

+ 84 - 0
vendor/lcobucci/jwt/test/unit/Claim/BasicTest.php

@@ -0,0 +1,84 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class BasicTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::__construct
+     */
+    public function constructorShouldConfigureTheAttributes()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertAttributeEquals('test', 'name', $claim);
+        $this->assertAttributeEquals(1, 'value', $claim);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::getName
+     */
+    public function getNameShouldReturnTheClaimName()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertEquals('test', $claim->getName());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::getValue
+     */
+    public function getValueShouldReturnTheClaimValue()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertEquals(1, $claim->getValue());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::jsonSerialize
+     */
+    public function jsonSerializeShouldReturnTheClaimValue()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertEquals(1, $claim->jsonSerialize());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Basic::__toString
+     */
+    public function toStringShouldReturnTheClaimValue()
+    {
+        $claim = new Basic('test', 1);
+
+        $this->assertEquals('1', (string) $claim);
+    }
+}

+ 80 - 0
vendor/lcobucci/jwt/test/unit/Claim/EqualsToTest.php

@@ -0,0 +1,80 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class EqualsToTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::has
+     *
+     * @covers Lcobucci\JWT\Claim\EqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValidationDontHaveTheClaim()
+    {
+        $claim = new EqualsTo('iss', 'test');
+
+        $this->assertTrue($claim->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     *
+     * @covers Lcobucci\JWT\Claim\EqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsEqualsToValidationData()
+    {
+        $claim = new EqualsTo('iss', 'test');
+
+        $data = new ValidationData();
+        $data->setIssuer('test');
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     *
+     * @covers Lcobucci\JWT\Claim\EqualsTo::validate
+     */
+    public function validateShouldReturnFalseWhenValueIsNotEqualsToValidationData()
+    {
+        $claim = new EqualsTo('iss', 'test');
+
+        $data = new ValidationData();
+        $data->setIssuer('test1');
+
+        $this->assertFalse($claim->validate($data));
+    }
+}

+ 168 - 0
vendor/lcobucci/jwt/test/unit/Claim/FactoryTest.php

@@ -0,0 +1,168 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class FactoryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::__construct
+     */
+    public function constructMustConfigureTheCallbacks()
+    {
+        $callback = function () {
+        };
+        $factory = new Factory(['test' => $callback]);
+
+        $expected = [
+            'iat' => [$factory, 'createLesserOrEqualsTo'],
+            'nbf' => [$factory, 'createLesserOrEqualsTo'],
+            'exp' => [$factory, 'createGreaterOrEqualsTo'],
+            'iss' => [$factory, 'createEqualsTo'],
+            'aud' => [$factory, 'createEqualsTo'],
+            'sub' => [$factory, 'createEqualsTo'],
+            'jti' => [$factory, 'createEqualsTo'],
+            'test' => $callback
+        ];
+
+        $this->assertAttributeEquals($expected, 'callbacks', $factory);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createLesserOrEqualsTo
+     */
+    public function createShouldReturnALesserOrEqualsToClaimForIssuedAt()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(LesserOrEqualsTo::class, $claim->create('iat', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createLesserOrEqualsTo
+     */
+    public function createShouldReturnALesserOrEqualsToClaimForNotBefore()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(LesserOrEqualsTo::class, $claim->create('nbf', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createGreaterOrEqualsTo
+     */
+    public function createShouldReturnAGreaterOrEqualsToClaimForExpiration()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(GreaterOrEqualsTo::class, $claim->create('exp', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo
+     */
+    public function createShouldReturnAnEqualsToClaimForId()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(EqualsTo::class, $claim->create('jti', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo
+     */
+    public function createShouldReturnAnEqualsToClaimForIssuer()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(EqualsTo::class, $claim->create('iss', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo
+     */
+    public function createShouldReturnAnEqualsToClaimForAudience()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(EqualsTo::class, $claim->create('aud', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createEqualsTo
+     */
+    public function createShouldReturnAnEqualsToClaimForSubject()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(EqualsTo::class, $claim->create('sub', 1));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Factory::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Claim\Factory::create
+     * @covers Lcobucci\JWT\Claim\Factory::createBasic
+     */
+    public function createShouldReturnABasiclaimForOtherClaims()
+    {
+        $claim = new Factory();
+
+        $this->assertInstanceOf(Basic::class, $claim->create('test', 1));
+    }
+}

+ 103 - 0
vendor/lcobucci/jwt/test/unit/Claim/GreaterOrEqualsToTest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class GreaterOrEqualsToTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::has
+     *
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValidationDontHaveTheClaim()
+    {
+        $claim = new GreaterOrEqualsTo('iss', 10);
+
+        $this->assertTrue($claim->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     *
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsGreaterThanValidationData()
+    {
+        $claim = new GreaterOrEqualsTo('iss', 11);
+
+        $data = new ValidationData();
+        $data->setIssuer(10);
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     *
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsEqualsToValidationData()
+    {
+        $claim = new GreaterOrEqualsTo('iss', 10);
+
+        $data = new ValidationData();
+        $data->setIssuer(10);
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     *
+     * @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo::validate
+     */
+    public function validateShouldReturnFalseWhenValueIsLesserThanValidationData()
+    {
+        $claim = new GreaterOrEqualsTo('iss', 10);
+
+        $data = new ValidationData();
+        $data->setIssuer(11);
+
+        $this->assertFalse($claim->validate($data));
+    }
+}

+ 103 - 0
vendor/lcobucci/jwt/test/unit/Claim/LesserOrEqualsToTest.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Claim;
+
+use Lcobucci\JWT\ValidationData;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.0.0
+ */
+class LesserOrEqualsToTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::has
+     *
+     * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValidationDontHaveTheClaim()
+    {
+        $claim = new LesserOrEqualsTo('iss', 10);
+
+        $this->assertTrue($claim->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     *
+     * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsLesserThanValidationData()
+    {
+        $claim = new LesserOrEqualsTo('iss', 10);
+
+        $data = new ValidationData();
+        $data->setIssuer(11);
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     *
+     * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate
+     */
+    public function validateShouldReturnTrueWhenValueIsEqualsToValidationData()
+    {
+        $claim = new LesserOrEqualsTo('iss', 10);
+
+        $data = new ValidationData();
+        $data->setIssuer(10);
+
+        $this->assertTrue($claim->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::getName
+     * @uses Lcobucci\JWT\Claim\Basic::getValue
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\ValidationData::setIssuer
+     * @uses Lcobucci\JWT\ValidationData::has
+     * @uses Lcobucci\JWT\ValidationData::get
+     *
+     * @covers Lcobucci\JWT\Claim\LesserOrEqualsTo::validate
+     */
+    public function validateShouldReturnFalseWhenValueIsGreaterThanValidationData()
+    {
+        $claim = new LesserOrEqualsTo('iss', 11);
+
+        $data = new ValidationData();
+        $data->setIssuer(10);
+
+        $this->assertFalse($claim->validate($data));
+    }
+}

+ 244 - 0
vendor/lcobucci/jwt/test/unit/ParserTest.php

@@ -0,0 +1,244 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use Lcobucci\JWT\Claim\Factory as ClaimFactory;
+use Lcobucci\JWT\Parsing\Decoder;
+use RuntimeException;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class ParserTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Decoder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $decoder;
+
+    /**
+     * @var ClaimFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $claimFactory;
+
+    /**
+     * @var Claim|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $defaultClaim;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->decoder = $this->getMock(Decoder::class);
+        $this->claimFactory = $this->getMock(ClaimFactory::class, [], [], '', false);
+        $this->defaultClaim = $this->getMock(Claim::class);
+
+        $this->claimFactory->expects($this->any())
+                           ->method('create')
+                           ->willReturn($this->defaultClaim);
+    }
+
+    /**
+     * @return Parser
+     */
+    private function createParser()
+    {
+        return new Parser($this->decoder, $this->claimFactory);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parser::__construct
+     */
+    public function constructMustConfigureTheAttributes()
+    {
+        $parser = $this->createParser();
+
+        $this->assertAttributeSame($this->decoder, 'decoder', $parser);
+        $this->assertAttributeSame($this->claimFactory, 'claimFactory', $parser);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     *
+     * @expectedException InvalidArgumentException
+     */
+    public function parseMustRaiseExceptionWhenJWSIsNotAString()
+    {
+        $parser = $this->createParser();
+        $parser->parse(['asdasd']);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     *
+     * @expectedException InvalidArgumentException
+     */
+    public function parseMustRaiseExceptionWhenJWSDontHaveThreeParts()
+    {
+        $parser = $this->createParser();
+        $parser->parse('');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     *
+     * @expectedException RuntimeException
+     */
+    public function parseMustRaiseExceptionWhenHeaderCannotBeDecoded()
+    {
+        $this->decoder->expects($this->any())
+                      ->method('jsonDecode')
+                      ->willThrowException(new RuntimeException());
+
+        $parser = $this->createParser();
+        $parser->parse('asdfad.asdfasdf.');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     *
+     * @expectedException InvalidArgumentException
+     */
+    public function parseMustRaiseExceptionWhenHeaderIsFromAnEncryptedToken()
+    {
+        $this->decoder->expects($this->any())
+                      ->method('jsonDecode')
+                      ->willReturn(['enc' => 'AAA']);
+
+        $parser = $this->createParser();
+        $parser->parse('a.a.');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     * @covers Lcobucci\JWT\Parser::parseClaims
+     * @covers Lcobucci\JWT\Parser::parseSignature
+     *
+     */
+    public function parseMustReturnANonSignedTokenWhenSignatureIsNotInformed()
+    {
+        $this->decoder->expects($this->at(1))
+                      ->method('jsonDecode')
+                      ->willReturn(['typ' => 'JWT', 'alg' => 'none']);
+
+        $this->decoder->expects($this->at(3))
+                      ->method('jsonDecode')
+                      ->willReturn(['aud' => 'test']);
+
+        $parser = $this->createParser();
+        $token = $parser->parse('a.a.');
+
+        $this->assertAttributeEquals(['typ' => 'JWT', 'alg' => 'none'], 'headers', $token);
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token);
+        $this->assertAttributeEquals(null, 'signature', $token);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     * @covers Lcobucci\JWT\Parser::parseClaims
+     * @covers Lcobucci\JWT\Parser::parseSignature
+     */
+    public function parseShouldReplicateClaimValueOnHeaderWhenNeeded()
+    {
+        $this->decoder->expects($this->at(1))
+                      ->method('jsonDecode')
+                      ->willReturn(['typ' => 'JWT', 'alg' => 'none', 'aud' => 'test']);
+
+        $this->decoder->expects($this->at(3))
+                      ->method('jsonDecode')
+                      ->willReturn(['aud' => 'test']);
+
+        $parser = $this->createParser();
+        $token = $parser->parse('a.a.');
+
+        $this->assertAttributeEquals(
+            ['typ' => 'JWT', 'alg' => 'none', 'aud' => $this->defaultClaim],
+            'headers',
+            $token
+        );
+
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token);
+        $this->assertAttributeEquals(null, 'signature', $token);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Parser::__construct
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Signature::__construct
+     *
+     * @covers Lcobucci\JWT\Parser::parse
+     * @covers Lcobucci\JWT\Parser::splitJwt
+     * @covers Lcobucci\JWT\Parser::parseHeader
+     * @covers Lcobucci\JWT\Parser::parseClaims
+     * @covers Lcobucci\JWT\Parser::parseSignature
+     */
+    public function parseMustReturnASignedTokenWhenSignatureIsInformed()
+    {
+        $this->decoder->expects($this->at(1))
+                      ->method('jsonDecode')
+                      ->willReturn(['typ' => 'JWT', 'alg' => 'HS256']);
+
+        $this->decoder->expects($this->at(3))
+                      ->method('jsonDecode')
+                      ->willReturn(['aud' => 'test']);
+
+        $this->decoder->expects($this->at(4))
+                      ->method('base64UrlDecode')
+                      ->willReturn('aaa');
+
+        $parser = $this->createParser();
+        $token = $parser->parse('a.a.a');
+
+        $this->assertAttributeEquals(['typ' => 'JWT', 'alg' => 'HS256'], 'headers', $token);
+        $this->assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token);
+        $this->assertAttributeEquals(new Signature('aaa'), 'signature', $token);
+    }
+}

+ 56 - 0
vendor/lcobucci/jwt/test/unit/Parsing/DecoderTest.php

@@ -0,0 +1,56 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Parsing;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class DecoderTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Decoder::jsonDecode
+     */
+    public function jsonDecodeMustReturnTheDecodedData()
+    {
+        $decoder = new Decoder();
+
+        $this->assertEquals(
+            (object) ['test' => 'test'],
+            $decoder->jsonDecode('{"test":"test"}')
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Decoder::jsonDecode
+     *
+     * @expectedException \RuntimeException
+     */
+    public function jsonDecodeMustRaiseExceptionWhenAnErrorHasOccured()
+    {
+        $decoder = new Decoder();
+        $decoder->jsonDecode('{"test":\'test\'}');
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Decoder::base64UrlDecode
+     */
+    public function base64UrlDecodeMustReturnTheRightData()
+    {
+        $data = base64_decode('0MB2wKB+L3yvIdzeggmJ+5WOSLaRLTUPXbpzqUe0yuo=');
+
+        $decoder = new Decoder();
+        $this->assertEquals($data, $decoder->base64UrlDecode('0MB2wKB-L3yvIdzeggmJ-5WOSLaRLTUPXbpzqUe0yuo'));
+    }
+}

+ 53 - 0
vendor/lcobucci/jwt/test/unit/Parsing/EncoderTest.php

@@ -0,0 +1,53 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Parsing;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class EncoderTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Encoder::jsonEncode
+     */
+    public function jsonEncodeMustReturnAJSONString()
+    {
+        $encoder = new Encoder();
+
+        $this->assertEquals('{"test":"test"}', $encoder->jsonEncode(['test' => 'test']));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Encoder::jsonEncode
+     *
+     * @expectedException \RuntimeException
+     */
+    public function jsonEncodeMustRaiseExceptionWhenAnErrorHasOccured()
+    {
+        $encoder = new Encoder();
+        $encoder->jsonEncode("\xB1\x31");
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Parsing\Encoder::base64UrlEncode
+     */
+    public function base64UrlEncodeMustReturnAnUrlSafeBase64()
+    {
+        $data = base64_decode('0MB2wKB+L3yvIdzeggmJ+5WOSLaRLTUPXbpzqUe0yuo=');
+
+        $encoder = new Encoder();
+        $this->assertEquals('0MB2wKB-L3yvIdzeggmJ-5WOSLaRLTUPXbpzqUe0yuo', $encoder->base64UrlEncode($data));
+    }
+}

+ 73 - 0
vendor/lcobucci/jwt/test/unit/SignatureTest.php

@@ -0,0 +1,73 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class SignatureTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Signer|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $signer;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->signer = $this->getMock(Signer::class);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signature::__construct
+     */
+    public function constructorMustConfigureAttributes()
+    {
+        $signature = new Signature('test');
+
+        $this->assertAttributeEquals('test', 'hash', $signature);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     *
+     * @covers Lcobucci\JWT\Signature::__toString
+     */
+    public function toStringMustReturnTheHash()
+    {
+        $signature = new Signature('test');
+
+        $this->assertEquals('test', (string) $signature);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signature::__toString
+     *
+     * @covers Lcobucci\JWT\Signature::verify
+     */
+    public function verifyMustReturnWhatSignerSays()
+    {
+        $this->signer->expects($this->any())
+                     ->method('verify')
+                     ->willReturn(true);
+
+        $signature = new Signature('test');
+
+        $this->assertTrue($signature->verify($this->signer, 'one', 'key'));
+    }
+}

+ 128 - 0
vendor/lcobucci/jwt/test/unit/Signer/BaseSignerTest.php

@@ -0,0 +1,128 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use Lcobucci\JWT\Signature;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class BaseSignerTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var BaseSigner|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $signer;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->signer = $this->getMockForAbstractClass(BaseSigner::class);
+
+        $this->signer->method('getAlgorithmId')
+                     ->willReturn('TEST123');
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::modifyHeader
+     */
+    public function modifyHeaderShouldChangeAlgorithm()
+    {
+        $headers = ['typ' => 'JWT'];
+
+        $this->signer->modifyHeader($headers);
+
+        $this->assertEquals($headers['typ'], 'JWT');
+        $this->assertEquals($headers['alg'], 'TEST123');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::sign
+     * @covers Lcobucci\JWT\Signer\BaseSigner::getKey
+     */
+    public function signMustReturnANewSignature()
+    {
+        $key = new Key('123');
+
+        $this->signer->expects($this->once())
+                     ->method('createHash')
+                     ->with('test', $key)
+                     ->willReturn('test');
+
+        $this->assertEquals(new Signature('test'), $this->signer->sign('test', $key));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::sign
+     * @covers Lcobucci\JWT\Signer\BaseSigner::getKey
+     */
+    public function signShouldConvertKeyWhenItsNotAnObject()
+    {
+        $this->signer->expects($this->once())
+                     ->method('createHash')
+                     ->with('test', new Key('123'))
+                     ->willReturn('test');
+
+        $this->assertEquals(new Signature('test'), $this->signer->sign('test', '123'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::verify
+     * @covers Lcobucci\JWT\Signer\BaseSigner::getKey
+     */
+    public function verifyShouldDelegateTheCallToAbstractMethod()
+    {
+        $key = new Key('123');
+
+        $this->signer->expects($this->once())
+                     ->method('doVerify')
+                     ->with('test', 'test', $key)
+                     ->willReturn(true);
+
+        $this->assertTrue($this->signer->verify('test', 'test', $key));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signature::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\BaseSigner::verify
+     * @covers Lcobucci\JWT\Signer\BaseSigner::getKey
+     */
+    public function verifyShouldConvertKeyWhenItsNotAnObject()
+    {
+        $this->signer->expects($this->once())
+                     ->method('doVerify')
+                     ->with('test', 'test', new Key('123'))
+                     ->willReturn(true);
+
+        $this->assertTrue($this->signer->verify('test', 'test', '123'));
+    }
+}

+ 178 - 0
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/KeyParserTest.php

@@ -0,0 +1,178 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+use Mdanter\Ecc\Crypto\Key\PrivateKeyInterface;
+use Mdanter\Ecc\Crypto\Key\PublicKeyInterface;
+use Mdanter\Ecc\Math\MathAdapterInterface;
+use Mdanter\Ecc\Serializer\PrivateKey\PrivateKeySerializerInterface;
+use Mdanter\Ecc\Serializer\PublicKey\PublicKeySerializerInterface;
+use Lcobucci\JWT\Signer\Key;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 3.0.4
+ */
+class KeyParserTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var MathAdapterInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $adapter;
+
+    /**
+     * @var PrivateKeySerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $privateKeySerializer;
+
+    /**
+     * @var PublicKeySerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $publicKeySerializer;
+
+    /**
+     * @before
+     */
+    public function createDependencies()
+    {
+        $this->adapter = $this->getMock(MathAdapterInterface::class);
+        $this->privateKeySerializer = $this->getMock(PrivateKeySerializerInterface::class);
+        $this->publicKeySerializer = $this->getMock(PublicKeySerializerInterface::class);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
+     */
+    public function constructShouldConfigureDependencies()
+    {
+        $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
+
+        $this->assertAttributeSame($this->privateKeySerializer, 'privateKeySerializer', $parser);
+        $this->assertAttributeSame($this->publicKeySerializer, 'publicKeySerializer', $parser);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPrivateKey
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent
+     */
+    public function getPrivateKeyShouldAskSerializerToParseTheKey()
+    {
+        $privateKey = $this->getMock(PrivateKeyInterface::class);
+
+        $keyContent = 'MHcCAQEEIBGpMoZJ64MMSzuo5JbmXpf9V4qSWdLIl/8RmJLcfn/qoAoGC'
+                      . 'CqGSM49AwEHoUQDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpnd0wxa2iF'
+                      . 'ruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==';
+
+        $this->privateKeySerializer->expects($this->once())
+                                   ->method('parse')
+                                   ->with($keyContent)
+                                   ->willReturn($privateKey);
+
+        $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
+        $this->assertSame($privateKey, $parser->getPrivateKey($this->getPrivateKey()));
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPrivateKey
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent
+     */
+    public function getPrivateKeyShouldRaiseExceptionWhenAWrongKeyWasGiven()
+    {
+        $this->privateKeySerializer->expects($this->never())
+                                   ->method('parse');
+
+        $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
+        $parser->getPrivateKey($this->getPublicKey());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPublicKey
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent
+     */
+    public function getPublicKeyShouldAskSerializerToParseTheKey()
+    {
+        $publicKey = $this->getMock(PublicKeyInterface::class);
+
+        $keyContent = 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpn'
+                      . 'd0wxa2iFruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==';
+
+        $this->publicKeySerializer->expects($this->once())
+                                  ->method('parse')
+                                  ->with($keyContent)
+                                  ->willReturn($publicKey);
+
+        $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
+        $this->assertSame($publicKey, $parser->getPublicKey($this->getPublicKey()));
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getPublicKey
+     * @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser::getKeyContent
+     */
+    public function getPublicKeyShouldRaiseExceptionWhenAWrongKeyWasGiven()
+    {
+        $this->publicKeySerializer->expects($this->never())
+                                  ->method('parse');
+
+        $parser = new KeyParser($this->adapter, $this->privateKeySerializer, $this->publicKeySerializer);
+        $parser->getPublicKey($this->getPrivateKey());
+    }
+
+    /**
+     * @return Key
+     */
+    private function getPrivateKey()
+    {
+        return new Key(
+            "-----BEGIN EC PRIVATE KEY-----\n"
+            . "MHcCAQEEIBGpMoZJ64MMSzuo5JbmXpf9V4qSWdLIl/8RmJLcfn/qoAoGCCqGSM49\n"
+            . "AwEHoUQDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpnd0wxa2iFruiI2tsEdGFTLTsy\n"
+            . "U+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==\n"
+            . "-----END EC PRIVATE KEY-----"
+        );
+    }
+
+    /**
+     * @return Key
+     */
+    private function getPublicKey()
+    {
+        return new Key(
+            "-----BEGIN PUBLIC KEY-----\n"
+            . "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7it/EKmcv9bfpcV1fBreLMRXxWpn\n"
+            . "d0wxa2iFruiI2tsEdGFTLTsyU+GeRqC7zN0aTnTQajarUylKJ3UWr/r1kg==\n"
+            . "-----END PUBLIC KEY-----"
+        );
+    }
+}

+ 60 - 0
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha256Test.php

@@ -0,0 +1,60 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha256Test extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('ES256', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('sha256', $signer->getAlgorithm());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha256::getSignatureLength
+     */
+    public function getSignatureLengthMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals(64, $signer->getSignatureLength());
+    }
+}

+ 60 - 0
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha384Test.php

@@ -0,0 +1,60 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha384Test extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('ES384', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('sha384', $signer->getAlgorithm());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha384::getSignatureLength
+     */
+    public function getSignatureLengthMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals(96, $signer->getSignatureLength());
+    }
+}

+ 60 - 0
vendor/lcobucci/jwt/test/unit/Signer/Ecdsa/Sha512Test.php

@@ -0,0 +1,60 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Ecdsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha512Test extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('ES512', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('sha512', $signer->getAlgorithm());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa
+     * @uses Lcobucci\JWT\Signer\Ecdsa\KeyParser
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa\Sha512::getSignatureLength
+     */
+    public function getSignatureLengthMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals(132, $signer->getSignatureLength());
+    }
+}

+ 173 - 0
vendor/lcobucci/jwt/test/unit/Signer/EcdsaTest.php

@@ -0,0 +1,173 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use Lcobucci\JWT\Signer\Ecdsa\KeyParser;
+use Mdanter\Ecc\Crypto\Signature\Signature;
+use Mdanter\Ecc\Crypto\Signature\Signer;
+use Mdanter\Ecc\Crypto\Key\PrivateKeyInterface;
+use Mdanter\Ecc\Crypto\Key\PublicKeyInterface;
+use Mdanter\Ecc\Math\MathAdapterInterface as Adapter;
+use Mdanter\Ecc\Primitives\PointInterface;
+use Mdanter\Ecc\Random\RandomNumberGeneratorInterface;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class EcdsaTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Adapter|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $adapter;
+
+    /**
+     * @var Signer|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $signer;
+
+    /**
+     * @var RandomNumberGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $randomGenerator;
+
+    /**
+     * @var KeyParser|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $parser;
+
+    /**
+     * @before
+     */
+    public function createDependencies()
+    {
+        $this->adapter = $this->getMock(Adapter::class);
+        $this->signer = $this->getMock(Signer::class, [], [$this->adapter]);
+        $this->randomGenerator = $this->getMock(RandomNumberGeneratorInterface::class);
+        $this->parser = $this->getMock(KeyParser::class, [], [], '', false);
+    }
+
+    /**
+     * @return Ecdsa
+     */
+    private function getSigner()
+    {
+        $signer = $this->getMockForAbstractClass(
+            Ecdsa::class,
+            [$this->adapter, $this->signer, $this->parser]
+        );
+
+        $signer->method('getSignatureLength')
+               ->willReturn(64);
+
+        $signer->method('getAlgorithm')
+               ->willReturn('sha256');
+
+        $signer->method('getAlgorithmId')
+               ->willReturn('ES256');
+
+        return $signer;
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa::__construct
+     */
+    public function constructShouldConfigureDependencies()
+    {
+        $signer = $this->getSigner();
+
+        $this->assertAttributeSame($this->adapter, 'adapter', $signer);
+        $this->assertAttributeSame($this->signer, 'signer', $signer);
+        $this->assertAttributeSame($this->parser, 'parser', $signer);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa::createHash
+     * @covers Lcobucci\JWT\Signer\Ecdsa::createSigningHash
+     * @covers Lcobucci\JWT\Signer\Ecdsa::createSignatureHash
+     */
+    public function createHashShouldReturnAHashUsingPrivateKey()
+    {
+        $signer = $this->getSigner();
+        $key = new Key('testing');
+        $privateKey = $this->getMock(PrivateKeyInterface::class);
+        $point = $this->getMock(PointInterface::class);
+
+        $privateKey->method('getPoint')
+                   ->willReturn($point);
+
+        $point->method('getOrder')
+              ->willReturn('1');
+
+        $this->parser->expects($this->once())
+                     ->method('getPrivateKey')
+                     ->with($key)
+                     ->willReturn($privateKey);
+
+        $this->randomGenerator->expects($this->once())
+                              ->method('generate')
+                              ->with('1')
+                              ->willReturn('123');
+
+        $this->adapter->expects($this->once())
+                      ->method('hexDec')
+                      ->willReturn('123');
+
+        $this->adapter->expects($this->exactly(2))
+                      ->method('decHex')
+                      ->willReturn('123');
+
+        $this->signer->expects($this->once())
+                     ->method('sign')
+                     ->with($privateKey, $this->isType('string'), $this->isType('string'))
+                     ->willReturn(new Signature('1234', '456'));
+
+        $this->assertInternalType('string', $signer->createHash('testing', $key, $this->randomGenerator));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Ecdsa::__construct
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Ecdsa::doVerify
+     * @covers Lcobucci\JWT\Signer\Ecdsa::createSigningHash
+     * @covers Lcobucci\JWT\Signer\Ecdsa::extractSignature
+     */
+    public function doVerifyShouldDelegateToEcdsaSignerUsingPublicKey()
+    {
+        $signer = $this->getSigner();
+        $key = new Key('testing');
+        $publicKey = $this->getMock(PublicKeyInterface::class);
+
+        $this->parser->expects($this->once())
+                     ->method('getPublicKey')
+                     ->with($key)
+                     ->willReturn($publicKey);
+
+        $this->adapter->expects($this->exactly(3))
+                      ->method('hexDec')
+                      ->willReturn('123');
+
+        $this->signer->expects($this->once())
+                     ->method('verify')
+                     ->with($publicKey, $this->isInstanceOf(Signature::class), $this->isType('string'))
+                     ->willReturn(true);
+
+        $this->assertTrue($signer->doVerify('testing', 'testing2', $key));
+    }
+}

+ 39 - 0
vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha256Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Hmac;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Sha256Test extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha256::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('HS256', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha256::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('sha256', $signer->getAlgorithm());
+    }
+}

+ 39 - 0
vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha384Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Hmac;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Sha384Test extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha384::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('HS384', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha384::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('sha384', $signer->getAlgorithm());
+    }
+}

+ 39 - 0
vendor/lcobucci/jwt/test/unit/Signer/Hmac/Sha512Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Hmac;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class Sha512Test extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha512::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('HS512', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac\Sha512::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('sha512', $signer->getAlgorithm());
+    }
+}

+ 134 - 0
vendor/lcobucci/jwt/test/unit/Signer/HmacTest.php

@@ -0,0 +1,134 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class HmacTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Hmac|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $signer;
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function setUp()
+    {
+        $this->signer = $this->getMockForAbstractClass(Hmac::class);
+
+        $this->signer->expects($this->any())
+                     ->method('getAlgorithmId')
+                     ->willReturn('TEST123');
+
+        $this->signer->expects($this->any())
+                     ->method('getAlgorithm')
+                     ->willReturn('sha256');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::createHash
+     */
+    public function createHashMustReturnAHashAccordingWithTheAlgorithm()
+    {
+        $hash = hash_hmac('sha256', 'test', '123', true);
+
+        $this->assertEquals($hash, $this->signer->createHash('test', new Key('123')));
+
+        return $hash;
+    }
+
+    /**
+     * @test
+     *
+     * @depends createHashMustReturnAHashAccordingWithTheAlgorithm
+     *
+     * @uses Lcobucci\JWT\Signer\Hmac::createHash
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::doVerify
+     */
+    public function doVerifyShouldReturnTrueWhenExpectedHashWasCreatedWithSameInformation($expected)
+    {
+        $this->assertTrue($this->signer->doVerify($expected, 'test', new Key('123')));
+    }
+
+    /**
+     * @test
+     *
+     * @depends createHashMustReturnAHashAccordingWithTheAlgorithm
+     *
+     * @uses Lcobucci\JWT\Signer\Hmac::createHash
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::doVerify
+     */
+    public function doVerifyShouldReturnFalseWhenExpectedHashWasNotCreatedWithSameInformation($expected)
+    {
+        $this->assertFalse($this->signer->doVerify($expected, 'test', new Key('1234')));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::doVerify
+     */
+    public function doVerifyShouldReturnFalseWhenExpectedHashIsNotString()
+    {
+        $this->assertFalse($this->signer->doVerify(false, 'test', new Key('1234')));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::hashEquals
+     */
+    public function hashEqualsShouldReturnFalseWhenExpectedHashHasDifferentLengthThanGenerated()
+    {
+        $this->assertFalse($this->signer->hashEquals('123', '1234'));
+    }
+
+    /**
+     * @test
+     *
+     * @depends createHashMustReturnAHashAccordingWithTheAlgorithm
+     *
+     * @uses Lcobucci\JWT\Signer\Hmac::createHash
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::hashEquals
+     */
+    public function hashEqualsShouldReturnFalseWhenExpectedHashIsDifferentThanGenerated($expected)
+    {
+        $this->assertFalse($this->signer->hashEquals($expected, $this->signer->createHash('test', new Key('1234'))));
+    }
+
+    /**
+     * @test
+     *
+     * @depends createHashMustReturnAHashAccordingWithTheAlgorithm
+     *
+     * @uses Lcobucci\JWT\Signer\Hmac::createHash
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Hmac::hashEquals
+     */
+    public function hashEqualsShouldReturnTrueWhenExpectedHashIsEqualsThanGenerated($expected)
+    {
+        $this->assertTrue($this->signer->hashEquals($expected, $this->signer->createHash('test', new Key('123'))));
+    }
+}

+ 102 - 0
vendor/lcobucci/jwt/test/unit/Signer/KeyTest.php

@@ -0,0 +1,102 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+use org\bovigo\vfs\vfsStream;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 3.0.4
+ */
+class KeyTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @before
+     */
+    public function configureRootDir()
+    {
+        vfsStream::setup(
+            'root',
+            null,
+            ['test.pem' => 'testing']
+        );
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Key::__construct
+     * @covers Lcobucci\JWT\Signer\Key::setContent
+     */
+    public function constructShouldConfigureContentAndPassphrase()
+    {
+        $key = new Key('testing', 'test');
+
+        $this->assertAttributeEquals('testing', 'content', $key);
+        $this->assertAttributeEquals('test', 'passphrase', $key);
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Key::__construct
+     * @covers Lcobucci\JWT\Signer\Key::setContent
+     * @covers Lcobucci\JWT\Signer\Key::readFile
+     */
+    public function constructShouldBeAbleToConfigureContentFromFile()
+    {
+        $key = new Key('file://' . vfsStream::url('root/test.pem'));
+
+        $this->assertAttributeEquals('testing', 'content', $key);
+        $this->assertAttributeEquals(null, 'passphrase', $key);
+    }
+
+    /**
+     * @test
+     *
+     * @expectedException \InvalidArgumentException
+     *
+     * @covers Lcobucci\JWT\Signer\Key::__construct
+     * @covers Lcobucci\JWT\Signer\Key::setContent
+     * @covers Lcobucci\JWT\Signer\Key::readFile
+     */
+    public function constructShouldRaiseExceptionWhenFileDoesNotExists()
+    {
+        new Key('file://' . vfsStream::url('root/test2.pem'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key::__construct
+     * @uses Lcobucci\JWT\Signer\Key::setContent
+     *
+     * @covers Lcobucci\JWT\Signer\Key::getContent
+     */
+    public function getContentShouldReturnConfiguredData()
+    {
+        $key = new Key('testing', 'test');
+
+        $this->assertEquals('testing', $key->getContent());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key::__construct
+     * @uses Lcobucci\JWT\Signer\Key::setContent
+     *
+     * @covers Lcobucci\JWT\Signer\Key::getPassphrase
+     */
+    public function getPassphraseShouldReturnConfiguredData()
+    {
+        $key = new Key('testing', 'test');
+
+        $this->assertEquals('test', $key->getPassphrase());
+    }
+}

+ 49 - 0
vendor/lcobucci/jwt/test/unit/Signer/KeychainTest.php

@@ -0,0 +1,49 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class KeychainTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Keychain::getPrivateKey
+     */
+    public function getPrivateKeyShouldReturnAKey()
+    {
+        $keychain = new Keychain();
+        $key = $keychain->getPrivateKey('testing', 'test');
+
+        $this->assertInstanceOf(Key::class, $key);
+        $this->assertAttributeEquals('testing', 'content', $key);
+        $this->assertAttributeEquals('test', 'passphrase', $key);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Signer\Key
+     *
+     * @covers Lcobucci\JWT\Signer\Keychain::getPublicKey
+     */
+    public function getPublicKeyShouldReturnAValidResource()
+    {
+        $keychain = new Keychain();
+        $key = $keychain->getPublicKey('testing');
+
+        $this->assertInstanceOf(Key::class, $key);
+        $this->assertAttributeEquals('testing', 'content', $key);
+        $this->assertAttributeEquals(null, 'passphrase', $key);
+    }
+}

+ 39 - 0
vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha256Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Rsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha256Test extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals('RS256', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha256::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha256();
+
+        $this->assertEquals(OPENSSL_ALGO_SHA256, $signer->getAlgorithm());
+    }
+}

+ 39 - 0
vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha384Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Rsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha384Test extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha384::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals('RS384', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha384::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha384();
+
+        $this->assertEquals(OPENSSL_ALGO_SHA384, $signer->getAlgorithm());
+    }
+}

+ 39 - 0
vendor/lcobucci/jwt/test/unit/Signer/Rsa/Sha512Test.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT\Signer\Rsa;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 2.1.0
+ */
+class Sha512Test extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha512::getAlgorithmId
+     */
+    public function getAlgorithmIdMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals('RS512', $signer->getAlgorithmId());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Signer\Rsa\Sha512::getAlgorithm
+     */
+    public function getAlgorithmMustBeCorrect()
+    {
+        $signer = new Sha512();
+
+        $this->assertEquals(OPENSSL_ALGO_SHA512, $signer->getAlgorithm());
+    }
+}

+ 502 - 0
vendor/lcobucci/jwt/test/unit/TokenTest.php

@@ -0,0 +1,502 @@
+<?php
+/**
+ * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
+ *
+ * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
+ */
+
+namespace Lcobucci\JWT;
+
+use DateInterval;
+use DateTime;
+use Lcobucci\JWT\Claim\Basic;
+use Lcobucci\JWT\Claim\EqualsTo;
+use Lcobucci\JWT\Claim\GreaterOrEqualsTo;
+use Lcobucci\JWT\Claim\LesserOrEqualsTo;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ * @since 0.1.0
+ */
+class TokenTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Token::__construct
+     */
+    public function constructMustInitializeAnEmptyPlainTextTokenWhenNoArgumentsArePassed()
+    {
+        $token = new Token();
+
+        $this->assertAttributeEquals(['alg' => 'none'], 'headers', $token);
+        $this->assertAttributeEquals([], 'claims', $token);
+        $this->assertAttributeEquals(null, 'signature', $token);
+        $this->assertAttributeEquals(['', ''], 'payload', $token);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::hasHeader
+     */
+    public function hasHeaderMustReturnTrueWhenItIsConfigured()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertTrue($token->hasHeader('test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::hasHeader
+     */
+    public function hasHeaderMustReturnFalseWhenItIsNotConfigured()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertFalse($token->hasHeader('testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasHeader
+     *
+     * @covers Lcobucci\JWT\Token::getHeader
+     *
+     * @expectedException \OutOfBoundsException
+     */
+    public function getHeaderMustRaiseExceptionWhenHeaderIsNotConfigured()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $token->getHeader('testing');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasHeader
+     *
+     * @covers Lcobucci\JWT\Token::getHeader
+     */
+    public function getHeaderMustReturnTheDefaultValueWhenIsNotConfigured()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertEquals('blah', $token->getHeader('testing', 'blah'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasHeader
+     *
+     * @covers Lcobucci\JWT\Token::getHeader
+     * @covers Lcobucci\JWT\Token::getHeaderValue
+     */
+    public function getHeaderMustReturnTheRequestedHeader()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertEquals('testing', $token->getHeader('test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasHeader
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::getHeader
+     * @covers Lcobucci\JWT\Token::getHeaderValue
+     */
+    public function getHeaderMustReturnValueWhenItIsAReplicatedClaim()
+    {
+        $token = new Token(['jti' => new EqualsTo('jti', 1)]);
+
+        $this->assertEquals(1, $token->getHeader('jti'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::getHeaders
+     */
+    public function getHeadersMustReturnTheConfiguredHeader()
+    {
+        $token = new Token(['test' => 'testing']);
+
+        $this->assertEquals(['test' => 'testing'], $token->getHeaders());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::getClaims
+     */
+    public function getClaimsMustReturnTheConfiguredClaims()
+    {
+        $token = new Token([], ['test' => 'testing']);
+
+        $this->assertEquals(['test' => 'testing'], $token->getClaims());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::hasClaim
+     */
+    public function hasClaimMustReturnTrueWhenItIsConfigured()
+    {
+        $token = new Token([], ['test' => new Basic('test', 'testing')]);
+
+        $this->assertTrue($token->hasClaim('test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::hasClaim
+     */
+    public function hasClaimMustReturnFalseWhenItIsNotConfigured()
+    {
+        $token = new Token([], ['test' => new Basic('test', 'testing')]);
+
+        $this->assertFalse($token->hasClaim('testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::getClaim
+     */
+    public function getClaimMustReturnTheDefaultValueWhenIsNotConfigured()
+    {
+        $token = new Token([], ['test' => new Basic('test', 'testing')]);
+
+        $this->assertEquals('blah', $token->getClaim('testing', 'blah'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::getClaim
+     *
+     * @expectedException \OutOfBoundsException
+     */
+    public function getClaimShouldRaiseExceptionWhenClaimIsNotConfigured()
+    {
+        $token = new Token();
+        $token->getClaim('testing');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     *
+     * @covers Lcobucci\JWT\Token::getClaim
+     */
+    public function getClaimShouldReturnTheClaimValueWhenItExists()
+    {
+        $token = new Token([], ['testing' => new Basic('testing', 'test')]);
+
+        $this->assertEquals('test', $token->getClaim('testing'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::verify
+     *
+     * @expectedException BadMethodCallException
+     */
+    public function verifyMustRaiseExceptionWhenTokenIsUnsigned()
+    {
+        $signer = $this->getMock(Signer::class);
+
+        $token = new Token();
+        $token->verify($signer, 'test');
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::verify
+     * @covers Lcobucci\JWT\Token::getPayload
+     */
+    public function verifyShouldReturnFalseWhenTokenAlgorithmIsDifferent()
+    {
+        $signer = $this->getMock(Signer::class);
+        $signature = $this->getMock(Signature::class, [], [], '', false);
+
+        $signer->expects($this->any())
+               ->method('getAlgorithmId')
+               ->willReturn('HS256');
+
+        $signature->expects($this->never())
+                  ->method('verify');
+
+        $token = new Token(['alg' => 'RS256'], [], $signature);
+
+        $this->assertFalse($token->verify($signer, 'test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::verify
+     * @covers Lcobucci\JWT\Token::getPayload
+     */
+    public function verifyMustDelegateTheValidationToSignature()
+    {
+        $signer = $this->getMock(Signer::class);
+        $signature = $this->getMock(Signature::class, [], [], '', false);
+
+        $signer->expects($this->any())
+               ->method('getAlgorithmId')
+               ->willReturn('HS256');
+
+        $signature->expects($this->once())
+                  ->method('verify')
+                  ->with($signer, $this->isType('string'), 'test')
+                  ->willReturn(true);
+
+        $token = new Token(['alg' => 'HS256'], [], $signature);
+
+        $this->assertTrue($token->verify($signer, 'test'));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnTrueWhenClaimsAreEmpty()
+    {
+        $token = new Token();
+
+        $this->assertTrue($token->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData::__construct
+     * @uses Lcobucci\JWT\Claim\Basic::__construct
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnTrueWhenThereAreNoValidatableClaims()
+    {
+        $token = new Token([], ['testing' => new Basic('testing', 'test')]);
+
+        $this->assertTrue($token->validate(new ValidationData()));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\EqualsTo
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnFalseWhenThereIsAtLeastOneFailedValidatableClaim()
+    {
+        $token = new Token(
+            [],
+            [
+                'iss' => new EqualsTo('iss', 'test'),
+                'testing' => new Basic('testing', 'test')
+            ]
+        );
+
+        $data = new ValidationData();
+        $data->setIssuer('test1');
+
+        $this->assertFalse($token->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\ValidationData
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\EqualsTo
+     * @uses Lcobucci\JWT\Claim\LesserOrEqualsTo
+     * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     *
+     * @covers Lcobucci\JWT\Token::validate
+     * @covers Lcobucci\JWT\Token::getValidatableClaims
+     */
+    public function validateShouldReturnTrueWhenThereAreNoFailedValidatableClaims()
+    {
+        $now = time();
+        $token = new Token(
+            [],
+            [
+                'iss' => new EqualsTo('iss', 'test'),
+                'iat' => new LesserOrEqualsTo('iat', $now),
+                'exp' => new GreaterOrEqualsTo('exp', $now + 500),
+                'testing' => new Basic('testing', 'test')
+            ]
+        );
+
+        $data = new ValidationData($now + 10);
+        $data->setIssuer('test');
+
+        $this->assertTrue($token->validate($data));
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Token::isExpired
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getClaim
+     * @uses Lcobucci\JWT\Token::hasClaim
+     */
+    public function isExpiredShouldReturnFalseWhenTokenDoesNotExpires()
+    {
+        $token = new Token(['alg' => 'none']);
+
+        $this->assertFalse($token->isExpired());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Token::isExpired
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getClaim
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     */
+    public function isExpiredShouldReturnFalseWhenTokenIsNotExpired()
+    {
+        $token = new Token(
+            ['alg' => 'none'],
+            ['exp' => new GreaterOrEqualsTo('exp', time() + 500)]
+        );
+
+        $this->assertFalse($token->isExpired());
+    }
+
+    /**
+     * @test
+     *
+     * @covers Lcobucci\JWT\Token::isExpired
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getClaim
+     * @uses Lcobucci\JWT\Token::hasClaim
+     * @uses Lcobucci\JWT\Claim\Basic
+     * @uses Lcobucci\JWT\Claim\GreaterOrEqualsTo
+     */
+    public function isExpiredShouldReturnTrueAfterTokenExpires()
+    {
+        $token = new Token(
+            ['alg' => 'none'],
+            ['exp' => new GreaterOrEqualsTo('exp', time())]
+        );
+
+        $this->assertTrue($token->isExpired(new DateTime('+10 days')));
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     *
+     * @covers Lcobucci\JWT\Token::getPayload
+     */
+    public function getPayloadShouldReturnAStringWithTheTwoEncodePartsThatGeneratedTheToken()
+    {
+        $token = new Token(['alg' => 'none'], [], null, ['test1', 'test2', 'test3']);
+
+        $this->assertEquals('test1.test2', $token->getPayload());
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getPayload
+     *
+     * @covers Lcobucci\JWT\Token::__toString
+     */
+    public function toStringMustReturnEncodedDataWithEmptySignature()
+    {
+        $token = new Token(['alg' => 'none'], [], null, ['test', 'test']);
+
+        $this->assertEquals('test.test.', (string) $token);
+    }
+
+    /**
+     * @test
+     *
+     * @uses Lcobucci\JWT\Token::__construct
+     * @uses Lcobucci\JWT\Token::getPayload
+     *
+     * @covers Lcobucci\JWT\Token::__toString
+     */
+    public function toStringMustReturnEncodedData()
+    {
+        $signature = $this->getMock(Signature::class, [], [], '', false);
+
+        $token = new Token(['alg' => 'none'], [], $signature, ['test', 'test', 'test']);
+
+        $this->assertEquals('test.test.test', (string) $token);
+    }
+}

Some files were not shown because too many files changed in this diff