{"id":174513,"date":"2013-03-28T11:49:04","date_gmt":"2013-03-28T07:49:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=174513"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=174513","title":{"rendered":"<span class=\"post_title\">ContactManager, \u0447\u0430\u0441\u0442\u044c 5. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 HTTPS<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c <a href=\"http:\/\/habrahabr.ru\/post\/173593\/\">\u043d\u0430\u0448 REST-\u0441\u0435\u0440\u0432\u0438\u0441<\/a> \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u043f\u043b\u0430\u0432\u0430\u043d\u0438\u0435 \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u0443\u0441\u0438\u043b\u0435\u043d\u0438\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 HTTPS. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u043e\u0432 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Tomcat 7.<\/p>\n<p>  \u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:  <\/p>\n<ul>\n<li>\u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 HTTS \u0432 Tomcat<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 HTTS \u0432 SpringSecurity<\/li>\n<li>\u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0430 \u043a\u0430\u043a \u0436\u0435 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e)<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h6>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u044e\u0447 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/h6>\n<p>  \u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 keytool \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 JRE. \u0415\u0441\u043b\u0438 JAVA_HOME \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 path, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c keytool \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>%JAVA_HOME%\/bin<\/code> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c keytool \u043e\u0442\u0442\u0443\u0434\u0430. \u0414\u043b\u044f MS Windows \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"bash\">keytool -genkey -alias ContactManager -keyalg RSA -keystore c:\/contactmanager.keystore <\/code><\/pre>\n<p>  <code>alias<\/code> \u2014 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u044e\u0447\u0430<br \/>  <code>keyalg<\/code> \u2014 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f RSA, DSA, DES<br \/>  <code>keystore<\/code> \u2014 \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043f\u0430\u0440\u043e\u043b\u044c \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u043e\u043d \u043d\u0430\u043c \u0435\u0449\u0451 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438: \u043a\u0442\u043e, \u0447\u0442\u043e, \u043e\u0442\u043a\u0443\u0434\u0430, \u0441\u0442\u0440\u0430\u043d\u0430 \u0438 \u043f\u0440\u043e\u0447. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0444\u0430\u0439\u043b \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438. \u041a\u043b\u044e\u0447 \u0433\u043e\u0442\u043e\u0432.<\/p>\n<h6>\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0422\u043e\u043c\u043a\u0430\u0442\u0430<\/h6>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>%CATALINA_HOME%\/conf\/server.xml<\/code> \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0443\u0441\u043e\u043a   <\/p>\n<pre><code class=\"xml\">    &lt;!-- Define a SSL HTTP\/1.1 Connector on port 8443          This connector uses the JSSE configuration, when using APR, the          connector should be using the OpenSSL style configuration          described in the APR documentation --&gt;     &lt;!--     &lt;Connector port=&quot;8443&quot; protocol=&quot;HTTP\/1.1&quot; SSLEnabled=&quot;true&quot;                maxThreads=&quot;150&quot; scheme=&quot;https&quot; secure=&quot;true&quot;                clientAuth=&quot;false&quot; sslProtocol=&quot;TLS&quot; \/&gt;     --&gt; <\/code><\/pre>\n<p>  \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 Connector \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430:  <\/p>\n<pre><code class=\"xml\">    &lt;Connector port=&quot;8443&quot;  \t\tSSLEnabled=&quot;true&quot; \t\tprotocol=&quot;HTTP\/1.1&quot; \t\tmaxThreads=&quot;150&quot; scheme=&quot;https&quot; secure=&quot;true&quot; \t\tkeystoreFile=&quot;c:\\contactmanager.keystore&quot; \t\tkeystorePass=&quot;password&quot; \t\tsslProtocol=&quot;TLS&quot; \/&gt; <\/code><\/pre>\n<p>  <code>keystorePass<\/code> \u2014 \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0432\u0432\u0435\u043b\u0438 \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u044e\u0447\u0430. \u0414\u0430, \u043e\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0432\u0438\u0434\u0435. \u0415\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043d\u043e \u043f\u043e\u043a\u0430 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0430\u043a. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0435, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c. \u0423\u043f\u0441\u2026   <\/p>\n<pre><code class=\"bash\">INFO: Initializing ProtocolHandler [&quot;http-apr-8080&quot;] \u043c\u0430\u0440 28, 2013 11:43:04 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler [&quot;http-apr-8443&quot;] \u043c\u0430\u0440 28, 2013 11:43:04 AM org.apache.coyote.AbstractProtocol init SEVERE: Failed to initialize end point associated with ProtocolHandler [&quot;http-apr-8443&quot;] java.lang.Exception: Connector attribute SSLCertificateFile must be defined when using SSL with APR         at org.apache.tomcat.util.net.AprEndpoint.bind(AprEndpoint.java:507)         ... <\/code><\/pre>\n<p>  \u041d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u0413\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442, \u0447\u0442\u043e <code>protocol=&quot;HTTP\/1.1&quot;<\/code> \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 <code>protocol=&quot;org.apache.coyote.http11.Http11Protocol&quot;<\/code>. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u0441\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435.  <\/p>\n<pre><code class=\"bash\">... \u043c\u0430\u0440 28, 2013 11:56:41 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler [&quot;http-apr-8080&quot;] \u043c\u0430\u0440 28, 2013 11:56:41 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler [&quot;http-bio-8443&quot;] \u043c\u0430\u0440 28, 2013 11:56:41 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler [&quot;ajp-apr-8009&quot;] \u043c\u0430\u0440 28, 2013 11:56:41 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1909 ms ... <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"https:\/\/localhost:8443\/\">https:\/\/localhost:8443\/<\/a> \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u043e \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u043d\u043e \u043c\u044b \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c, \u0436\u043c\u0435\u043c \u00ab\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u0445 \u0438 \u0440\u0438\u0441\u043a\u00bb \u0438 \u0432\u0438\u0434\u0438\u043c \u043a\u043e\u0440\u043d\u0435\u0432\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0422\u043e\u043c\u043a\u0430\u0442\u0430. <\/p>\n<h5>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c Spring Security<\/h5>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435 \u0432\u0441\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0412 \u0444\u0430\u0439\u043b\u0435 security.xml \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u0445 \u0443\u0440\u043b\u043e\u0432 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>requires-channel=&quot;https&quot;<\/code>. \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"xml\">&lt;intercept-url pattern=&quot;\/ws\/index*&quot; access=&quot;hasAnyRole('ROLE_USER','ROLE_ANONYMOUS')&quot; requires-channel=&quot;https&quot;\/&gt; &lt;intercept-url pattern=&quot;\/ws\/add*&quot; access=&quot;hasRole('ROLE_USER')&quot; requires-channel=&quot;https&quot;\/&gt; &lt;intercept-url pattern=&quot;\/ws\/delete\/*&quot; access=&quot;hasRole('ROLE_ADMIN') &quot; requires-channel=&quot;https&quot;\/&gt; <\/code><\/pre>\n<p>  <\/p>\n<h5>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c<\/h5>\n<p>  \u0420\u0435\u0441\u0443\u0440\u0441 <code>\/ws\/index<\/code> \u043c\u044b \u0442\u043e\u0436\u0435 \u0441\u043f\u0440\u044f\u0442\u0430\u043b\u0438 \u0437\u0430 <code>HTTPS<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0435\u0441\u0442 <code>index_user1()<\/code>. \u041e\u0448\u0438\u0431\u043a\u0430, \u0447\u0442\u043e, \u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e. \u0412\u043e\u043f\u0440\u043e\u0441, \u0447\u0442\u043e \u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0430\u0438 \u043a\u0430\u043a \u0435\u0451 \u0440\u0435\u0448\u0438\u0442\u044c. JUnit \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u0440\u0438\u0432\u043e\u0439 \u043e\u0442\u0432\u0435\u0442   <\/p>\n<pre><code class=\"bash\">com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input  at [Source: java.io.StringReader@1841d1d3; line: 1, column: 1] <\/code><\/pre>\n<p>  \u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u043e \u043d\u0435 \u0432 \u044d\u0442\u043e\u043c. \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0442\u0430\u043c \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u043e\u0448\u0438\u0431\u043a\u0438, 302:  <\/p>\n<pre><code class=\"bash\">... MockHttpServletResponse:               Status = 302        Error message = null              Headers = {Location=[https:\/\/localhost\/ws\/index]}         Content type = null                 Body =         Forwarded URL = null       Redirected URL = https:\/\/localhost\/ws\/index              Cookies = [] <\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c\u043e, \u043c\u044b \u043a\u0430\u043a-\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0442\u0435\u0441\u0442\u0435. \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u0432 \u0431\u0438\u043b\u0434\u0435\u0440 <a href=\"https:\/\/github.com\/SpringSource\/spring-test-mvc\/blob\/master\/src\/main\/java\/org\/springframework\/test\/web\/server\/request\/MockHttpServletRequestBuilder.java\">MockHttpServletRequestBuilder<\/a> \u0438 \u0438\u0437\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0438\u0449\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e. \u0410\u0433\u0430, \u0432\u043e\u0442 \u043e\u043d\u043e.   <\/p>\n<pre><code class=\"java\">\t\/** \t * Set the secure property of the {@link ServletRequest} indicating use of a \t * secure channel, such as HTTPS. \t * \t * @param secure whether the request is using a secure channel \t *\/ \tpublic MockHttpServletRequestBuilder secure(boolean secure){ \t\tthis.secure = secure; \t\treturn this; \t} <\/code><\/pre>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0435, \u0442\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432 \u0431\u0438\u043b\u0434\u0435\u0440\u0435  <\/p>\n<pre><code class=\"java\">\t\tdef result = mockMvc.perform(MockMvcRequestBuilders.get(&quot;\/ws\/index&quot;) \t\t\t\t.secure(true) \/\/ &lt;--------- \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 HTTPS \t\t\t\t.with(SecurityRequestPostProcessors.userDetailsService(USER1))) \t\t\t\t.andDo(MockMvcResultHandlers.print()) \t\t\t\t.andReturn() <\/code><\/pre>\n<p>  \u0423\u0440\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442! \u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 WS-\u0442\u0435\u0441\u0442\u044b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044e \u0438 \u043c\u043e\u0436\u0435\u043c \u0441\u043c\u0435\u043b\u043e \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448 REST-\u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u043e\u0432\u043d\u0435. \u041d\u043e \u044d\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e REST-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0441\u0442\u0430\u0440\u0430\u044f Form-based \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0443 \u043d\u0430\u0441 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u0430 \u0438 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u044b\u043c \u043c\u0435\u0441\u0442\u043e\u043c. \u0420\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u0427\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0451? \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443. \u041f\u043b\u044e\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0436\u0435\u0441\u0442\u043a\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0444\u0430\u0439\u043b\u0435 seciruty.xml, \u0430 \u0432\u0434\u0440\u0443\u0433 (\u0445\u043e\u0442\u044f \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u0434\u0440\u0443\u0433?) \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c? \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0432 \u0411\u0414 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0441\u0445\u0435\u043c\u0443 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 Auth Token, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442.    \t \t\t   \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\/174513\/\"> http:\/\/habrahabr.ru\/post\/174513\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c <a href=\"http:\/\/habrahabr.ru\/post\/173593\/\">\u043d\u0430\u0448 REST-\u0441\u0435\u0440\u0432\u0438\u0441<\/a> \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u043f\u043b\u0430\u0432\u0430\u043d\u0438\u0435 \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u0443\u0441\u0438\u043b\u0435\u043d\u0438\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 HTTPS. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u043e\u0432 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Tomcat 7.<\/p>\n<p>  \u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:  <\/p>\n<ul>\n<li>\u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 HTTS \u0432 Tomcat<\/li>\n<li>\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 HTTS \u0432 SpringSecurity<\/li>\n<li>\u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0430 \u043a\u0430\u043a \u0436\u0435 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e)<\/li>\n<\/ul>\n<p>  <\/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-174513","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/174513","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=174513"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/174513\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=174513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=174513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=174513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}