@@ -48,8 +48,8 @@ |
||
| 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); |
@@ -64,8 +64,8 @@ |
||
| 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); |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | Environment::putEnv('JWT_SIGNER_KEY=string'); |
| 49 | 49 | |
| 50 | - $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql'); |
|
| 51 | - $request->addHeader('Authorization', 'Bearer ' . $this->token); |
|
| 50 | + $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql'); |
|
| 51 | + $request->addHeader('Authorization', 'Bearer '.$this->token); |
|
| 52 | 52 | |
| 53 | 53 | $handler = Injector::inst()->get(JWTAuthenticationHandler::class); |
| 54 | 54 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | public function testAuthenticateRequest() |
| 62 | 62 | { |
| 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 | $handler = Injector::inst()->get(JWTAuthenticationHandler::class); |
| 67 | 67 | |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | public function testValidToken() |
| 48 | 48 | { |
| 49 | 49 | $authenticator = Injector::inst()->get(JWTAuthenticator::class); |
| 50 | - $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql'); |
|
| 51 | - $request->addHeader('Authorization', 'Bearer ' . $this->token); |
|
| 50 | + $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql'); |
|
| 51 | + $request->addHeader('Authorization', 'Bearer '.$this->token); |
|
| 52 | 52 | |
| 53 | 53 | $result = $authenticator->authenticate(['token' => $this->token], $request); |
| 54 | 54 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | Environment::putEnv('JWT_SIGNER_KEY=string'); |
| 62 | 62 | |
| 63 | 63 | $authenticator = Injector::inst()->get(JWTAuthenticator::class); |
| 64 | - $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql'); |
|
| 65 | - $request->addHeader('Authorization', 'Bearer ' . $this->token); |
|
| 64 | + $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql'); |
|
| 65 | + $request->addHeader('Authorization', 'Bearer '.$this->token); |
|
| 66 | 66 | |
| 67 | 67 | $result = $authenticator->authenticate(['token' => $this->token], $request); |
| 68 | 68 | |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | public function testInvalidUniqueID() |
| 75 | 75 | { |
| 76 | 76 | $authenticator = Injector::inst()->get(JWTAuthenticator::class); |
| 77 | - $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql'); |
|
| 78 | - $request->addHeader('Authorization', 'Bearer ' . $this->token); |
|
| 77 | + $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql'); |
|
| 78 | + $request->addHeader('Authorization', 'Bearer '.$this->token); |
|
| 79 | 79 | |
| 80 | 80 | // Invalidate the Unique ID by making it something arbitrarily wrong |
| 81 | 81 | $member = Member::get()->filter(['Email' => '[email protected]'])->first(); |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | $token = $response->Token; |
| 105 | 105 | |
| 106 | 106 | $authenticator = Injector::inst()->get(JWTAuthenticator::class); |
| 107 | - $request = new HTTPRequest('POST', Director::absoluteBaseURL() . '/graphql'); |
|
| 108 | - $request->addHeader('Authorization', 'Bearer ' . $token); |
|
| 107 | + $request = new HTTPRequest('POST', Director::absoluteBaseURL().'/graphql'); |
|
| 108 | + $request->addHeader('Authorization', 'Bearer '.$token); |
|
| 109 | 109 | |
| 110 | 110 | $result = $authenticator->authenticate(['token' => $token], $request); |
| 111 | 111 | |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | if (file_exists($signerKey)) { |
| 69 | 69 | $this->signer = new RsaSha256(); |
| 70 | 70 | $password = Environment::getEnv('JWT_KEY_PASSWORD'); |
| 71 | - $this->privateKey = new Key('file://' . $signerKey, $password ?: null); |
|
| 71 | + $this->privateKey = new Key('file://'.$signerKey, $password ?: null); |
|
| 72 | 72 | // We're having an RSA signed key instead of a string |
| 73 | - $this->publicKey = new Key('file://' . Environment::getEnv('JWT_PUBLIC_KEY')); |
|
| 73 | + $this->publicKey = new Key('file://'.Environment::getEnv('JWT_PUBLIC_KEY')); |
|
| 74 | 74 | } else { |
| 75 | 75 | $this->signer = new Sha256(); |
| 76 | 76 | $this->privateKey = $signerKey; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @throws OutOfBoundsException |
| 97 | 97 | * @throws BadMethodCallException |
| 98 | 98 | */ |
| 99 | - public function authenticate(array $data, HTTPRequest $request, ValidationResult &$result = null) |
|
| 99 | + public function authenticate(array $data, HTTPRequest $request, ValidationResult & $result = null) |
|
| 100 | 100 | { |
| 101 | 101 | if (!$result) { |
| 102 | 102 | $result = new ValidationResult(); |