Passed
Push — master ( 54fb4a...8bac1c )
by Simon
01:50
created
src/Authentication/JWTAuthenticator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
         if (file_exists($signerKey)) {
68 68
             $this->signer = new RsaSha256();
69 69
             $password = getenv('JWT_KEY_PASSWORD');
70
-            $this->privateKey = new Key('file://' . $signerKey, $password ?: null);
70
+            $this->privateKey = new Key('file://'.$signerKey, $password ?: null);
71 71
             // We're having an RSA signed key instead of a string
72
-            $this->publicKey = new Key('file://' . getenv('JWT_PUBLIC_KEY'));
72
+            $this->publicKey = new Key('file://'.getenv('JWT_PUBLIC_KEY'));
73 73
         } else {
74 74
             $this->signer = new Sha256();
75 75
             $this->privateKey = $signerKey;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * @throws OutOfBoundsException
96 96
      * @throws BadMethodCallException
97 97
      */
98
-    public function authenticate(array $data, HTTPRequest $request, ValidationResult &$result = null)
98
+    public function authenticate(array $data, HTTPRequest $request, ValidationResult & $result = null)
99 99
     {
100 100
         if (!$result) {
101 101
             $result = new ValidationResult();
Please login to merge, or discard this patch.
tests/unit/JWTAuthenticatorTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     public function testValidToken()
47 47
     {
48 48
         $authenticator = Injector::inst()->get(JWTAuthenticator::class);
49
-        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
50
-        $request->addHeader('Authorization', 'Bearer ' . $this->token);
49
+        $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql');
50
+        $request->addHeader('Authorization', 'Bearer '.$this->token);
51 51
 
52 52
         $result = $authenticator->authenticate(['token' => $this->token], $request);
53 53
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
         putenv('JWT_SIGNER_KEY=string');
61 61
 
62 62
         $authenticator = Injector::inst()->get(JWTAuthenticator::class);
63
-        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
64
-        $request->addHeader('Authorization', 'Bearer ' . $this->token);
63
+        $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql');
64
+        $request->addHeader('Authorization', 'Bearer '.$this->token);
65 65
 
66 66
         $result = $authenticator->authenticate(['token' => $this->token], $request);
67 67
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
     public function testInvalidUniqueID()
74 74
     {
75 75
         $authenticator = Injector::inst()->get(JWTAuthenticator::class);
76
-        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
77
-        $request->addHeader('Authorization', 'Bearer ' . $this->token);
76
+        $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql');
77
+        $request->addHeader('Authorization', 'Bearer '.$this->token);
78 78
 
79 79
         // Invalidate the Unique ID by making it something arbitrarily wrong
80 80
         $member = Member::get()->filter(['Email' => '[email protected]'])->first();
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
         $token = $response->Token;
104 104
 
105 105
         $authenticator = Injector::inst()->get(JWTAuthenticator::class);
106
-        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
107
-        $request->addHeader('Authorization', 'Bearer ' . $token);
106
+        $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql');
107
+        $request->addHeader('Authorization', 'Bearer '.$token);
108 108
 
109 109
         $result = $authenticator->authenticate(['token' => $token], $request);
110 110
 
Please login to merge, or discard this patch.
tests/unit/ValidateTokenQueryCreatorTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@
 block discarded – undo
48 48
 
49 49
     private function buildRequest()
50 50
     {
51
-        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
52
-        $request->addHeader('Authorization', 'Bearer ' . $this->token);
51
+        $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql');
52
+        $request->addHeader('Authorization', 'Bearer '.$this->token);
53 53
 
54 54
         $request->setSession(new Session(['hello' => 'bye'])); // We need a session
55 55
         Controller::curr()->setRequest($request);
Please login to merge, or discard this patch.
tests/unit/JWTAuthenticationHandlerTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     {
47 47
         putenv('JWT_SIGNER_KEY=string');
48 48
 
49
-        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
50
-        $request->addHeader('Authorization', 'Bearer ' . $this->token);
49
+        $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql');
50
+        $request->addHeader('Authorization', 'Bearer '.$this->token);
51 51
 
52 52
         $handler = Injector::inst()->get(JWTAuthenticationHandler::class);
53 53
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 
60 60
     public function testAuthenticateRequest()
61 61
     {
62
-        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
63
-        $request->addHeader('Authorization', 'Bearer ' . $this->token);
62
+        $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql');
63
+        $request->addHeader('Authorization', 'Bearer '.$this->token);
64 64
 
65 65
         $handler = Injector::inst()->get(JWTAuthenticationHandler::class);
66 66
 
Please login to merge, or discard this patch.
tests/unit/RefreshTokenMutationCreatorTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,8 +64,8 @@
 block discarded – undo
64 64
         if ($anonymous) {
65 65
             $token = $this->anonymousToken;
66 66
         }
67
-        $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql');
68
-        $request->addHeader('Authorization', 'Bearer ' . $token);
67
+        $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql');
68
+        $request->addHeader('Authorization', 'Bearer '.$token);
69 69
 
70 70
         $request->setSession(new Session(['hello' => 'bye'])); // We need a session
71 71
         Controller::curr()->setRequest($request);
Please login to merge, or discard this patch.