{"id":359087,"date":"2024-05-21T00:25:14","date_gmt":"2024-05-21T00:25:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=359087"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=359087","title":{"rendered":"<span>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0415\u0421\u0418\u0410<\/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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0414\u0438\u043d\u0438\u0441, \u044f \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 <a href=\"https:\/\/bftcom.com\/career\/\">\u0411\u0424\u0422-\u0425\u043e\u043b\u0434\u0438\u043d\u0433\u0435<\/a>. <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u043b\u0430\u043d \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0415\u0421\u0418\u0410. \u0422\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0435\u043c, \u043a\u0442\u043e \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e\u0431\u0440\u0430\u043b \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0438 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u043a\u043e\u0434\u0430, \u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430 GitHub.<\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0415\u0421\u0418\u0410?<\/h3>\n<p>\u0415\u0421\u0418\u0410 \u2014 \u0435\u0434\u0438\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0412 \u043d\u0435\u0439 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u2014 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438 \u044e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u0438\u0446\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0448\u043b\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0443\u0447\u0451\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. \u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0451\u043d\u043d\u0430\u044f \u0443\u0447\u0451\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0415\u0421\u0418\u0410 \u2014 \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0441\u043f\u043e\u0440\u0442, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0437\u043d\u044b\u043c \u0441\u0430\u0439\u0442\u0430\u043c, \u043f\u043e\u0440\u0442\u0430\u043b\u0430\u043c \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c.<\/p>\n<hr\/>\n<p>\u0423 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0415\u0421\u0418\u0410 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0435\u0435 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0438 \u2013 \u043e\u043d\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u043a\u0443\u0440\u0441\u0438\u0432\u043e\u043c. <strong>\u041f\u043e\u043b\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: <\/strong><a href=\"https:\/\/digital.gov.ru\/ru\/documents\/6182\/\"><strong>https:\/\/digital.gov.ru\/ru\/documents\/6182\/<\/strong><\/a><\/p>\n<hr\/>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u2013 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443.<\/p>\n<h3>1.\u00a0\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Java-\u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e48\/86f\/a32\/e4886fa321c600af72bb1d6cebd7207a.png\" width=\"801\" height=\"640\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e48\/86f\/a32\/e4886fa321c600af72bb1d6cebd7207a.png\"\/><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/705\/b0f\/7d3\/705b0f7d367c81f2b5bbe3e913a9d3f7.png\" width=\"801\" height=\"638\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/705\/b0f\/7d3\/705b0f7d367c81f2b5bbe3e913a9d3f7.png\"\/><\/figure>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u0440\u0438\u043f\u0442\u043e\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 Vipnet, \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0424\u0421\u0411 \u0420\u043e\u0441\u0441\u0438\u0438 \u043a\u0430\u043a \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0449\u0438\u0442\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438.<\/p>\n<p>\u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0441 \u0441\u0430\u0439\u0442\u0430 (<a href=\"https:\/\/infotecs.ru\/products\/vipnet-jcrypto-sdk\/\">https:\/\/infotecs.ru\/products\/vipnet-jcrypto-sdk\/<\/a>) \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u0445 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e jcr\/lib \u0432 \u043a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 build.gradle:<\/p>\n<pre><code>plugins {     id 'java'     id 'org.springframework.boot' version '2.7.15'     id 'io.spring.dependency-management' version '1.0.15.RELEASE' }  group = 'ru.habr' version = '0.0.1-SNAPSHOT'  java {     sourceCompatibility = '1.8' }  repositories {     mavenCentral() }  ext {     set('springCloudVersion', \"2021.0.8\") }  dependencies {     implementation 'org.springframework.boot:spring-boot-starter-actuator'     implementation 'org.springframework.boot:spring-boot-starter-webflux'     implementation 'org.springframework.cloud:spring-cloud-starter'     implementation 'org.springframework.cloud:spring-cloud-starter-config'     implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'     testImplementation 'org.springframework.boot:spring-boot-starter-test'     testImplementation 'io.projectreactor:reactor-test'      compileOnly 'org.projectlombok:lombok:1.18.22'     annotationProcessor 'org.projectlombok:lombok:1.18.22'      \/\/ \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e \u0413\u041e\u0421\u0422.     implementation files('jcr\/lib\/jcrypto-jca-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-ocsp-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-pkcs11-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-pkcs7-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-smime-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-ssl-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-widgets-fx-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-xmldsig-2.8.6-R42.jar') }  dependencyManagement {     imports {         mavenBom \"org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}\"     } }  tasks.named('test') {     useJUnitPlatform() } <\/code><\/pre>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0448 application.yml:<\/p>\n<pre><code>server:   port: 8081  spring:   application:     name: esia   habr:   esia:     scope: fullname birthdate gender snils id_doc email contacts kid_fullname kid_birthdate kid_gender kid_snils kid_inn kid_birth_cert_doc kid_medical_doc     clientId: CLIENT-ID     ketStorageDirectory: \/home\/esia\/eiis_keys     ketStoragePassword: password     ketFile:  pkiClient-container     host: esia-portal1.test.gosuslugi.ru     baseUrl: https:\/\/esia-portal1.test.gosuslugi.ru\/     authCodeUlr: https:\/\/esia-portal1.test.gosuslugi.ru\/aas\/oauth2\/ac     redirectUrl: http:\/\/127.0.01:8081 <\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432\u0435\u0431-\u043a\u043b\u0438\u0435\u043d\u0442\u0430:<\/p>\n<pre><code>@Configuration public class WebClientConfiguration {      @Value(\"${habr.esia.baseUrl}\")     private String baseUrl;     public static final int TIMEOUT = 1000;      @Bean     public WebClient webClientWithTimeout() {         final TcpClient tcpClient = TcpClient                 .create()                 .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, TIMEOUT)                 .doOnConnected(connection -> {                     connection.addHandlerLast(new ReadTimeoutHandler(TIMEOUT, TimeUnit.MILLISECONDS));                     connection.addHandlerLast(new WriteTimeoutHandler(TIMEOUT, TimeUnit.MILLISECONDS));                 });          return WebClient.builder()                 .baseUrl(baseUrl)                 .clientConnector(new ReactorClientHttpConnector(HttpClient.from(tcpClient)))                 .build();     } } <\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 jwt \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 JwtUtil:<\/p>\n<pre><code>@Service @Slf4j public class JwtUtil {      private ObjectMapper mapper;      @PostConstruct     public void init() {         this.mapper = new ObjectMapper();     }      public Map&lt;String, Object> getTokenData(String token) {         token = this.withoutBearerToken(token);         String[] parts = token.split(\"\\\\.\");         String payload = new String(Base64.getUrlDecoder().decode(parts[1]), StandardCharsets.UTF_8);          Map&lt;String, Object> jsonMap = new HashMap&lt;String, Object>();         try {             \/\/ convert JSON string to Map             jsonMap = this.mapper.readValue(payload,                     new TypeReference&lt;Map&lt;String, Object>>() {                     });         } catch (Exception ex) {             log.error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0442\u043e\u043a\u0435\u043d\u0430: {}\", ex.getMessage());             throw new RuntimeException(ex);         }         return jsonMap;     }      public String getUserOid(String token) {         return  String.valueOf(getTokenData(token).get(\"urn:esia:sbj_id\"));     }      public String withoutBearerToken(String token) {         if (token.startsWith(\"Bearer \")) {             return token.substring(7);         }         return token;     }      public String withBearerToken(String token) {         if (!token.startsWith(\"Bearer \")) {             return String.format(\"Bearer %s\", token);         }         return token;     } } <\/code><\/pre>\n<h3>2. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/h3>\n<h4>\u041e\u0431\u0449\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b<\/h4>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u0430.<\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u0441\u0445\u0435\u043c\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:\u00a0 \u00a0\u00a0\u00a0 <\/p>\n<ul>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043a \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0443 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u0430), \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0430\u043c \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0430\u0442\u044c \u043d\u0438 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043d\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f (authorization grant) \u0432 \u0432\u0438\u0434\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043f\u0440\u0435\u0434\u044a\u044f\u0432\u0438\u0432 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0443-\u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u043c\u0430\u0440\u043a\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441, \u043f\u0440\u0435\u0434\u044a\u044f\u0432\u043b\u044f\u044f \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0415\u0441\u043b\u0438 \u043e\u043d \u0432\u0430\u043b\u0438\u0434\u0435\u043d, \u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0432\u043d\u043e\u0432\u044c \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043c\u0430\u0440\u043a\u0435\u0440, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0440\u043e\u043a \u0435\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438\u0441\u0442\u0435\u043a, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043f\u0440\u0435\u0434\u044a\u044f\u0432\u043b\u044f\u044f \u043c\u0430\u0440\u043a\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0432\u0430 \u043d\u043e\u0432\u044b\u0445 \u043c\u0430\u0440\u043a\u0435\u0440\u0430: \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0437\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0441\u0440\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430. \u041a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u0441\u0438\u0441\u0442\u0435\u043c\u0435-\u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/790\/9ee\/c55\/7909eec55fb1ae262a9044174d8daddb.png\" width=\"473\" height=\"480\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/790\/9ee\/c55\/7909eec55fb1ae262a9044174d8daddb.png\"\/><\/figure>\n<h4>\u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 URL<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0435\u0433\u043e \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430. \u0415\u0441\u043b\u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0415\u0421\u0418\u0410, \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432 \u0415\u0421\u0418\u0410 (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0438\u043b\u0438 \u043e\u043d\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0435\u0433\u043e \u043f\u0440\u043e\u0439\u0442\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e).<\/p>\n<pre><code>public String getUrl(ServerRequest request) throws EsiaException, UnsupportedEncodingException {     ClientSecretResponse clientSecretResponse = this.getClientSecret();     String type = request.pathVariable(\"redirect\");     String timestampUrlEncoded = getTimestampUrlEncoded(clientSecretResponse);     String redirectUrlEncoded = getRedirectUrlEncoded(String.format(\"http:\/\/%s:%s\/%s\",             request.uri().getHost(),             request.uri().getPort(),             type));     UriComponentsBuilder accessTokenRequestBuilder = UriComponentsBuilder.fromHttpUrl(this.authCodeUlr)             .queryParam(\"client_id\", URLEncoder.encode(clientId, StandardCharsets.UTF_8.toString()))             .queryParam(\"response_type\", URLEncoder.encode(\"code\", StandardCharsets.UTF_8.toString()))             .queryParam(\"access_type\", URLEncoder.encode(\"offline\", StandardCharsets.UTF_8.toString()))             .queryParam(\"scope\", URLEncoder.encode(scope, StandardCharsets.UTF_8.toString()))             .queryParam(\"state\", URLEncoder.encode(clientSecretResponse.getState(), StandardCharsets.UTF_8.toString()))             .queryParam(\"client_secret\", URLEncoder.encode(clientSecretResponse.getClient_secret(), StandardCharsets.UTF_8.toString()));     String url = accessTokenRequestBuilder.toUriString();     url += \"&amp;timestamp=\" + timestampUrlEncoded;     url += \"&amp;redirect_uri=\" + redirectUrlEncoded;     return url; } <\/code><\/pre>\n<p><em>\u042d\u0442\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442:<\/em><\/p>\n<ul>\n<li>\n<p><em>&lt;client_id> \u2013 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u044b-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 (\u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0415\u0421\u0418\u0410, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;client_secret> \u2013 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PKCS#7 detached signature <br \/> \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 UTF-8 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430: scope, timestamp, clientId, state (\u0431\u0435\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439). &lt;client_secret> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 base64 url safe. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0415\u0421\u0418\u0410 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u0423\u0417 \u0441\u0438\u0441\u0442\u0435\u043c\u044b-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0415\u0421\u0418\u0410. \u0415\u0421\u0418\u0410 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 X.509 \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0413\u041e\u0421\u0422 \u0420 34.10-2012 \u0438 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0413\u041e\u0421\u0422 \u0420 34.11-2012;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;redirect_uri> \u2013 \u0441\u0441\u044b\u043b\u043a\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <br \/> \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0434\u0430\u0441\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0443;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;scope> \u2013 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0442.\u0435. \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u0430\u0432\u0430; \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u043c \u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430\u0445 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438, <br \/> \u0442\u043e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (scope) \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 http:\/\/esia.gosuslugi.ru\/org_emps (\u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438); <br \/> \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (scope) id_doc (\u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435), \u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c oid \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;response_type> \u2013 \u044d\u0442\u043e \u0442\u0438\u043f \u043e\u0442\u0432\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0415\u0421\u0418\u0410, \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 code, \u0435\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;state> \u2013 \u043d\u0430\u0431\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u0438\u0434 128-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430), \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 UUID;<\/em><\/p>\n<\/li>\n<li>\n<p>&lt;timestamp> \u2013 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 yyyy.MM.dd HH:mm:ss Z (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 2013.01.25 14:36:11 +0400), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u0438 \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0435\u043d \u0437\u0430\u043f\u0440\u043e\u0441 <br \/> \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c (&lt;state>);<\/p>\n<\/li>\n<li>\n<p>&lt;access_type> \u2013 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00aboffline\u00bb, \u0435\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f <br \/> \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0438\u00a0\u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d (\u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0440\u043a\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f); \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abonline\u00bb \u2013 \u0434\u043e\u0441\u0442\u0443\u043f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d, \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c POST \u043d\u0430 https-\u0430\u0434\u0440\u0435\u0441 \u0415\u0421\u0418\u0410 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u041e\u0434\u0438\u043d \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430 \u043e\u0434\u0438\u043d \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<pre><code>public Mono&lt;LinkedHashMap> openEsiaSession(String code, String state, ServerRequest request) throws EsiaException, IOException {     ClientSecretResponse clientSecretResponse = this.getClientSecret();     String timestampUrlEncoded = getTimestampUrlEncoded(clientSecretResponse);     String redirectUrlEncoded = getRedirectUrlEncoded(String.format(\"http:\/\/%s:%s\",             request.uri().getHost(),             request.uri().getPort()));     StringBuilder formData = new StringBuilder(\"&amp;\");     formData.append(URLEncoder.encode(\"grant_type\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(\"authorization_code\", StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"client_id\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientId, StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"code\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(code, StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"state\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientSecretResponse.getState(), StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"token_type\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(\"Bearer\", StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"scope\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(scope, StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"refresh_token\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientSecretResponse.getState(), StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"client_secret\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientSecretResponse.getClient_secret(), StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(\"timestamp\").append(\"=\").append(timestampUrlEncoded).append(\"&amp;\");     formData.append(URLEncoder.encode(\"redirect_uri\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(redirectUrlEncoded, StandardCharsets.UTF_8.toString()));          return webClient             .post()             .uri(uriBuilder ->                     uriBuilder.host(esiaHost)                             .path(\"\/aas\/oauth2\/te\")                             .build()             )             .header(\"Content-Type\", \"application\/x-www-form-urlencoded\")             .bodyValue(formData.toString())             .retrieve()             .bodyToMono(LinkedHashMap.class)             .timeout(Duration.ofMillis(30000))             .onErrorResume(e -> {                 LinkedHashMap&lt;String, Object> errorMap = new LinkedHashMap&lt;>();                 errorMap.put(\"error\", e.getMessage());                 return Mono.just(errorMap);             })             .doOnError(error -> {                 log.error(\"An error has occurred {}\", error.getMessage());                 throw new RuntimeException();             }); } <\/code><\/pre>\n<p>\u0412 \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><em>&lt;client_id> \u2013 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u044b-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 (\u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0415\u0421\u0418\u0410, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;code> \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d <br \/> \u043e\u0442 \u0415\u0421\u0418\u0410, \u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;grant_type> \u2013 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abauthorization_code\u00bb, <br \/> \u0435\u0441\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;client_secret> \u2013 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PKCS#7 detached signature <br \/> \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 UTF-8 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430: scope, timestamp, clientId, state (\u0431\u0435\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439). &lt;client_secret> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 base64 url safe. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0415\u0421\u0418\u0410 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u0423\u0417 \u0441\u0438\u0441\u0442\u0435\u043c\u044b-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0415\u0421\u0418\u0410. \u0415\u0421\u0418\u0410 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 X.509 \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0413\u041e\u0421\u0422 \u0420 34.10-2012 <br \/> \u0438 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0413\u041e\u0421\u0422 \u0420 34.11-2012;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;state> \u2013 \u043d\u0430\u0431\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u0438\u0434 128-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430), \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 UUID; \u044d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;redirect_uri> \u2013 \u0441\u0441\u044b\u043b\u043a\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <br \/> \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0434\u0430\u0441\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f (\u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430\u00a0\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;scope> \u2013 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0442.\u0435. \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 (\u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;scope_org> \u2013 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0442.\u0435. \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u0434\u043b\u044f \u044e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u0438\u0446 (\u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;timestamp> \u2013 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 yyyy.MM.dd HH:mm:ss Z (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 2013.01.25 14:36:11 +0400), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u0438 \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430, \u0432\u00a0\u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0435\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c (&lt;state>);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;token_type> \u2013 \u0442\u0438\u043f \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430, \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0415\u0421\u0418\u0410 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abBearer\u00bb. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439.<\/em><\/p>\n<p><em>\u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0448\u0435\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0442\u043e \u0415\u0421\u0418\u0410 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON:<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;access_token> \u2013 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;expires_in> \u2013 \u0432\u0440\u0435\u043c\u044f, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0441\u0442\u0435\u043a\u0430\u0435\u0442 \u0441\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0430\u0440\u043a\u0435\u0440\u0430 <br \/> (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;state> \u2013 \u043d\u0430\u0431\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u0438\u0434 128-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 UUID (\u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 <br \/> \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;token_type> \u2013 \u0442\u0438\u043f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430, \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0415\u0421\u0418\u0410 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abBearer\u00bb;<\/em><\/p>\n<p>&lt;refresh_token> \u2013 \u043c\u0430\u0440\u043a\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c client_secret<\/h4>\n<pre><code>public ClientSecretResponse getClientSecret() throws EsiaException {     try {         ZonedDateTime now = ZonedDateTime.now();         String timestamp = DateTimeFormatter.ofPattern(\"yyyy.MM.dd HH:mm:ss xx\").format(now);         String state = UUID.randomUUID().toString();         String msg = String.format(\"%s%s%s%s\", scope, timestamp, clientId, state);         byte[] messageAsByte = msg.getBytes(StandardCharsets.UTF_8);         ByteArrayOutputStream clientSecretOS = new ByteArrayOutputStream();         try (                 CMSSignedDataOutputStream signedStream = new CMSSignedDataOutputStream(clientSecretOS)) {             signedStream.addCertificates(certificate);             signedStream.addSigner(privateKey, certificate);             signedStream.write(messageAsByte, 0, messageAsByte.length);         }         byte[] utf = clientSecretOS.toByteArray();         String clientSecret = new String(Base64.getEncoder().encode(utf));         String clientSecretUrlEncoded = clientSecret.replace(\"+\", \"-\")                 .replace(\"\/\", \"_\")                 .replace(\"=\", \"\");         log.debug(\"Generated new clientSecret:\" + clientSecretUrlEncoded);         return new ClientSecretResponse(timestamp, state, scope, clientSecretUrlEncoded);     } catch (Exception error) {         throw new EsiaException(error);     } } <\/code><\/pre>\n<p><em>\u0415\u0441\u043b\u0438 \u0432 \u0445\u043e\u0434\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u043e\u0448\u0438\u0431\u043e\u043a, \u0442\u043e \u0415\u0421\u0418\u0410 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432 redirect_uri, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0432\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:<\/em><\/p>\n<ul>\n<li>\n<p><em>&lt;code> \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;state> \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 state, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 <br \/> \u043d\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e; \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e <br \/> \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 state.<\/em><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0435\u0440\u043d\u0435\u0442 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 error \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00abaccess_denied\u00bb) \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 <br \/> \u0432 redirect_uri.<\/p>\n<p><em>\u041a\u043e\u0433\u0434\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d, \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c POST \u043d\u0430 https-\u0430\u0434\u0440\u0435\u0441 \u0415\u0421\u0418\u0410 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u041e\u0434\u0438\u043d \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430 \u043e\u0434\u0438\u043d \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0412 \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f:<\/em><\/p>\n<ul>\n<li>\n<p><em>&lt;client_id> \u2013 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u044b-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 (\u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0415\u0421\u0418\u0410 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;code> \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d <br \/> \u043e\u0442 \u0415\u0421\u0418\u0410 \u0438\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;grant_type> \u2013 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abauthorization_code\u00bb, <br \/> \u0435\u0441\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;client_secret> \u2013 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PKCS#7 detached signature <br \/> \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 UTF-8 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430: scope, timestamp, clientId, state (\u0431\u0435\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439). &lt;client_secret> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 base64 url safe. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0415\u0421\u0418\u0410 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u0423\u0417 \u0441\u0438\u0441\u0442\u0435\u043c\u044b-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0415\u0421\u0418\u0410. \u0415\u0421\u0418\u0410 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 X.509 \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0413\u041e\u0421\u0422 \u0420 34.10-2012 <br \/> \u0438 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0413\u041e\u0421\u0422 \u0420 34.11-2012;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;state> \u2013 \u043d\u0430\u0431\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u0438\u0434 128-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430), \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 UUID; \u044d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;redirect_uri> \u2013 \u0441\u0441\u044b\u043b\u043a\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c <br \/> \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0434\u0430\u0441\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f (\u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430\u00a0\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;scope> \u2013 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0442.\u0435. \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 (\u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;scope_org> \u2013 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0442.\u0435. \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u0434\u043b\u044f \u044e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u0438\u0446 (\u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;timestamp> \u2013 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 yyyy.MM.dd HH:mm:ss Z (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 2013.01.25 14:36:11 +0400), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u0438 \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0430, \u0432\u00a0\u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0435\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c (&lt;state>);<\/em><\/p>\n<\/li>\n<li>\n<p>&lt;token_type> \u2013 \u0442\u0438\u043f \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430, \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0415\u0421\u0418\u0410 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abBearer\u00bb. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439.<\/p>\n<\/li>\n<\/ul>\n<pre><code>public Mono&lt;LinkedHashMap> openEsiaSession(String code, String state, ServerRequest request) throws EsiaException, IOException {     ClientSecretResponse clientSecretResponse = this.getClientSecret();     String timestampUrlEncoded = getTimestampUrlEncoded(clientSecretResponse);     String redirectUrlEncoded = getRedirectUrlEncoded(String.format(\"http:\/\/%s:%s\",             request.uri().getHost(),             request.uri().getPort()));     StringBuilder formData = new StringBuilder(\"&amp;\");     formData.append(URLEncoder.encode(\"grant_type\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(\"authorization_code\", StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"client_id\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientId, StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"code\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(code, StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"state\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientSecretResponse.getState(), StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"token_type\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(\"Bearer\", StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"scope\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(scope, StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"refresh_token\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientSecretResponse.getState(), StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"client_secret\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientSecretResponse.getClient_secret(), StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(\"timestamp\").append(\"=\").append(timestampUrlEncoded).append(\"&amp;\");     formData.append(URLEncoder.encode(\"redirect_uri\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(redirectUrlEncoded, StandardCharsets.UTF_8.toString()));      return webClient             .post()             .uri(uriBuilder ->                     uriBuilder.host(esiaHost)                             .path(\"\/aas\/oauth2\/te\")                             .build()             )             .header(\"Content-Type\", \"application\/x-www-form-urlencoded\")             .bodyValue(formData.toString())             .retrieve()             .bodyToMono(LinkedHashMap.class)             .timeout(Duration.ofMillis(30000))             .onErrorResume(e -> {                 LinkedHashMap&lt;String, Object> errorMap = new LinkedHashMap&lt;>();                 errorMap.put(\"error\", e.getMessage());                 return Mono.just(errorMap);             })             .doOnError(error -> {                 log.error(\"An error has occurred {}\", error.getMessage());                 throw new RuntimeException();             }); } <\/code><\/pre>\n<p><em>\u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0448\u0435\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0442\u043e \u0415\u0421\u0418\u0410 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON:<\/em><\/p>\n<ul>\n<li>\n<p><em>&lt;access_token> \u2013 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430;<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;expires_in> \u2013 \u0432\u0440\u0435\u043c\u044f, \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0441\u0442\u0435\u043a\u0430\u0435\u0442 \u0441\u0440\u043e\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0430\u0440\u043a\u0435\u0440\u0430 <br \/> (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;state> \u2013 \u043d\u0430\u0431\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0432\u0438\u0434 128-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 UUID (\u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 <br \/> \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;token_type> \u2013 \u0442\u0438\u043f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430, \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0415\u0421\u0418\u0410 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abBearer\u00bb;<\/em><\/p>\n<\/li>\n<li>\n<p>&lt;refresh_token> \u2013 \u043c\u0430\u0440\u043a\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<p><em>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c-\u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043d\u0435 \u0438\u0441\u0442\u0435\u043a \u043b\u0438 \u0441\u0440\u043e\u043a \u0435\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0415\u0441\u043b\u0438 \u043c\u0430\u0440\u043a\u0435\u0440 \u043f\u0440\u043e\u0441\u0440\u043e\u0447\u0435\u043d, \u0442\u043e \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a\u00a0\u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435-\u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c POST \u0432 \u0430\u0434\u0440\u0435\u0441 \u0415\u0421\u0418\u0410, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043d\u0430\u00a0\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u0430. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/em><\/p>\n<ul>\n<li>\n<p><em>&lt;refresh_token> \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u043e &lt;code>)<\/em><\/p>\n<\/li>\n<li>\n<p>&lt;grant_type> \u2013 \u0434\u043e\u043b\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abrefresh_token\u00bb, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u0430\u0440\u043a\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/p>\n<\/li>\n<\/ul>\n<pre><code>public Mono&lt;LinkedHashMap&lt;String, Object>> updateEsiaSession(String refreshToken, ParameterizedTypeReference&lt;LinkedHashMap&lt;String, Object>> typeReference, ServerRequest request) throws EsiaException, IOException {      ClientSecretResponse clientSecretResponse = this.getClientSecret();     String timestampUrlEncoded = getTimestampUrlEncoded(clientSecretResponse);      String redirectUrlEncoded = getRedirectUrlEncoded(String.format(\"http:\/\/%s:%s\",             request.uri().getHost(),             request.uri().getPort()));      StringBuilder formData = new StringBuilder(\"&amp;\");     formData.append(URLEncoder.encode(\"client_id\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientId, StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"client_secret\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientSecretResponse.getClient_secret(), StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"refresh_token\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(refreshToken, StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"scope\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(scope, StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"grant_type\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(\"refresh_token\", StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(URLEncoder.encode(\"state\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(clientSecretResponse.getState(), StandardCharsets.UTF_8.toString())).append(\"&amp;\");     formData.append(\"timestamp\").append(\"=\").append(timestampUrlEncoded).append(\"&amp;\");     formData.append(URLEncoder.encode(\"redirect_uri\", StandardCharsets.UTF_8.toString())).append(\"=\").append(URLEncoder.encode(redirectUrlEncoded, StandardCharsets.UTF_8.toString()));      return webClient             .post()             .uri(uriBuilder ->                     uriBuilder.host(esiaHost)                             .path(\"\/aas\/oauth2\/te\")                             .build()             )             .header(\"Content-Type\", \"application\/x-www-form-urlencoded\")             .bodyValue(formData.toString())             .retrieve()             .bodyToMono(typeReference)             .timeout(Duration.ofMillis(30000))             .onErrorResume(e -> {                 LinkedHashMap&lt;String, Object> errorMap = new LinkedHashMap&lt;>();                 errorMap.put(\"error\", e.getMessage());                 return Mono.just(errorMap);             })             .doOnError(error -> {                 log.error(\"An error has occurred {}\", error.getMessage());                 throw new RuntimeException();             }); } <\/code><\/pre>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON \u0438 \u0438\u043c\u0435\u0435\u0442 \u0442\u0443 \u0436\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043a\u0430\u043a \u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0412 \u044d\u0442\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0440\u043a\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<hr\/>\n<p><strong>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430 GitHub: <\/strong><a href=\"https:\/\/github.com\/saetdin\/esia\/tree\/main\"><strong>https:\/\/github.com\/saetdin\/esia\/tree\/main<\/strong><\/a><\/p>\n<hr\/>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/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\/articles\/771320\/\"> https:\/\/habr.com\/ru\/articles\/771320\/<\/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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0414\u0438\u043d\u0438\u0441, \u044f \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 <a href=\"https:\/\/bftcom.com\/career\/\">\u0411\u0424\u0422-\u0425\u043e\u043b\u0434\u0438\u043d\u0433\u0435<\/a>. <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043f\u043b\u0430\u043d \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0415\u0421\u0418\u0410. \u0422\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0435\u043c, \u043a\u0442\u043e \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e\u0431\u0440\u0430\u043b \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0438 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u043a\u043e\u0434\u0430, \u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430 GitHub.<\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0415\u0421\u0418\u0410?<\/h3>\n<p>\u0415\u0421\u0418\u0410 \u2014 \u0435\u0434\u0438\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0412 \u043d\u0435\u0439 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u2014 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438 \u044e\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043b\u0438\u0446\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0448\u043b\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0443\u0447\u0451\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. \u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0451\u043d\u043d\u0430\u044f \u0443\u0447\u0451\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0415\u0421\u0418\u0410 \u2014 \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0441\u043f\u043e\u0440\u0442, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0437\u043d\u044b\u043c \u0441\u0430\u0439\u0442\u0430\u043c, \u043f\u043e\u0440\u0442\u0430\u043b\u0430\u043c \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c.<\/p>\n<hr\/>\n<p>\u0423 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0415\u0421\u0418\u0410 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0435\u0435 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0438 \u2013 \u043e\u043d\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u043a\u0443\u0440\u0441\u0438\u0432\u043e\u043c. <strong>\u041f\u043e\u043b\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: <\/strong><a href=\"https:\/\/digital.gov.ru\/ru\/documents\/6182\/\"><strong>https:\/\/digital.gov.ru\/ru\/documents\/6182\/<\/strong><\/a><\/p>\n<hr\/>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u2013 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443.<\/p>\n<h3>1.\u00a0\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Java-\u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u0440\u0438\u043f\u0442\u043e\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 Vipnet, \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0424\u0421\u0411 \u0420\u043e\u0441\u0441\u0438\u0438 \u043a\u0430\u043a \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0449\u0438\u0442\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438.<\/p>\n<p>\u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0441 \u0441\u0430\u0439\u0442\u0430 (<a href=\"https:\/\/infotecs.ru\/products\/vipnet-jcrypto-sdk\/\">https:\/\/infotecs.ru\/products\/vipnet-jcrypto-sdk\/<\/a>) \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0438\u0445 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e jcr\/lib \u0432 \u043a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 build.gradle:<\/p>\n<pre><code>plugins {     id 'java'     id 'org.springframework.boot' version '2.7.15'     id 'io.spring.dependency-management' version '1.0.15.RELEASE' }  group = 'ru.habr' version = '0.0.1-SNAPSHOT'  java {     sourceCompatibility = '1.8' }  repositories {     mavenCentral() }  ext {     set('springCloudVersion', \"2021.0.8\") }  dependencies {     implementation 'org.springframework.boot:spring-boot-starter-actuator'     implementation 'org.springframework.boot:spring-boot-starter-webflux'     implementation 'org.springframework.cloud:spring-cloud-starter'     implementation 'org.springframework.cloud:spring-cloud-starter-config'     implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'     testImplementation 'org.springframework.boot:spring-boot-starter-test'     testImplementation 'io.projectreactor:reactor-test'      compileOnly 'org.projectlombok:lombok:1.18.22'     annotationProcessor 'org.projectlombok:lombok:1.18.22'      \/\/ \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e \u0413\u041e\u0421\u0422.     implementation files('jcr\/lib\/jcrypto-jca-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-ocsp-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-pkcs11-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-pkcs7-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-smime-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-ssl-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-widgets-fx-2.8.6-R42.jar')     implementation files('jcr\/lib\/jcrypto-xmldsig-2.8.6-R42.jar') }  dependencyManagement {     imports {         mavenBom \"org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}\"     } }  tasks.named('test') {     useJUnitPlatform() } <\/code><\/pre>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u043d\u0430\u0448 application.yml:<\/p>\n<pre><code>server:   port: 8081  spring:   application:     name: esia   habr:   esia:     scope: fullname birthdate gender snils id_doc email contacts kid_fullname kid_birthdate kid_gender kid_snils kid_inn kid_birth_cert_doc kid_medical_doc     clientId: CLIENT-ID     ketStorageDirectory: \/home\/esia\/eiis_keys     ketStoragePassword: password     ketFile:  pkiClient-container     host: esia-portal1.test.gosuslugi.ru     baseUrl: https:\/\/esia-portal1.test.gosuslugi.ru\/     authCodeUlr: https:\/\/esia-portal1.test.gosuslugi.ru\/aas\/oauth2\/ac     redirectUrl: http:\/\/127.0.01:8081 <\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432\u0435\u0431-\u043a\u043b\u0438\u0435\u043d\u0442\u0430:<\/p>\n<pre><code>@Configuration public class WebClientConfiguration {      @Value(\"${habr.esia.baseUrl}\")     private String baseUrl;     public static final int TIMEOUT = 1000;      @Bean     public WebClient webClientWithTimeout() {         final TcpClient tcpClient = TcpClient                 .create()                 .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, TIMEOUT)                 .doOnConnected(connection -> {                     connection.addHandlerLast(new ReadTimeoutHandler(TIMEOUT, TimeUnit.MILLISECONDS));                     connection.addHandlerLast(new WriteTimeoutHandler(TIMEOUT, TimeUnit.MILLISECONDS));                 });          return WebClient.builder()                 .baseUrl(baseUrl)                 .clientConnector(new ReactorClientHttpConnector(HttpClient.from(tcpClient)))                 .build();     } } <\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 jwt \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 JwtUtil:<\/p>\n<pre><code>@Service @Slf4j public class JwtUtil {      private ObjectMapper mapper;      @PostConstruct     public void init() {         this.mapper = new ObjectMapper();     }      public Map&lt;String, Object> getTokenData(String token) {         token = this.withoutBearerToken(token);         String[] parts = token.split(\"\\\\.\");         String payload = new String(Base64.getUrlDecoder().decode(parts[1]), StandardCharsets.UTF_8);          Map&lt;String, Object> jsonMap = new HashMap&lt;String, Object>();         try {             \/\/ convert JSON string to Map             jsonMap = this.mapper.readValue(payload,                     new TypeReference&lt;Map&lt;String, Object>>() {                     });         } catch (Exception ex) {             log.error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0442\u043e\u043a\u0435\u043d\u0430: {}\", ex.getMessage());             throw new RuntimeException(ex);         }         return jsonMap;     }      public String getUserOid(String token) {         return  String.valueOf(getTokenData(token).get(\"urn:esia:sbj_id\"));     }      public String withoutBearerToken(String token) {         if (token.startsWith(\"Bearer \")) {             return token.substring(7);         }         return token;     }      public String withBearerToken(String token) {         if (!token.startsWith(\"Bearer \")) {             return String.format(\"Bearer %s\", token);         }         return token;     } } <\/code><\/pre>\n<h3>2. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/h3>\n<h4>\u041e\u0431\u0449\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b<\/h4>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u0430.<\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u0441\u0445\u0435\u043c\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:\u00a0 \u00a0\u00a0\u00a0 <\/p>\n<ul>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c. \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043a \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0443 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u0430), \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0430\u043c \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0430\u0442\u044c \u043d\u0438 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043d\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f (authorization grant) \u0432 \u0432\u0438\u0434\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043f\u0440\u0435\u0434\u044a\u044f\u0432\u0438\u0432 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0443-\u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u043c\u0430\u0440\u043a\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441, \u043f\u0440\u0435\u0434\u044a\u044f\u0432\u043b\u044f\u044f \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0415\u0441\u043b\u0438 \u043e\u043d \u0432\u0430\u043b\u0438\u0434\u0435\u043d, \u0442\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0432\u043d\u043e\u0432\u044c \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043c\u0430\u0440\u043a\u0435\u0440, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0440\u043e\u043a \u0435\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438\u0441\u0442\u0435\u043a, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043f\u0440\u0435\u0434\u044a\u044f\u0432\u043b\u044f\u044f \u043c\u0430\u0440\u043a\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0432\u0430 \u043d\u043e\u0432\u044b\u0445 \u043c\u0430\u0440\u043a\u0435\u0440\u0430: \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0437\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0441\u0440\u043e\u043a\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430. \u041a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u0441\u0438\u0441\u0442\u0435\u043c\u0435-\u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0440\u043a\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<figure class=\"\"><\/figure>\n<h4>\u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 URL<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0435\u0433\u043e \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430. \u0415\u0441\u043b\u0438 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0415\u0421\u0418\u0410, \u0441\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0432 \u0415\u0421\u0418\u0410 (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0438\u043b\u0438 \u043e\u043d\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0435\u0433\u043e \u043f\u0440\u043e\u0439\u0442\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e).<\/p>\n<pre><code>public String getUrl(ServerRequest request) throws EsiaException, UnsupportedEncodingException {     ClientSecretResponse clientSecretResponse = this.getClientSecret();     String type = request.pathVariable(\"redirect\");     String timestampUrlEncoded = getTimestampUrlEncoded(clientSecretResponse);     String redirectUrlEncoded = getRedirectUrlEncoded(String.format(\"http:\/\/%s:%s\/%s\",             request.uri().getHost(),             request.uri().getPort(),             type));     UriComponentsBuilder accessTokenRequestBuilder = UriComponentsBuilder.fromHttpUrl(this.authCodeUlr)             .queryParam(\"client_id\", URLEncoder.encode(clientId, StandardCharsets.UTF_8.toString()))             .queryParam(\"response_type\", URLEncoder.encode(\"code\", StandardCharsets.UTF_8.toString()))             .queryParam(\"access_type\", URLEncoder.encode(\"offline\", StandardCharsets.UTF_8.toString()))             .queryParam(\"scope\", URLEncoder.encode(scope, StandardCharsets.UTF_8.toString()))             .queryParam(\"state\", URLEncoder.encode(clientSecretResponse.getState(), StandardCharsets.UTF_8.toString()))             .queryParam(\"client_secret\", URLEncoder.encode(clientSecretResponse.getClient_secret(), StandardCharsets.UTF_8.toString()));     String url = accessTokenRequestBuilder.toUriString();     url += \"&amp;timestamp=\" + timestampUrlEncoded;     url += \"&amp;redirect_uri=\" + redirectUrlEncoded;     return url; } <\/code><\/pre>\n<p><em>\u042d\u0442\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442:<\/em><\/p>\n<ul>\n<li>\n<p><em>&lt;client_id> \u2013 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u044b-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 (\u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0415\u0421\u0418\u0410, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u043c\u0438 \u0431\u0443\u043a\u0432\u0430\u043c\u0438);<\/em><\/p>\n<\/li>\n<li>\n<p><em>&lt;client_secret> \u2013 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 PKCS#7 detached signature <br \/> \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435<\/em><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-359087","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/359087","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=359087"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/359087\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=359087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=359087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=359087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}