{"id":302501,"date":"2020-04-25T15:00:21","date_gmt":"2020-04-25T15:00:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=302501"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=302501","title":{"rendered":"\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 \u0415\u0421\u0418\u0410 \u0434\u043b\u044f .Net: \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/499016\/\">\n<h2>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u0432 \u0434\u0430\u043b\u0435\u043a\u043e\u0439-\u0434\u0430\u043b\u0435\u043a\u043e\u0439 \u0433\u0430\u043b\u0430\u043a\u0442\u0438\u043a\u0435\u2026 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0415\u0421\u0418\u0410 \u043d\u0430 \u0413\u043e\u0441\u0423\u0441\u043b\u0443\u0433\u0430\u0445. \u0422.\u043a. \u043e\u0431\u0438\u0442\u0430\u0435\u043c \u043c\u044b \u0432 \u0433\u0430\u043b\u0430\u043a\u0442\u0438\u043a\u0435 .Net, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0431\u044b\u043b \u0438\u0437\u0443\u0447\u0435\u043d \u0432\u0435\u0441\u044c \u0433\u0443\u0433\u043e\u043b \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0441\u043c\u043e\u043b\u0435\u0442\u0430 \u0434\u0430\u0431\u044b \u043d\u0435 \u043a\u043e\u0441\u0442\u044b\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0430\u043c\u0438\u043c, \u043d\u043e \u043f\u043e\u0438\u0441\u043a\u0438 \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u043f\u0443\u0442\u043d\u043e\u043c\u0443 \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u043b\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043c\u0443 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c-\u0442\u0430\u043a\u0438 \u043a\u043e\u0441\u043c\u043e\u043b\u0435\u0442 \u0441\u0432\u043e\u0438\u043c\u0438 \u0441\u0438\u043b\u0430\u043c\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xe\/fj\/-y\/xefj-ykldoay3rfjbo2-mrkucc4.jpeg\"\/><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u0415\u0421\u0418\u0410, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/esia.pro\/\">\u044d\u0442\u0430<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/identityblitz.ru\/\">\u0432\u043e\u0442 \u044d\u0442\u0430<\/a> \u2014 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043b\u0435\u043d\u044c \u0432\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0445 \u0443\u0441\u043b\u0443\u0433\u0430\u043c\u0438. \u0421\u0430\u043c\u0438 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c, \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u043c.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u0431\u0449\u0435\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0430 <a href=\"https:\/\/digital.gov.ru\/ru\/documents\/6186\/\">\u0441\u0430\u0439\u0442\u0435 \u041c\u0438\u043d\u0438\u0441\u0442\u0435\u0440\u0441\u0442\u0432\u0430 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f&#8230;<\/a> \u041c\u0435\u0442\u043e\u0434\u0438\u0447\u043a\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u0441\u0438\u0441\u0442\u0430\u044f, \u043d\u043e \u0434\u0430\u0436\u0435 \u0438\u0437 \u043d\u0435\u0435 \u043d\u0435 \u0432\u0441\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 \u0432 \u043a\u0440\u0430\u0442\u0446\u0435, \u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0448\u0430\u0433\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<p>  <\/p>\n<ol>\n<li>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0418\u0421 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0415\u0421\u0418\u0410<\/li>\n<li>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0418\u0421 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435<\/li>\n<li>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0415\u0421\u0418\u0410<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e 3 \u043f\u0443\u043d\u043a\u0442, \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 2 \u2013 \u0431\u044e\u0440\u043e\u043a\u0440\u0430\u0442\u0438\u044f, \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0435\u0435 \u0437\u0430 \u0440\u0430\u043c\u043a\u0430\u043c\u0438 \u0425\u0430\u0431\u0440\u0430. \u0412 \u043c\u0435\u0442\u043e\u0434\u0438\u0447\u043a\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e 2 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438: SAML \u0438\u043b\u0438 OpenID Connect. <a href=\"https:\/\/habr.com\/ru\/company\/cloud4y\/blog\/344964\/\">\u0413\u043e\u0432\u043e\u0440\u044f\u0442<\/a>,  <\/p>\n<blockquote><p><b>\u0441 01.01.2018 \u0433. \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 SAML 2.0 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e<\/b> (\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c). \u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0415\u0421\u0418\u0410 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b OAuth 2.0 \/ OpenID Connect (\u0441\u0435\u0439\u0447\u0430\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043e\u0431\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430).<\/p><\/blockquote>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 <s>\u043a\u0440\u0430\u0441\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0435\u0442\u043a\u0443<\/s> \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043c\u0435\u0442\u043e\u0434\u0438\u0447\u043a\u0435, \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b-\u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab\u0412\u043e\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u0415\u0421\u0418\u0410\u00bb<\/li>\n<li>\u0421\u0438\u0441\u0442\u0435\u043c\u0430-\u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0415\u0421\u0418\u0410 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e<\/li>\n<li>\u0415\u0421\u0418\u0410 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043b\u043e\u0433\u0438\u043d\u0430-\u043f\u0430\u0440\u043e\u043b\u044f<\/li>\n<li>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0415\u0421\u0418\u0410 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u0434 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<\/ol>\n<h2>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u0415\u0421\u0418\u0410 \u043f\u043e\u0434 Windows, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u041a\u0440\u0438\u043f\u0442\u043e\u041f\u0440\u043e CSP. \u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u044d\u0442\u043e \u0432\u0441\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c \u0432 docker \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 Linux-\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u044d\u0442\u043e \u043d\u0430 \u043e\u0442\u043a\u0443\u043f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e. \u0414\u043b\u044f \u043d\u0430\u0441 \u0436\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0442\u0435\u043a\u043e\u043c \u0431\u044b\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<p>  <\/p>\n<ul>\n<li>.Net Framework 4.8<\/li>\n<li>\u041a\u0440\u0438\u043f\u0442\u043e\u041f\u0440\u043e CSP, \u041a\u0440\u0438\u043f\u0442\u043e\u041f\u0440\u043e .Net<\/li>\n<li>\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0441 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0418\u0421 \u0432 \u0440\u0435\u0435\u0441\u0442\u0440\u0435 \u0418\u0421 \u0415\u0421\u0418\u0410 (\u043d\u0430 \u043f\u0443\u043d\u043a\u0442\u0435 1 \u0438\u0437 \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u044f)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0415\u0421\u0418\u0410 \u043f\u043e \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u043c client_secret, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0442\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c 4 \u043f\u043e\u043b\u0435\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 UTF-8:<\/p>\n<p>  <\/p>\n<ul>\n<li>Scope (\u0421\u043a\u043e\u0443\u043f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u0415\u0421\u0418\u0410). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00abfullname gender email mobile usr_org\u00bb<\/li>\n<li>Timestamp (\u0422\u0435\u043a\u0443\u0449\u0438\u0435 \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u00abyyyy.MM.dd HH:mm:ss +0000\u00bb)<\/li>\n<li>ClientId (\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0418\u0421, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0415\u0421\u0418\u0410)<\/li>\n<li>State (\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a Guid.NewGuid().ToString(\u00abD\u00bb))<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"cs\">private string GetClientSecret( \tX509Certificate2 certificate,  \tstring scope,  \tstring timestamp,  \tstring clientId,  \tstring state) { \tvar signMessage = Encoding.UTF8.GetBytes($&quot;{scope}{timestamp}{clientId}{state}&quot;);  \tbyte[] encodedSignature = SignatureProvider.Sign(signMessage, certificate);   \treturn Base64UrlEncoder.Encode(encodedSignature); } <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 SignatureProvider \u2013 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430\u043c\u0438, \u043e\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f. \u0414\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0413\u041e\u0421\u0422 \u2013 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u043e\u0435.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0415\u0421\u0418\u0410 \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 1-4: \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0415\u0421\u0418\u0410 (EsiaAuthUrl). \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0440\u0435\u0434\u044b (\u0442\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432) \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 url \u2013 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u044b \u044d\u0442\u043e <code>https:\/\/esia-portal1.test.gosuslugi.ru\/aas\/oauth2\/ac<\/code>. \u041f\u043e\u043b\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">{EsiaAuthUrl}?client_id={ClientId}&scope={Scope}&response_type=code&state={State}& timestamp={Timestamp}&access_type=online&redirect_uri={RedirectUri}&client_secret={ClientSecret}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0433\u0434\u0435 RedirectUri \u2013 \u0430\u0434\u0440\u0435\u0441, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0415\u0421\u0418\u0410, \u0430 ClientSecret \u2013 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 GetClientSecret. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c URL, \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0443\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u043b\u043e\u0433\u0438\u043d-\u043f\u0430\u0440\u043e\u043b\u044c, \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u0430\u043b\u0435\u0435 \u0415\u0421\u0418\u0410 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0432\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 RedirectUri, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043a\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0415\u0421\u0418\u0410.<\/p>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/h2>\n<p>  \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0415\u0421\u0418\u0410 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c POST \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0415\u0421\u0418\u0410 (\u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0439 url \u0442\u0430\u043a\u043e\u0439: <code>https:\/\/esia-portal1.test.gosuslugi.ru\/aas\/oauth2\/te<\/code> \u2014 EsiaTokenUrl). \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0442\u0443\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u043a\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;code&quot;&gt;\u041a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430&lt;\/param&gt; \/\/\/ &lt;param name=&quot;callbackUrl&quot;&gt;\u041a\u043e\u043b\u043b\u0431\u0435\u043a \u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0430 \u043f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u0438&lt;\/param&gt; \/\/\/ &lt;param name=&quot;certificate&quot;&gt;\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432&lt;\/param&gt; \/\/\/ &lt;returns&gt;\u0422\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430&lt;\/returns&gt; public async Task&lt;EsiaAuthToken&gt; GetAccessToken( \tstring code, \tstring callbackUrl = null, \tX509Certificate2 certificate = null) { \tvar timestamp = DateTime.UtcNow.ToString(&quot;yyyy.MM.dd HH:mm:ss +0000&quot;); \tvar state = Guid.NewGuid().ToString(&quot;D&quot;);  \t\/\/ Create signature in PKCS#7 detached signature UTF-8 \tvar clientSecret = GetClientSecret( \t\tcertificate, \t\tConfiguration.Scope,\t\/\/ \u0421\u043a\u043e\u0443\u043f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \t\ttimestamp, \t\tConfiguration.ClientId,\t\/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0418\u0421 \t\tstate);  \tvar requestParams = new List&lt;KeyValuePair&lt;string, string&gt;&gt; \t{ \t\tnew KeyValuePair&lt;string, string&gt;(&quot;client_id&quot;, Configuration.ClientId), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;code&quot;, code), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;grant_type&quot;, &quot;authorization_code&quot;), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;state&quot;, state), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;scope&quot;, Configuration.Scope), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;timestamp&quot;, timestamp), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;token_type&quot;, &quot;Bearer&quot;), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;client_secret&quot;, clientSecret), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;redirect_uri&quot;, callbackUrl) \t}; \tusing (var client = new HttpClient()) \tusing (var response = await client.PostAsync(Configuration.EsiaTokenUrl, new FormUrlEncodedContent(requestParams))) \t{ \t\tresponse.EnsureSuccessStatusCode(); \t\tvar tokenResponse = await response.Content.ReadAsStringAsync();  \t\tvar token = JsonConvert.DeserializeObject&lt;EsiaAuthToken&gt;(tokenResponse);  \t\tArgument.NotNull(token?.AccessToken, &quot;\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430&quot;); \t\tArgument.Require(state == token.State, &quot;\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439&quot;);  \t\treturn token; \t} } <\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (\u043f\u043e\u043b\u0435 Configuration). \u041a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c, \u043f\u043e\u043b\u0435 code \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u0434\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u043d\u0435\u0435. \u0414\u043b\u044f \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0415\u0421\u0418\u0410 \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \/\/\/ &lt;\/summary&gt; public class EsiaAuthToken { \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u0422\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \t\/\/\/ &lt;\/summary&gt; \t[JsonProperty(&quot;access_token&quot;)] \tpublic string AccessToken { get; set; }  \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \t\/\/\/ &lt;\/summary&gt; \tpublic string State { get; set; }  \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u043e\u043a\u0435\u043d\u0435 \t\/\/\/ &lt;\/summary&gt; \tpublic EsiaAuthTokenPayload Payload \t{ \t\tget \t\t{ \t\t\tif (string.IsNullOrEmpty(AccessToken)) \t\t\t{ \t\t\t\treturn null; \t\t\t}  \t\t\tstring[] parts = AccessToken.Split('.'); \t\t\tif (parts.Length &lt; 2) \t\t\t{ \t\t\t\tthrow new System.Exception($&quot;\u041f\u0440\u0438 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0435 \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430. \u0422\u043e\u043a\u0435\u043d: {AccessToken}&quot;); \t\t\t}  \t\t\tvar payload = Encoding.UTF8.GetString(Base64UrlEncoder.Decode(parts[1])); \t\t\treturn JsonConvert.DeserializeObject&lt;EsiaAuthTokenPayload&gt;(payload); \t\t} \t} }  \/\/\/ &lt;summary&gt; \/\/\/ \u0414\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \/\/\/ &lt;\/summary&gt; public class EsiaAuthTokenPayload { \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0442\u043e\u043a\u0435\u043d\u0430 \t\/\/\/ &lt;\/summary&gt; \t[JsonProperty(&quot;urn:esia:sid&quot;)] \tpublic string TokenId { get; set; }  \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \t\/\/\/ &lt;\/summary&gt; \t[JsonProperty(&quot;urn:esia:sbj_id&quot;)] \tpublic string UserId { get; set; } } <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u0437 \u0415\u0421\u0418\u0410<\/h2>\n<p>  <\/p>\n<p>\u0418\u043c\u0435\u044f \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0438\u0437 \u0415\u0421\u0418\u0410. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0424\u0418\u041e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0435\u0433\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c GET \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 REST API \u0415\u0421\u0418\u0410, \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0443\u0440\u0430 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 url (EsiaRestUrl) \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c: <code>https:\/\/esia-portal1.test.gosuslugi.ru\/rs<\/code>. \u0422\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0441\u0430\u043c \u043a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;userId&quot;&gt;\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f&lt;\/param&gt; \/\/\/ &lt;param name=&quot;accessToken&quot;&gt;\u0422\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430&lt;\/param&gt; \/\/\/ &lt;returns&gt;\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f&lt;\/returns&gt; public async Task&lt;EsiaUser&gt; GetUser(string userId, string accessToken) { \tusing (var client = new HttpClient()) \t{ \t\tclient.DefaultRequestHeaders.Clear(); \t\tclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(&quot;Bearer&quot;, accessToken);  \t\tvar response = await client.GetStringAsync($&quot;{Configuration.EsiaRestUrl}\/prns\/{userId}?embed=(organizations)&quot;); \t\tvar user = JsonConvert.DeserializeObject&lt;EsiaUser&gt;(response); \t\tuser.Id = user.Id ?? userId;  \t\treturn user; \t} } <\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0415\u0421\u0418\u0410 \u0438 \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u2013 \u043e\u0431\u0430 \u044d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0438 \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u0424\u0418\u041e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0435\u0433\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0439. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0442\u0430\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0415\u0421\u0418\u0410:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0415\u0421\u0418\u0410 \/\/\/ &lt;\/summary&gt; public class EsiaUser { \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \t\/\/\/ &lt;\/summary&gt; \t[JsonProperty(&quot;oid&quot;)] \tpublic string Id { get; set; }  \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u0424\u0430\u043c\u0438\u043b\u0438\u044f \t\/\/\/ &lt;\/summary&gt; \t[JsonProperty(&quot;firstName&quot;)] \tpublic string FirstName { get; set; }  \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u0418\u043c\u044f \t\/\/\/ &lt;\/summary&gt; \t[JsonProperty(&quot;lastName&quot;)] \tpublic string LastName { get; set; }  \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u041e\u0442\u0447\u0435\u0441\u0442\u0432\u043e \t\/\/\/ &lt;\/summary&gt; \t[JsonProperty(&quot;middleName&quot;)] \tpublic string MiddleName { get; set; }  \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \t\/\/\/ &lt;\/summary&gt; \t[JsonProperty(&quot;trusted&quot;)] \tpublic bool Trusted { get; set; }  \t\/\/\/ &lt;summary&gt; \t\/\/\/ \u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \t\/\/\/ &lt;\/summary&gt; \t[JsonProperty(&quot;organizations&quot;)] \tpublic EsiaUserOrganizations OrganizationLinks { get; set; } }  \/\/\/ &lt;summary&gt; \/\/\/ \u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \/\/\/ &lt;\/summary&gt; public class EsiaUserOrganizations { \t[JsonProperty(&quot;elements&quot;)] \tpublic List&lt;string&gt; Links { get; set; } } <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u043c, \u0442.\u043a. \u043e\u043d \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 scope. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d. \u041f\u043e \u0441\u0443\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u043d\u0435\u0439 \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u043d\u0435\u0435. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0434 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, State \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u041d\u043e\u0432\u044b\u0439 scope \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0441\u043f\u0438\u0441\u043e\u043a scope\u2019\u043e\u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">http:\/\/esia.gosuslugi.ru\/org_shortname\/?org_oid={organizationId} http:\/\/esia.gosuslugi.ru\/ org_fullname\/?org_oid={organizationId} <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;organizationId&quot;&gt;\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438&lt;\/param&gt; \/\/\/ &lt;param name=&quot;code&quot;&gt;\u041a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0430&lt;\/param&gt; \/\/\/ &lt;param name=&quot;state&quot;&gt;\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430&lt;\/param&gt; \/\/\/ &lt;param name=&quot;callbackUrl&quot;&gt;\u041a\u043e\u043b\u043b\u0431\u0435\u043a \u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0430 \u043f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438&lt;\/param&gt; \/\/\/ &lt;param name=&quot;certificate&quot;&gt;\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432&lt;\/param&gt; \/\/\/ &lt;returns&gt;\u0422\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f&lt;\/returns&gt; public async Task&lt;EsiaAuthToken&gt; GetOrganizationAccessToken( \tstring organizationId, \tstring code, \tstring state, \tstring callbackUrl = null, \tX509Certificate2 certificate = null) { \tvar timestamp = DateTime.UtcNow.ToString(&quot;yyyy.MM.dd HH:mm:ss +0000&quot;); \tvar scope = string.Join(&quot; &quot;, Configuration.OrganizationScope.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) \t\t.Select(orgScope =&gt; $&quot;{Configuration.EsiaBaseUrl}\/{orgScope}?org_oid={organizationId}&quot;));  \t\/\/ Create signature in PKCS#7 detached signature UTF-8 \tvar clientSecret = GetClientSecret( \t\tcertificate, \t\tscope, \t\ttimestamp, \t\tConfiguration.ClientId, \t\tstate);  \tvar requestParams = new List&lt;KeyValuePair&lt;string, string&gt;&gt; \t{ \t\tnew KeyValuePair&lt;string, string&gt;(&quot;client_id&quot;, Configuration.ClientId), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;code&quot;, code), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;grant_type&quot;, &quot;client_credentials&quot;), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;state&quot;, state), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;scope&quot;, scope), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;timestamp&quot;, timestamp), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;token_type&quot;, &quot;Bearer&quot;), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;client_secret&quot;, clientSecret), \t\tnew KeyValuePair&lt;string, string&gt;(&quot;redirect_uri&quot;, callbackUrl) \t}; \tusing (var client = new HttpClient()) \tusing (var response = await client.PostAsync(Configuration.EsiaTokenUrl, new FormUrlEncodedContent(requestParams))) \t{ \t\tresponse.EnsureSuccessStatusCode(); \t\tvar tokenResponse = await response.Content.ReadAsStringAsync();  \t\tvar token = JsonConvert.DeserializeObject&lt;EsiaAuthToken&gt;(tokenResponse);  \t\tArgument.NotNull(token?.AccessToken, &quot;\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430&quot;); \t\tArgument.Require(state == token.State, &quot;\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439&quot;);  \t\treturn token; \t} } <\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0440\u0430\u043d\u0435\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \/\/\/ &lt;\/summary&gt; \/\/\/ &lt;param name=&quot;organizationLink&quot;&gt;\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e&lt;\/param&gt; \/\/\/ &lt;param name=&quot;accessToken&quot;&gt;\u0422\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430&lt;\/param&gt; \/\/\/ &lt;returns&gt;\u0414\u0430\u043d\u043d\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438&lt;\/returns&gt; public async Task&lt;EsiaOrganization&gt; GetOrganization(string organizationLink, string accessToken) { \tusing (var client = new HttpClient()) \t{ \t\tclient.DefaultRequestHeaders.Clear(); \t\tclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(&quot;Bearer&quot;, accessToken);  \t\tvar response = await client.GetStringAsync(organizationLink); \t\tvar organization = JsonConvert.DeserializeObject&lt;EsiaOrganization&gt;(response); \t\treturn organization; \t} } <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0436\u0435 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0435\u0433\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0437 \u0415\u0421\u0418\u0410 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e \u043a\u043e\u0434\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 var accessToken = await IntegrationService.GetAccessToken(request.Code, request.CallbackUrl);  \/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0438\u0437 \u0415\u0421\u0418\u0410 var user = await IntegrationService.GetUser(accessToken.Payload.UserId, accessToken.AccessToken);  \/\/ \u0415\u0441\u043b\u0438 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0435\u0441\u0442\u044c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 - \u043f\u043e\u043b\u0435\u0437\u0435\u043c \u0432 \u0415\u0421\u0418\u0410 \u0437\u0430 \u043d\u0438\u043c\u0438 if (user.OrganizationLinks?.Links?.Any() == true) { \t\/\/ \u041d\u043e\u0432\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430 - \u0447\u0438\u0441\u0442\u043e \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0439 \tvar link = user.OrganizationLinks.Links.First(); \tvar organizationId = link.Split('\/').Last(); \tvar organizationAccessToken = await IntegrationService.GetOrganizationAccessToken(organizationId, request.Code, accessToken.State, request.CallbackUrl);  \tuser.Organization = await IntegrationService.GetOrganization(link, organizationAccessToken.AccessToken); }  return user; <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0415\u0421\u0418\u0410. \u0412 \u0446\u0435\u043b\u043e\u043c, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0442\u044c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a \u0415\u0421\u0418\u0410 \u043d\u0435 \u0437\u0430\u0439\u043c\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 1 \u0434\u043d\u044f. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u044b. \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u043c\u043e\u0439 \u043f\u043e\u0441\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/499016\/\"> https:\/\/habr.com\/ru\/post\/499016\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/499016\/\">\n<h2>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u0436\u0434\u044b \u0432 \u0434\u0430\u043b\u0435\u043a\u043e\u0439-\u0434\u0430\u043b\u0435\u043a\u043e\u0439 \u0433\u0430\u043b\u0430\u043a\u0442\u0438\u043a\u0435\u2026 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0415\u0421\u0418\u0410 \u043d\u0430 \u0413\u043e\u0441\u0423\u0441\u043b\u0443\u0433\u0430\u0445. \u0422.\u043a. \u043e\u0431\u0438\u0442\u0430\u0435\u043c \u043c\u044b \u0432 \u0433\u0430\u043b\u0430\u043a\u0442\u0438\u043a\u0435 .Net, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0431\u044b\u043b \u0438\u0437\u0443\u0447\u0435\u043d \u0432\u0435\u0441\u044c \u0433\u0443\u0433\u043e\u043b \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0441\u043c\u043e\u043b\u0435\u0442\u0430 \u0434\u0430\u0431\u044b \u043d\u0435 \u043a\u043e\u0441\u0442\u044b\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0430\u043c\u0438\u043c, \u043d\u043e \u043f\u043e\u0438\u0441\u043a\u0438 \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u043f\u0443\u0442\u043d\u043e\u043c\u0443 \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u043b\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043c\u0443 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c-\u0442\u0430\u043a\u0438 \u043a\u043e\u0441\u043c\u043e\u043b\u0435\u0442 \u0441\u0432\u043e\u0438\u043c\u0438 \u0441\u0438\u043b\u0430\u043c\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xe\/fj\/-y\/xefj-ykldoay3rfjbo2-mrkucc4.jpeg\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-302501","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302501","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=302501"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302501\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=302501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=302501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=302501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}