Completed
Push — master ( 6969ed...0fcf39 )
by Joao
11s queued 10s
created
tests/JwtWrapperHashTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
         $jwt = $this->object->createJwtData($this->dataToToken);
40 40
 
41 41
         $this->assertEquals([
42
-            'iat'  => $jwt["iat"],  // Not deterministic for the test
43
-            'jti'  => $jwt["jti"],  // Not deterministic for the test
42
+            'iat'  => $jwt["iat"], // Not deterministic for the test
43
+            'jti'  => $jwt["jti"], // Not deterministic for the test
44 44
             'iss'  => "example.com",
45 45
             'nbf'  => $jwt["iat"],
46 46
             'exp'  => $jwt["iat"] + 60,
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
         $data = $this->object->extractData($token);
53 53
 
54 54
         $expectedData = new stdClass();
55
-        $expectedData->iat = $jwt["iat"];  // Not deterministic for the test
56
-        $expectedData->jti = $jwt["jti"];  // Not deterministic for the test
55
+        $expectedData->iat = $jwt["iat"]; // Not deterministic for the test
56
+        $expectedData->jti = $jwt["jti"]; // Not deterministic for the test
57 57
         $expectedData->iss = "example.com";
58 58
         $expectedData->nbf = $jwt["iat"];
59 59
         $expectedData->exp = $jwt["iat"] + 60;
60
-        $expectedData->data = (object)$this->dataToToken;
60
+        $expectedData->data = (object) $this->dataToToken;
61 61
 
62 62
         $this->assertEquals(
63 63
             $expectedData,
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
         $jwt = $this->object->createJwtData($this->dataToToken);
72 72
 
73 73
         $this->assertEquals([
74
-            'iat'  => $jwt["iat"],  // Not deterministic for the test
75
-            'jti'  => $jwt["jti"],  // Not deterministic for the test
74
+            'iat'  => $jwt["iat"], // Not deterministic for the test
75
+            'jti'  => $jwt["jti"], // Not deterministic for the test
76 76
             'iss'  => "example.com",
77 77
             'nbf'  => $jwt["iat"],
78 78
             'exp'  => $jwt["iat"] + 60,
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
         $data = $this->object->extractData();
87 87
 
88 88
         $expectedData = new stdClass();
89
-        $expectedData->iat = $jwt["iat"];  // Not deterministic for the test
90
-        $expectedData->jti = $jwt["jti"];  // Not deterministic for the test
89
+        $expectedData->iat = $jwt["iat"]; // Not deterministic for the test
90
+        $expectedData->jti = $jwt["jti"]; // Not deterministic for the test
91 91
         $expectedData->iss = "example.com";
92 92
         $expectedData->nbf = $jwt["iat"];
93 93
         $expectedData->exp = $jwt["iat"] + 60;
94
-        $expectedData->data = (object)$this->dataToToken;
94
+        $expectedData->data = (object) $this->dataToToken;
95 95
 
96 96
         $this->assertEquals(
97 97
             $expectedData,
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function testExpiredToken()
136 136
     {
137
-        $jwt = $this->object->createJwtData($this->dataToToken,1);
137
+        $jwt = $this->object->createJwtData($this->dataToToken, 1);
138 138
         $token = $this->object->generateToken($jwt);
139 139
 
140 140
         sleep(2);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function testNotBeforeToken()
150 150
     {
151
-        $jwt = $this->object->createJwtData($this->dataToToken,60, 60);
151
+        $jwt = $this->object->createJwtData($this->dataToToken, 60, 60);
152 152
         $token = $this->object->generateToken($jwt);
153 153
 
154 154
         $this->object->extractData($token);
Please login to merge, or discard this patch.
src/JwtWrapper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,19 +40,19 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $tokenId    = base64_encode(openssl_random_pseudo_bytes(32));
42 42
         $issuedAt   = time();
43
-        $notBefore  = $issuedAt + $secondsNotBefore;          //Adding 10 seconds
44
-        $expire     = $notBefore + $secondsExpire;            // Adding 60 seconds
45
-        $serverName = $this->serverName;                       // Retrieve the server name from config file
43
+        $notBefore  = $issuedAt + $secondsNotBefore; //Adding 10 seconds
44
+        $expire     = $notBefore + $secondsExpire; // Adding 60 seconds
45
+        $serverName = $this->serverName; // Retrieve the server name from config file
46 46
 
47 47
         /*
48 48
          * Create the token as an array
49 49
          */
50 50
         return [
51
-            'iat'  => $issuedAt,         // Issued at: time when the token was generated
52
-            'jti'  => $tokenId,          // Json Token Id: an unique identifier for the token
53
-            'iss'  => $serverName,       // Issuer
54
-            'nbf'  => $notBefore,        // Not before
55
-            'exp'  => $expire,           // Expire
51
+            'iat'  => $issuedAt, // Issued at: time when the token was generated
52
+            'jti'  => $tokenId, // Json Token Id: an unique identifier for the token
53
+            'iss'  => $serverName, // Issuer
54
+            'nbf'  => $notBefore, // Not before
55
+            'exp'  => $expire, // Expire
56 56
             'data' => $data              // Data related to the signer user
57 57
         ];
58 58
     }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
          * The output string can be validated at http://jwt.io/
67 67
          */
68 68
         $jwt = JWT::encode(
69
-            $jwtData,      //Data to be encoded in the JWT
69
+            $jwtData, //Data to be encoded in the JWT
70 70
             $this->jwtKey->getPrivateKey(), // The signing key
71 71
             $this->jwtKey->getAlghoritm()
72 72
         );
Please login to merge, or discard this patch.