This repository has been archived by the owner on Apr 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
By adding the clock skew option Source: djoos/EscapeWSSEAuthenticationBundle#84
- Loading branch information
1 parent
4817361
commit ff1a2c6
Showing
6 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/HotfixBundle/DependencyInjection/Compiler/WssePass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace HotfixBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
|
||
class WssePass implements CompilerPassInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if ($container->hasDefinition('escape_wsse_authentication.provider')) { | ||
$definition = $container->getDefinition('escape_wsse_authentication.provider'); | ||
$definition->addMethodCall('setClockSkew', ['%hotfix.wsse.clock_skew%']); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace HotfixBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; | ||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
class Configuration implements ConfigurationInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder(); | ||
$rootNode = $treeBuilder->root('hotfix'); | ||
|
||
$this->addWsse($rootNode); | ||
|
||
return $treeBuilder; | ||
} | ||
|
||
/** | ||
* @param ArrayNodeDefinition $rootNode | ||
*/ | ||
private function addWsse(ArrayNodeDefinition $rootNode) | ||
{ | ||
$rootNode | ||
->children() | ||
->arrayNode('wsse') | ||
->addDefaultsIfNotSet() | ||
->children() | ||
->integerNode('clock_skew') | ||
->cannotBeEmpty() | ||
->defaultValue(0) | ||
->info('An amount of seconds to tolerate differences between client and server') | ||
->end() | ||
->end() | ||
->end() | ||
->end() | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/HotfixBundle/Security/Core/Authentication/Provider/WsseProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace HotfixBundle\Security\Core\Authentication\Provider; | ||
|
||
use Oro\Bundle\UserBundle\Security\WsseAuthProvider; | ||
|
||
class WsseProvider extends WsseAuthProvider | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
protected $clockSkew; | ||
|
||
/** | ||
* @param int $clockSkew | ||
*/ | ||
public function setClockSkew($clockSkew) | ||
{ | ||
$this->$clockSkew = $clockSkew; | ||
} | ||
|
||
protected function isTokenFromFuture($created) | ||
{ | ||
return strtotime($created) - $this->clockSkew > strtotime($this->getCurrentTime()); | ||
} | ||
} |