Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Classes/Controller/TokenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,22 @@ class TokenController extends AbstractAuthenticationController
*/
protected $localizationService;

/**
* @var array
* @Flow\InjectConfiguration(package="RFY.JWT", path="response.headers")
*/
protected $responseHeaders;

/**
*
*/
public function initializeAuthenticateAction()
{
$this->response->setHeader('Access-Control-Allow-Origin', '*');
$this->response = $this->response->withHeader('Access-Control-Allow-Origin', $this->responseHeaders['Access-Control-Allow-Origin']);

if ($this->request->getHttpRequest()->getMethod() === 'OPTIONS') {
$this->response->setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
$this->response->withStatus(204);
$this->response = $this->response->withHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
$this->response = $this->response->withStatus(204);
return '';
}
}
Expand Down Expand Up @@ -100,7 +106,7 @@ protected function onAuthenticationFailure(AuthenticationRequiredException $exce
);

if ($this->request->getHttpRequest()->getMethod() !== 'OPTIONS') {
$this->response->setStatus(401);
$this->response = $this->response->withStatus(401);
}
}

Expand All @@ -110,4 +116,4 @@ protected function onAuthenticationFailure(AuthenticationRequiredException $exce
protected function errorAction()
{
}
}
}
5 changes: 4 additions & 1 deletion Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ Neos:

RFY:
JWT:
response:
headers:
'Access-Control-Allow-Origin': '*'
key: ~
algorithms:
- HS256
tokenSources:
- from: header
name: Authorization
claimMapping: []
claimMapping: []