{"id":209154,"date":"2014-01-15T12:22:03","date_gmt":"2014-01-15T08:22:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=209154"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=209154","title":{"rendered":"<span class=\"post_title\">\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 sha512 \u0432 wsse-authentication-bundle \u043e\u0442 Escape Studios, Symfony2<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u043e\u043a\u0435\u043d\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 sha512. \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0443\u0437\u043a\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f, \u043d\u043e \u044f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0441\u044c \u0441 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u044f. <\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043f\u0440\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 API \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 \u043d\u0430 Symfony2 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c <a href=\"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\">FOSUserBundle<\/a> \u0438 <a href=\"https:\/\/github.com\/escapestudios\/EscapeWSSEAuthenticationBundle\">WSSEAuthenticationBundle<\/a> c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c <i>sha512<\/i> \u0438 \u0432\u0441\u043a\u043e\u0440\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430. \u041e\u0431 \u044d\u0442\u043e\u043c \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u0432 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0411\u0430\u0437\u043e\u0432\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/h4>\n<p>  <code>app\/config\/config.yml<\/code><br \/>  <code>fos_user:<\/code><br \/>  <code>    db_driver: orm<\/code><br \/>   <code>firewall_name: wsse_secured<\/code><br \/>  <code>user_class: Acme\\DemoBundle\\Entity\\User<\/code><\/p>\n<p>  <code># Escape WSSE authentication configuration<\/code><br \/>  <code>escape_wsse_authentication:<\/code><br \/>   <code>authentication_provider_class: Escape\\WSSEAuthenticationBundle\\Security\\Core\\Authentication\\Provider\\Provider<\/code><br \/>   <code>authentication_listener_class: Escape\\WSSEAuthenticationBundle\\Security\\Http\\Firewall\\Listener<\/code><br \/>   <code>authentication_entry_point_class: Escape\\WSSEAuthenticationBundle\\Security\\Http\\EntryPoint\\EntryPoint<\/code><br \/>   <code>authentication_encoder_class: Symfony\\Component\\Security\\Core\\Encoder\\MessageDigestPasswordEncoder<\/code><\/p>\n<p>  <code>app\/config\/security.yml<\/code><br \/>  <code>security:<\/code><br \/>   <code>providers:<\/code><br \/>   <code>fos_userbundle:<\/code><br \/>   <code>id: fos_user.user_provider.username<\/code><br \/>   <code>encoders:<\/code><br \/>   <code>FOS\\UserBundle\\Model\\UserInterface: sha512<\/code><\/p>\n<p>  <code>firewalls:<\/code><br \/>   <code>wsse_secured:<\/code><br \/>   <code>pattern:   ^\/api\/.*<\/code><br \/>   <code>wsse:<\/code><br \/>   <code>lifetime: 300 #lifetime of nonce<\/code><br \/>   <code>realm: &quot;Secured API&quot; #identifies the set of resources to which the authentication information will apply (WWW-Authenticate)<\/code><br \/>   <code>profile: &quot;UsernameToken&quot; #WSSE profile (WWW-Authenticate)<\/code><br \/>   <code>encoder: #digest algorithm<\/code><br \/>   <code>algorithm: sha512<\/code><br \/>   <code>encodeHashAsBase64: true<\/code><br \/>   <code>iterations: 1<\/code><br \/>   <code>anonymous: true<\/code><\/p>\n<h4>\u041a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u043e\u043a\u0435\u043d\u0430 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435:<\/h4>\n<p>  <code>src\\Acme\\DemoBundle\\Controller\\SecurityController.php<\/code><br \/>  <code>\/\/...<\/code><br \/>   <code>$created = date('c');<\/code><br \/>   <code>$nonce = substr(md5(uniqid('nonce_', true)), 0, 16);<\/code><br \/>   <code>$nonceHigh = base64_encode($nonce);<\/code><br \/>   <code>$salted = $nonce . $created . $user-&gt;getPassword() . &quot;{&quot; . $user-&gt;getSalt() . &quot;}&quot;;<\/code><br \/>   <code>$passwordDigest = hash('sha512', $salted, true);<\/code><br \/>   <code>$header = &quot;UsernameToken Username=\\&quot;{$username}\\&quot;, PasswordDigest=\\&quot;{$passwordDigest}\\&quot;, Nonce=\\&quot;{$nonceHigh}\\&quot;, Created=\\&quot;{$created}\\&quot;&quot;;<\/code><br \/>   <code>$view-&gt;setHeader(&quot;Authorization&quot;, 'WSSE profile=&quot;UsernameToken&quot;');<\/code><br \/>   <code>$view-&gt;setHeader(&quot;X-WSSE&quot;, &quot;UsernameToken Username=\\&quot;{$username}\\&quot;, PasswordDigest=\\&quot;{$passwordDigest}\\&quot;, Nonce=\\&quot;{$nonceHigh}\\&quot;, Created=\\&quot;{$created}\\&quot;&quot;);<\/code><br \/>   <code>$data = array('WSSE' =&gt; $header);<\/code><br \/>  <code>\/\/...<\/code><\/p>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u043d\u043e \u0442\u0430\u043a \u043d\u0435 \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u043f\u043e\u0447\u0435\u043c\u0443. \u0412\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0435 \u043e\u0442 Escapestudios \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<p>  <code>WSSEAuthenticationBundle\/Security\/Core\/Authentication\/Provider\/Provider.php<\/code><br \/>  <code>\/\/...<\/code><br \/>   <code>\/\/validate secret<\/code><br \/>   <code>$expected = $this-&gt;encoder-&gt;encodePassword(<\/code><br \/>   <code>sprintf(<\/code><br \/>   <code>'%s%s%s',<\/code><br \/>   <code>base64_decode($nonce),<\/code><br \/>   <code>$created,<\/code><br \/>   <code>$secret<\/code><br \/>   <code>),<\/code><br \/>   <code>&quot;&quot;<\/code><br \/>   <code>);<\/code><\/p>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u044e\u0442 \u043a\u0430\u0432\u044b\u0447\u043a\u0438 \u0432 \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435, \u0435\u0441\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0438\u0445 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043b\u044c, \u0442\u043e \u0432\u0441\u0435 \u0447\u0443\u0434\u0435\u0441\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0432 \u0441\u0432\u043e\u0435\u043c \u0431\u0430\u043d\u0434\u043b\u0435 \u0438 \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u0438\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e:<\/p>\n<p>  <code>src\\Acme\\DemoBundle\\Security\\Authentication\\Provider\\WsseProvider.php<\/code><\/p>\n<p>  <code>namespace Acme\\DemoBundle\\Security\\Authentication\\Provider;<\/code><\/p>\n<p>  <code>use Escape\\WSSEAuthenticationBundle\\Security\\Core\\Authentication\\Provider\\Provider;<\/code><br \/>  <code>use Symfony\\Component\\Security\\Core\\Authentication\\Provider\\AuthenticationProviderInterface;<\/code><br \/>  <code>use Symfony\\Component\\Security\\Core\\Exception\\CredentialsExpiredException;<\/code><br \/>  <code>use Symfony\\Component\\Security\\Core\\Exception\\NonceExpiredException;<\/code><\/p>\n<p>  <code>\/**<\/code><br \/>   <code>* Class WsseProvider<\/code><br \/>   <code>* @package Acme\\DemoBundle\\Security\\Authentication\\Provider<\/code><br \/>  <code>*\/<\/code><br \/>  <code>class WsseProvider extends Provider implements AuthenticationProviderInterface<\/code><br \/>  <code>{<\/code><\/p>\n<p>  <code>\/**<\/code><br \/>   <code>* @param $user \\Symfony\\Component\\Security\\Core\\User\\UserInterface<\/code><br \/>   <code>* @param $digest<\/code><br \/>   <code>* @param $nonce<\/code><br \/>   <code>* @param $created<\/code><br \/>   <code>* @param $secret<\/code><br \/>   <code>*<\/code><br \/>   <code>* @return bool<\/code><br \/>   <code>* @throws \\Symfony\\Component\\Security\\Core\\Exception\\CredentialsExpiredException<\/code><br \/>   <code>* @throws \\Symfony\\Component\\Security\\Core\\Exception\\NonceExpiredException<\/code><br \/>   <code>*\/<\/code><br \/>   <code>protected function validateDigest($user, $digest, $nonce, $created, $secret)<\/code><br \/>   <code>{<\/code><br \/>   <code>\/\/check whether timestamp is not in the future<\/code><br \/>   <code>if (strtotime($created) &gt; time()) {<\/code><br \/>   <code>throw new CredentialsExpiredException('Future token detected.');<\/code><br \/>   <code>}<\/code><\/p>\n<p>  <code>\/\/expire timestamp after specified lifetime<\/code><br \/>   <code>if (time() - strtotime($created) &gt; $this-&gt;getLifetime()) {<\/code><br \/>   <code>throw new CredentialsExpiredException('Token has expired.');<\/code><br \/>   <code>}<\/code><\/p>\n<p>  <code>\/\/validate that nonce is unique within specified lifetime<\/code><br \/>   <code>\/\/if it is not, this could be a replay attack<\/code><br \/>   <code>if ($this-&gt;getNonceCache()-&gt;contains($nonce)) {<\/code><br \/>   <code>throw new NonceExpiredException('Previously used nonce detected.');<\/code><br \/>   <code>}<\/code><\/p>\n<p>  <code>$this-&gt;getNonceCache()-&gt;save($nonce, time(), $this-&gt;getLifetime());<\/code><\/p>\n<p>  <code>\/\/validate secret<\/code><br \/>   <code>$expected = $this-&gt;getEncoder()-&gt;encodePassword(<\/code><br \/>   <code>sprintf(<\/code><br \/>   <code>'%s%s%s',<\/code><br \/>   <code>base64_decode($nonce),<\/code><br \/>   <code>$created,<\/code><br \/>   <code>$secret<\/code><br \/>   <code>),<\/code><br \/>   <code>$user-&gt;getSalt()<\/code><br \/>   <code>);<\/code><\/p>\n<p>  <code>return $digest === $expected;<\/code><br \/>   <code>}<\/code><br \/>  <code>}<\/code><\/p>\n<p>  \u0425\u043e\u0447\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439, \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438, \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0430\u043d\u0434\u043b\u0430 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <i>nonces<\/i> \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c, \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0432\u0430\u043b\u0438\u0434\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f <i>nonce<\/i> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<br \/>  <code>app\/config\/config.yml<\/code><\/p>\n<p>  <code># Escape WSSE authentication configuration<\/code><br \/>  <code>escape_wsse_authentication:<\/code><br \/>   <code>authentication_provider_class: Acme\\DemoBundle\\Security\\Authentication\\Provider\\WsseProvider<\/code><br \/>   <code>authentication_listener_class: Escape\\WSSEAuthenticationBundle\\Security\\Http\\Firewall\\Listener<\/code><br \/>   <code>authentication_entry_point_class: Escape\\WSSEAuthenticationBundle\\Security\\Http\\EntryPoint\\EntryPoint<\/code><br \/>   <code>authentication_encoder_class: Symfony\\Component\\Security\\Core\\Encoder\\MessageDigestPasswordEncoder<\/code><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u043c \u0437\u0430\u0449\u0438\u0442\u0443.<br \/>  \u0412 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u044d\u043d\u043a\u043e\u0434\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <i>iterations<\/i>:<\/p>\n<p>  <code>app\/config\/security.yml<\/code><br \/>  <code>security:<\/code><br \/>   <code>firewalls:<\/code><br \/>   <code>wsse_secured:<\/code><br \/>   <code>wsse:<\/code><br \/>   <code>encoder: #digest algorithm<\/code><br \/>   <code>iterations: 1<\/code><\/p>\n<p>  \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438\/\u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u043e\u043a\u0435\u043d\u0430. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u0440\u0430\u0432\u0435\u043d \u00ab1\u00bb. \u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, \u043f\u0440\u0438 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u043e\u043b\u044f \u0432 Symfony2 \u043e\u043d \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u00ab5000\u00bb (Symfony\\Component\\Security\\Core\\Encoder\\MessageDigestPasswordEncoder). \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0432\u043d\u0435\u0441\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<\/p>\n<p>  <code>app\/config\/security.yml<\/code><br \/>  <code>parameters:<\/code><br \/>   <code>wsse_iterations: 300<\/code><br \/>  <code>security:<\/code><br \/>   <code>firewalls:<\/code><br \/>   <code>wsse_secured:<\/code><br \/>   <code>wsse:<\/code><br \/>   <code>encoder: #digest algorithm<\/code><br \/>   <code> iterations: %wsse_iterations%<\/code><\/p>\n<p>  <code>src\\Acme\\DemoBundle\\Controller\\SecurityController.php<\/code><br \/>  <code>\/\/...<\/code><br \/>   <code>$created = date('c');<\/code><br \/>   <code>$nonce = substr(md5(uniqid('nonce_', true)), 0, 16);<\/code><br \/>   <code>$nonceHigh = base64_encode($nonce);<\/code><br \/>   <code>$container = $this-&gt;get('service_container');<\/code><br \/>   <code>$iterations = $container-&gt;getParameter('wsse_iterations');<\/code><br \/>   <code>$salted = $nonce . $created . $user-&gt;getPassword() . &quot;{&quot; . $user-&gt;getSalt() . &quot;}&quot;;<\/code><br \/>   <code>$passwordDigest = hash('sha512', $salted, true);<\/code><br \/>   <code>for ($i = 1; $i &lt; $iterations; $i++) {<\/code><br \/>   <code>$passwordDigest = hash('sha512', $passwordDigest . $salted, true);<\/code><br \/>   <code> }<\/code><br \/>   <code>$passwordDigest = base64_encode($passwordDigest);<\/code><br \/>   <code>$header = &quot;UsernameToken Username=\\&quot;{$username}\\&quot;, PasswordDigest=\\&quot;{$passwordDigest}\\&quot;, Nonce=\\&quot;{$nonceHigh}\\&quot;, Created=\\&quot;{$created}\\&quot;&quot;;<\/code><br \/>   <code>$view-&gt;setHeader(&quot;Authorization&quot;, 'WSSE profile=&quot;UsernameToken&quot;');<\/code><br \/>   <code>$view-&gt;setHeader(<\/code><br \/>   <code>&quot;X-WSSE&quot;,<\/code><br \/>   <code>&quot;UsernameToken Username=\\&quot;{$username}\\&quot;, PasswordDigest=\\&quot;{$passwordDigest}\\&quot;, Nonce=\\&quot;{$nonceHigh}\\&quot;, Created=\\&quot;{$created}\\&quot;&quot;<\/code><br \/>   <code>);<\/code><br \/>   <code>$data = array('WSSE' =&gt; $header);<\/code><br \/>  <code>\/\/...<\/code><\/p>\n<p>  \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a \u0437\u0430\u043c\u0435\u043d\u0435 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0435, \u043e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0438\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u043e\u0436\u0435 \u0432\u043f\u043e\u043b\u043d\u0435, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043a \u043c\u0435\u0441\u0442\u0443. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/209154\/\"> http:\/\/habrahabr.ru\/post\/209154\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u043e\u043a\u0435\u043d\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 sha512. \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0443\u0437\u043a\u043e\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f, \u043d\u043e \u044f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0441\u044c \u0441 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u044f. <\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043f\u0440\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 API \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 \u043d\u0430 Symfony2 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c <a href=\"https:\/\/github.com\/FriendsOfSymfony\/FOSUserBundle\">FOSUserBundle<\/a> \u0438 <a href=\"https:\/\/github.com\/escapestudios\/EscapeWSSEAuthenticationBundle\">WSSEAuthenticationBundle<\/a> c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c <i>sha512<\/i> \u0438 \u0432\u0441\u043a\u043e\u0440\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430. \u041e\u0431 \u044d\u0442\u043e\u043c \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u0432 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-209154","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=209154"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209154\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}