1
|
|
|
<?php |
2
|
|
|
namespace GoetasWebservices\SoapServices\SoapClient\WssWsSecurity; |
3
|
|
|
|
4
|
|
|
use GoetasWebservices\SoapServices\SoapClient\WssWsSecurity\Secext\AttributedStringType; |
5
|
|
|
use GoetasWebservices\SoapServices\SoapClient\WssWsSecurity\Secext\Nonce; |
6
|
|
|
use GoetasWebservices\SoapServices\SoapClient\WssWsSecurity\Secext\Password; |
7
|
|
|
use GoetasWebservices\SoapServices\SoapClient\WssWsSecurity\Secext\Security as SecextSecurity; |
8
|
|
|
use GoetasWebservices\SoapServices\SoapClient\WssWsSecurity\Secext\UsernameToken; |
9
|
|
|
use GoetasWebservices\SoapServices\SoapClient\WssWsSecurity\Utility\Created; |
10
|
|
|
use GoetasWebservices\SoapServices\SoapClient\WssWsSecurity\Utility\Expires; |
11
|
|
|
use GoetasWebservices\SoapServices\SoapClient\WssWsSecurity\Utility\Timestamp; |
12
|
|
|
use JMS\Serializer\GraphNavigator; |
13
|
|
|
use JMS\Serializer\Handler\SubscribingHandlerInterface; |
14
|
|
|
use JMS\Serializer\Metadata\StaticPropertyMetadata; |
15
|
|
|
use JMS\Serializer\SerializationContext; |
16
|
|
|
use JMS\Serializer\XmlSerializationVisitor; |
17
|
|
|
|
18
|
|
|
class WssSecurityHeaderHandler implements SubscribingHandlerInterface |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @var WsSecurityFilterRequest |
22
|
|
|
*/ |
23
|
|
|
protected $filter; |
24
|
|
|
|
25
|
|
|
public static function getSubscribingMethods() |
26
|
|
|
{ |
27
|
|
|
return array( |
28
|
|
|
array( |
29
|
|
|
'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
30
|
|
|
'format' => 'xml', |
31
|
|
|
'type' => Security::class, |
32
|
|
|
'method' => 'serializeHeader' |
33
|
|
|
) |
34
|
|
|
); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function __construct(WsSecurityFilterRequest $filterResponse) |
38
|
|
|
{ |
39
|
|
|
$this->filter = $filterResponse; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function serializeHeader(XmlSerializationVisitor $visitor, Security $data, array $type, SerializationContext $context) |
|
|
|
|
43
|
|
|
{ |
44
|
|
|
|
45
|
|
|
$securityHeader = $this->filter->filterDom($visitor->getDocument(), $data); |
|
|
|
|
46
|
|
|
|
47
|
|
|
$currentNode = $visitor->getCurrentNode(); |
48
|
|
|
$currentNode->parentNode->replaceChild($securityHeader, $currentNode); |
49
|
|
|
$visitor->revertCurrentNode(); |
50
|
|
|
$visitor->setCurrentNode($securityHeader); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.