{"id":338448,"date":"2022-09-16T15:00:47","date_gmt":"2022-09-16T15:00:47","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338448"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338448","title":{"rendered":"<span>Oauth 2.1 spring authorization server + SPA<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0441\u0435\u043c \u0434\u043d\u044f, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0445\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0435!<\/p>\n<p>\u0414\u043e \u0441\u0435\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u044f \u044f\u0432\u043b\u044f\u043b\u0441\u044f \u043b\u0438\u0448\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u043d\u043e \u0432\u043e\u0442 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u044e \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<p>Oauth 2.1 &#8212; \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 Oauth 2.0, \u043a\u043e\u0442\u043e\u0440\u044b\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\u0441\u0451 \u0435\u0449\u0451 \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u0434\u0438\u0438 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0430. \u041d\u043e \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0443\u0436\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f. \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f <a href=\"https:\/\/habr.com\/ru\/post\/535174\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443.<\/p>\n<p>\u0418\u0437 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e, \u0438\u0437 Oauth 2.1 \u0443\u0431\u0440\u0430\u043d\u044b \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u0430:<\/p>\n<ul>\n<li>\n<p>implict<\/p>\n<\/li>\n<li>\n<p>password<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e \u0432\u0437\u0430\u043c\u0435\u043d \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 PKCE \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445.<\/p>\n<p>\u0418 \u0432\u043e\u0442 \u0445\u043e\u0447\u0443 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0432\u0430\u0448 \u0441\u0443\u0434 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043d\u0430 <a href=\"https:\/\/spring.io\/blog\/2022\/06\/20\/spring-authorization-server-0-3-1-available-now\" rel=\"noopener noreferrer nofollow\">spring authorization server<\/a> (\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\u044f 0.3.1) \u0438 SPA \u043d\u0430 Vue.js.<\/p>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"java\">@Bean     public RegisteredClientRepository registeredClientRepository() {                  RegisteredClient registeredClient = RegisteredClient.withId(UUID.randomUUID().toString())             .clientId(\"browser-client\")             .clientSecret(\"{noop}secret\")             .clientAuthenticationMethod(ClientAuthenticationMethod.NONE)             .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)             .authorizationGrantType(AuthorizationGrantType.REFRESH_TOKEN)             .redirectUri(\"http:\/\/127.0.0.1:8081\/code\")             .scope(OidcScopes.OPENID)             .scope(\"browser.read\")             .build();          return new InMemoryRegisteredClientRepository(registeredClient);     }<\/code><\/pre>\n<p>\u041d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043d\u0430\u0441 \u0432\u043e\u0442 \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430<code>        .clientAuthenticationMethod(ClientAuthenticationMethod.NONE)<\/code><\/p>\n<p>\u043e\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0442\u043e, \u043a\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 NONE, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0434\u0430\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e access_token, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e id_token, refresh_token \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">    login() {       var codeVerifier = this.generateRandomString(64);        Promise.resolve()           .then(() => {             return this.generateCodeChallenge(codeVerifier)           })           .then(function(codeChallenge) {               window.sessionStorage.setItem(\"code_verifier\", codeVerifier)                let args = new URLSearchParams({                   response_type: \"code\",                   client_id: 'browser-client',                   redirect_uri: 'http:\/\/127.0.0.1:8081\/code',                   state: '1234zyx',                   code_challenge: codeChallenge,                   code_challenge_method: 'S256',                   scope: 'openid browser.read'               });               window.location = \"http:\/\/127.0.0.1:9000\/oauth2\/authorize?\" + args;       });     },      async generateCodeChallenge(codeVerifier) {         var digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(codeVerifier));         return btoa(String.fromCharCode(...new Uint8Array(digest)))             .replace(\/=\/g, '').replace(\/\\+\/g, '-').replace(\/\\\/\/g, '_')     },      generateRandomString(length) {         var text = \"\";         var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";          for (var i = 0; i &lt; length; i++) {             text += possible.charAt(Math.floor(Math.random() * possible.length));         }          return text;     }<\/code><\/pre>\n<p>\u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c url \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u0443\u0442 \u0432\u0441\u0451 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e, \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c client_secret, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f 2 \u043f\u043e\u043b\u044f code_challenge \u0438 code_challenge_method. code_challenge &#8212; \u0430\u043b\u044c\u0444\u0430\u043d\u0443\u043c\u0435\u0440\u0438\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0438 code_challenge_method &#8212; \u043c\u0435\u0442\u043e\u0434 \u0435\u0451 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u043e\u043c\u043d\u0435\u043d\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043f\u0440\u0438 \u043e\u0431\u043c\u0435\u043d\u0435 \u043a\u043e\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 window.sessionStorage.setItem(&#171;code_verifier&#187;, codeVerifier), \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043e\u0431\u043c\u0435\u043d\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0442\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043c \u0441\u0432\u0435\u0440\u0435\u043d\u0430 \u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u043d\u0435\u0435 code_challenge \u0438 code_challenge_method. \u0412\u043e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043e\u0431\u043c\u0435\u043d \u043a\u043e\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d:<\/p>\n<pre><code class=\"javascript\">router.beforeEach((to, from, next) => {   if (to.path == '\/code' &amp;&amp; to.query.code != null) {     let formData = new FormData()     formData.append('grant_type','authorization_code')     formData.append('code',to.query.code)     formData.append('redirect_uri','http:\/\/127.0.0.1:8081\/code')     formData.append('client_id','browser-client')     formData.append('code_verifier',window.sessionStorage.getItem(\"code_verifier\"))      axios.post('http:\/\/127.0.0.1:9000\/oauth2\/token',     formData,     {       headers: {         'Content-type':'application\/url-form-encoded'       }     }     ).then(resp => {       console.log(resp.data)       window.sessionStorage.setItem(\"_a\", resp.data.access_token);     })     next({name: 'Index'})   } else {     next()   } })<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Vue.js \u0438 vue-router \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u043e\u0443\u0442\u0435\u0440. \u0418 \u0442\u0430\u043a \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0451\u043b \u0432\u044b\u0437\u043e\u0432 \u0441 \u043f\u0443\u0442\u0451\u043c \/code \u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 code, \u0440\u043e\u0443\u0442\u0435\u0440 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438\u0442, \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 \u0435\u0451 \u043d\u0430 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u043e\u0431\u043c\u0435\u043d\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d \u0438 \u0432 \u043e\u0442\u0432\u0435\u0442 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e access_token (\u0438 id_token \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d .scope(OidcScopes.OPENID) \u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0432 \u0441\u043a\u043e\u043f\u0430\u0445 \u0435\u0441\u0442\u044c scope: &#8216;openid&#8217;).<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0443 \u043d\u0430\u0441 \u043c\u0435\u0442\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC), \u0430 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043e\u0431\u043c\u0435\u043d\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a &#8216;Authorization&#8217;:&#8217;Basic &#8216;+btoa(&#8216;browser-client:secret&#8217;), \u0442\u043e \u043d\u0430\u0448 \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0440\u043e\u043c\u0435 access_token \u043c\u044b \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0438 refresh_token. \u041d\u043e \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f, \u0440\u0435\u0444\u0440\u0435\u0448 \u0442\u043e\u043a\u0435\u043d \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0442\u0430\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e.<\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/nomatter18\/oauth2.1-spring-authorization-server-vue\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0432\u0441\u0451, \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430. <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/688680\/\"> https:\/\/habr.com\/ru\/post\/688680\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0441\u0435\u043c \u0434\u043d\u044f, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0445\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0435!<\/p>\n<p>\u0414\u043e \u0441\u0435\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u044f \u044f\u0432\u043b\u044f\u043b\u0441\u044f \u043b\u0438\u0448\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u043d\u043e \u0432\u043e\u0442 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u044e \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<p>Oauth 2.1 &#8212; \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 Oauth 2.0, \u043a\u043e\u0442\u043e\u0440\u044b\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\u0441\u0451 \u0435\u0449\u0451 \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u0434\u0438\u0438 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u0430. \u041d\u043e \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0443\u0436\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f. \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f <a href=\"https:\/\/habr.com\/ru\/post\/535174\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443.<\/p>\n<p>\u0418\u0437 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e, \u0438\u0437 Oauth 2.1 \u0443\u0431\u0440\u0430\u043d\u044b \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u0430:<\/p>\n<ul>\n<li>\n<p>implict<\/p>\n<\/li>\n<li>\n<p>password<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e \u0432\u0437\u0430\u043c\u0435\u043d \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 PKCE \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445.<\/p>\n<p>\u0418 \u0432\u043e\u0442 \u0445\u043e\u0447\u0443 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0432\u0430\u0448 \u0441\u0443\u0434 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043d\u0430 <a href=\"https:\/\/spring.io\/blog\/2022\/06\/20\/spring-authorization-server-0-3-1-available-now\" rel=\"noopener noreferrer nofollow\">spring authorization server<\/a> (\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\u044f 0.3.1) \u0438 SPA \u043d\u0430 Vue.js.<\/p>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"java\">@Bean     public RegisteredClientRepository registeredClientRepository() {                  RegisteredClient registeredClient = RegisteredClient.withId(UUID.randomUUID().toString())             .clientId(\"browser-client\")             .clientSecret(\"{noop}secret\")             .clientAuthenticationMethod(ClientAuthenticationMethod.NONE)             .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)             .authorizationGrantType(AuthorizationGrantType.REFRESH_TOKEN)             .redirectUri(\"http:\/\/127.0.0.1:8081\/code\")             .scope(OidcScopes.OPENID)             .scope(\"browser.read\")             .build();          return new InMemoryRegisteredClientRepository(registeredClient);     }<\/code><\/pre>\n<p>\u041d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043d\u0430\u0441 \u0432\u043e\u0442 \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430<code>        .clientAuthenticationMethod(ClientAuthenticationMethod.NONE)<\/code><\/p>\n<p>\u043e\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0442\u043e, \u043a\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 NONE, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0434\u0430\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e access_token, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e id_token, refresh_token \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"javascript\">    login() {       var codeVerifier = this.generateRandomString(64);        Promise.resolve()           .then(() => {             return this.generateCodeChallenge(codeVerifier)           })           .then(function(codeChallenge) {               window.sessionStorage.setItem(\"code_verifier\", codeVerifier)                let args = new URLSearchParams({                   response_type: \"code\",                   client_id: 'browser-client',                   redirect_uri: 'http:\/\/127.0.0.1:8081\/code',                   state: '1234zyx',                   code_challenge: codeChallenge,                   code_challenge_method: 'S256',                   scope: 'openid browser.read'               });               window.location = \"http:\/\/127.0.0.1:9000\/oauth2\/authorize?\" + args;       });     },      async generateCodeChallenge(codeVerifier) {         var digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(codeVerifier));         return btoa(String.fromCharCode(...new Uint8Array(digest)))             .replace(\/=\/g, '').replace(\/\\+\/g, '-').replace(\/\\\/\/g, '_')     },      generateRandomString(length) {         var text = \"\";         var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";          for (var i = 0; i &lt; length; i++) {             text += possible.charAt(Math.floor(Math.random() * possible.length));         }          return text;     }<\/code><\/pre>\n<p>\u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c url \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u0443\u0442 \u0432\u0441\u0451 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e, \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c client_secret, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f 2 \u043f\u043e\u043b\u044f code_challenge \u0438 code_challenge_method. code_challenge &#8212; \u0430\u043b\u044c\u0444\u0430\u043d\u0443\u043c\u0435\u0440\u0438\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0438 code_challenge_method &#8212; \u043c\u0435\u0442\u043e\u0434 \u0435\u0451 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u043e\u043c\u043d\u0435\u043d\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043f\u0440\u0438 \u043e\u0431\u043c\u0435\u043d\u0435 \u043a\u043e\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 window.sessionStorage.setItem(&#171;code_verifier&#187;, codeVerifier), \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043e\u0431\u043c\u0435\u043d\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0442\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043c \u0441\u0432\u0435\u0440\u0435\u043d\u0430 \u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u043d\u0435\u0435 code_challenge \u0438 code_challenge_method. \u0412\u043e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043e\u0431\u043c\u0435\u043d \u043a\u043e\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d:<\/p>\n<pre><code class=\"javascript\">router.beforeEach((to, from, next) => {   if (to.path == '\/code' &amp;&amp; to.query.code != null) {     let formData = new FormData()     formData.append('grant_type','authorization_code')     formData.append('code',to.query.code)     formData.append('redirect_uri','http:\/\/127.0.0.1:8081\/code')     formData.append('client_id','browser-client')     formData.append('code_verifier',window.sessionStorage.getItem(\"code_verifier\"))      axios.post('http:\/\/127.0.0.1:9000\/oauth2\/token',     formData,     {       headers: {         'Content-type':'application\/url-form-encoded'       }     }     ).then(resp => {       console.log(resp.data)       window.sessionStorage.setItem(\"_a\", resp.data.access_token);     })     next({name: 'Index'})   } else {     next()   } })<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Vue.js \u0438 vue-router \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u043e\u0443\u0442\u0435\u0440. \u0418 \u0442\u0430\u043a \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0451\u043b \u0432\u044b\u0437\u043e\u0432 \u0441 \u043f\u0443\u0442\u0451\u043c \/code \u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 code, \u0440\u043e\u0443\u0442\u0435\u0440 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438\u0442, \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 \u0435\u0451 \u043d\u0430 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u043e\u0431\u043c\u0435\u043d\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d \u0438 \u0432 \u043e\u0442\u0432\u0435\u0442 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e access_token (\u0438 id_token \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d .scope(OidcScopes.OPENID) \u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0432 \u0441\u043a\u043e\u043f\u0430\u0445 \u0435\u0441\u0442\u044c scope: &#8216;openid&#8217;).<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0443 \u043d\u0430\u0441 \u043c\u0435\u0442\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC), \u0430 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043e\u0431\u043c\u0435\u043d\u0430 \u043a\u043e\u0434\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a &#8216;Authorization&#8217;:&#8217;Basic &#8216;+btoa(&#8216;browser-client:secret&#8217;), \u0442\u043e \u043d\u0430\u0448 \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0440\u043e\u043c\u0435 access_token \u043c\u044b \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0438 refresh_token. \u041d\u043e \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f, \u0440\u0435\u0444\u0440\u0435\u0448 \u0442\u043e\u043a\u0435\u043d \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0442\u0430\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e.<\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/nomatter18\/oauth2.1-spring-authorization-server-vue\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0432\u0441\u0451, \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0443 \u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430. <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/688680\/\"> https:\/\/habr.com\/ru\/post\/688680\/<\/a><br \/><\/br><\/br><\/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-338448","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338448","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=338448"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338448\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}