@@ -14,17 +14,17 @@ |
||
| 14 | 14 | use Symfony\Component\EventDispatcher\Event; |
| 15 | 15 | |
| 16 | 16 | class GetTokenRequestEvent extends Event { |
| 17 | - private $token = null; |
|
| 18 | - public function __construct(Request $request){ |
|
| 19 | - $this->request = $request; |
|
| 20 | - } |
|
| 21 | - public function getRequest(){ |
|
| 22 | - return $this->request; |
|
| 23 | - } |
|
| 24 | - public function setToken($token){ |
|
| 25 | - $this->token = $token; |
|
| 26 | - } |
|
| 27 | - public function getToken(){ |
|
| 28 | - return $this->token; |
|
| 29 | - } |
|
| 17 | + private $token = null; |
|
| 18 | + public function __construct(Request $request){ |
|
| 19 | + $this->request = $request; |
|
| 20 | + } |
|
| 21 | + public function getRequest(){ |
|
| 22 | + return $this->request; |
|
| 23 | + } |
|
| 24 | + public function setToken($token){ |
|
| 25 | + $this->token = $token; |
|
| 26 | + } |
|
| 27 | + public function getToken(){ |
|
| 28 | + return $this->token; |
|
| 29 | + } |
|
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -15,16 +15,16 @@ |
||
| 15 | 15 | |
| 16 | 16 | class GetTokenRequestEvent extends Event { |
| 17 | 17 | private $token = null; |
| 18 | - public function __construct(Request $request){ |
|
| 18 | + public function __construct(Request $request) { |
|
| 19 | 19 | $this->request = $request; |
| 20 | 20 | } |
| 21 | - public function getRequest(){ |
|
| 21 | + public function getRequest() { |
|
| 22 | 22 | return $this->request; |
| 23 | 23 | } |
| 24 | - public function setToken($token){ |
|
| 24 | + public function setToken($token) { |
|
| 25 | 25 | $this->token = $token; |
| 26 | 26 | } |
| 27 | - public function getToken(){ |
|
| 27 | + public function getToken() { |
|
| 28 | 28 | return $this->token; |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -14,21 +14,21 @@ |
||
| 14 | 14 | use Symfony\Component\EventDispatcher\Event; |
| 15 | 15 | |
| 16 | 16 | class AddTokenResponseEvent extends Event { |
| 17 | - private $data = []; |
|
| 18 | - public function __construct($token, Response $response){ |
|
| 19 | - $this->token = $token; |
|
| 20 | - $this->response = $response; |
|
| 21 | - } |
|
| 22 | - public function getToken(){ |
|
| 23 | - return $this->token; |
|
| 24 | - } |
|
| 25 | - public function getResponse(){ |
|
| 26 | - return $this->response; |
|
| 27 | - } |
|
| 28 | - public function setData(array $data){ |
|
| 29 | - $this->data = $data; |
|
| 30 | - } |
|
| 31 | - public function getData(){ |
|
| 32 | - return $this->data; |
|
| 33 | - } |
|
| 17 | + private $data = []; |
|
| 18 | + public function __construct($token, Response $response){ |
|
| 19 | + $this->token = $token; |
|
| 20 | + $this->response = $response; |
|
| 21 | + } |
|
| 22 | + public function getToken(){ |
|
| 23 | + return $this->token; |
|
| 24 | + } |
|
| 25 | + public function getResponse(){ |
|
| 26 | + return $this->response; |
|
| 27 | + } |
|
| 28 | + public function setData(array $data){ |
|
| 29 | + $this->data = $data; |
|
| 30 | + } |
|
| 31 | + public function getData(){ |
|
| 32 | + return $this->data; |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -15,20 +15,20 @@ |
||
| 15 | 15 | |
| 16 | 16 | class AddTokenResponseEvent extends Event { |
| 17 | 17 | private $data = []; |
| 18 | - public function __construct($token, Response $response){ |
|
| 18 | + public function __construct($token, Response $response) { |
|
| 19 | 19 | $this->token = $token; |
| 20 | 20 | $this->response = $response; |
| 21 | 21 | } |
| 22 | - public function getToken(){ |
|
| 22 | + public function getToken() { |
|
| 23 | 23 | return $this->token; |
| 24 | 24 | } |
| 25 | - public function getResponse(){ |
|
| 25 | + public function getResponse() { |
|
| 26 | 26 | return $this->response; |
| 27 | 27 | } |
| 28 | - public function setData(array $data){ |
|
| 28 | + public function setData(array $data) { |
|
| 29 | 29 | $this->data = $data; |
| 30 | 30 | } |
| 31 | - public function getData(){ |
|
| 31 | + public function getData() { |
|
| 32 | 32 | return $this->data; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -19,9 +19,17 @@ |
||
| 19 | 19 | $this->token = $token; |
| 20 | 20 | $this->response = $response; |
| 21 | 21 | } |
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @return null|string |
|
| 25 | + */ |
|
| 22 | 26 | public function getToken(){ |
| 23 | 27 | return $this->token; |
| 24 | 28 | } |
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @return null|string |
|
| 32 | + */ |
|
| 25 | 33 | public function getResponse(){ |
| 26 | 34 | return $this->response; |
| 27 | 35 | } |
@@ -12,6 +12,6 @@ |
||
| 12 | 12 | namespace Gesdinet\JWTRefreshTokenBundle; |
| 13 | 13 | |
| 14 | 14 | class Events { |
| 15 | - const ADD_TOKEN_RESPONSE = 'gesdinet.jwtrefreshtoken.event.add_token_response'; |
|
| 16 | - const GET_TOKEN_REQUEST = 'gesdinet.jwtrefreshtoken.event.get_token_request'; |
|
| 15 | + const ADD_TOKEN_RESPONSE = 'gesdinet.jwtrefreshtoken.event.add_token_response'; |
|
| 16 | + const GET_TOKEN_REQUEST = 'gesdinet.jwtrefreshtoken.event.get_token_request'; |
|
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $definition->addTag('kernel.event_listener', ['event' => Events::GET_TOKEN_REQUEST, 'method' => 'onGetToken']); |
| 64 | 64 | $container->setDefinition('gesdinet_jwt_refresh_token.extractor.request_header', $definition); |
| 65 | 65 | |
| 66 | - $definition = new Definition(\Gesdinet\JWTRefreshTokenBundle\EventListener\TokenSetter\ResponseHeaderTokenSetterEventListener::class, [$config['methods']['request_header']['name']]); |
|
| 66 | + $definition = new Definition(\Gesdinet\JWTRefreshTokenBundle\EventListener\TokenSetter\ResponseHeaderTokenSetterEventListener::class, [$config['methods']['request_header']['name']]); |
|
| 67 | 67 | $definition->addTag('kernel.event_listener', ['event' => Events::ADD_TOKEN_RESPONSE, 'method' => 'onAddToken']); |
| 68 | 68 | $container->setDefinition('gesdinet_jwt_refresh_token.setter.response_header', $definition); |
| 69 | 69 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $container->setParameter('gesdinet.jwtrefreshtoken.entity_manager.id', $config['entity_manager']); |
| 50 | 50 | |
| 51 | - if($config['methods']['request_body']['enabled']){ |
|
| 51 | + if ($config['methods']['request_body']['enabled']) { |
|
| 52 | 52 | $definition = new Definition(\Gesdinet\JWTRefreshTokenBundle\EventListener\TokenExtractor\RequestBodyTokenExtractorEventListener::class, [$config['methods']['request_body']['name']]); |
| 53 | 53 | $definition->addTag('kernel.event_listener', ['event' => Events::GET_TOKEN_REQUEST, 'method' => 'onGetToken']); |
| 54 | 54 | $container->setDefinition('gesdinet_jwt_refresh_token.extractor.request_body', $definition); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $container->setDefinition('gesdinet_jwt_refresh_token.setter.response_body', $definition); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if($config['methods']['request_header']['enabled']){ |
|
| 61 | + if ($config['methods']['request_header']['enabled']) { |
|
| 62 | 62 | $definition = new Definition(\Gesdinet\JWTRefreshTokenBundle\EventListener\TokenExtractor\RequestHeaderTokenExtractorEventListener::class, [$config['methods']['request_header']['name']]); |
| 63 | 63 | $definition->addTag('kernel.event_listener', ['event' => Events::GET_TOKEN_REQUEST, 'method' => 'onGetToken']); |
| 64 | 64 | $container->setDefinition('gesdinet_jwt_refresh_token.extractor.request_header', $definition); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $container->setDefinition('gesdinet_jwt_refresh_token.setter.response_header', $definition); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if($config['methods']['cookie']['enabled']){ |
|
| 71 | + if ($config['methods']['cookie']['enabled']) { |
|
| 72 | 72 | $definition = new Definition(\Gesdinet\JWTRefreshTokenBundle\EventListener\TokenExtractor\RequestCookieTokenExtractorEventListener::class, [$config['methods']['cookie']['name']]); |
| 73 | 73 | $definition->addTag('kernel.event_listener', ['event' => Events::GET_TOKEN_REQUEST, 'method' => 'onGetToken']); |
| 74 | 74 | $container->setDefinition('gesdinet_jwt_refresh_token.extractor.cookie', $definition); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | class RefreshTokenAuthenticator extends RefreshTokenAuthenticatorBase implements AuthenticationFailureHandlerInterface |
| 40 | 40 | { |
| 41 | - public function __construct(EventDispatcherInterface $dispatcher){ |
|
| 41 | + public function __construct(EventDispatcherInterface $dispatcher) { |
|
| 42 | 42 | $this->dispatcher = $dispatcher; |
| 43 | 43 | } |
| 44 | 44 | public function createToken(Request $request, $providerKey) |
@@ -16,20 +16,20 @@ |
||
| 16 | 16 | |
| 17 | 17 | public function it_should_set_parameters_correctly(ContainerBuilder $container, ParameterBag $parameterBag) |
| 18 | 18 | { |
| 19 | - $parameterBag->resolveValue(Argument::type('string'))->will(function ($args) { |
|
| 19 | + $parameterBag->resolveValue(Argument::type('string'))->will(function($args) { |
|
| 20 | 20 | return $args[0]; |
| 21 | 21 | }); |
| 22 | - $parameterBag->unescapeValue(Argument::type('string'))->will(function ($args) { |
|
| 22 | + $parameterBag->unescapeValue(Argument::type('string'))->will(function($args) { |
|
| 23 | 23 | return $args[0]; |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | 26 | $container->getParameterBag()->willReturn($parameterBag); |
| 27 | 27 | $container->fileExists(Argument::any())->willReturn(true); |
| 28 | - $container->setParameter(Argument::any(), Argument::any())->will(function () { |
|
| 28 | + $container->setParameter(Argument::any(), Argument::any())->will(function() { |
|
| 29 | 29 | }); |
| 30 | - $container->setDefinition(Argument::any(), Argument::any())->will(function () { |
|
| 30 | + $container->setDefinition(Argument::any(), Argument::any())->will(function() { |
|
| 31 | 31 | }); |
| 32 | - $container->getReflectionClass(Argument::type('string'))->will(function ($args) { |
|
| 32 | + $container->getReflectionClass(Argument::type('string'))->will(function($args) { |
|
| 33 | 33 | return new \ReflectionClass($args[0]); |
| 34 | 34 | }); |
| 35 | 35 | $container->addResource(Argument::any())->willReturn(null); |