{"id":292597,"date":"2019-07-26T09:05:09","date_gmt":"2019-07-26T09:05:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=292597"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=292597","title":{"rendered":"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Identity Server 4 \u0432 Net Core 3.0"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h2 id=\"vvedenie\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043c\u043e\u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 .NET \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 4.5 \u043d\u0430 .Net Core \u043f\u043e \u0441\u043b\u0443\u0447\u0430\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u0440\u0430\u0437\u0433\u0440\u0435\u0431\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043d\u0430\u043a\u043e\u043f\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u043e\u043b\u0433\u0430. \u0412\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 .NET Core 3.0, \u0442\u0430\u043a \u043a\u0430\u043a, \u0441\u0443\u0434\u044f \u043f\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u0442 Microsoft, \u0441 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u043b\u0438\u0437\u0430 \u0432\u0435\u0440\u0441\u0438\u0438 3.0, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0448\u0430\u0433\u0438 \u043f\u0440\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 legacy \u043a\u043e\u0434\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0430\u0441 \u0432 \u043d\u0435\u043c \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u043b\u0438 \u043f\u043b\u0430\u043d\u044b \u0432\u044b\u0445\u043e\u0434\u0430 EntityFramework 6.3 \u0434\u043b\u044f <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-entity-framework-6-3-preview-with-net-core-support\/\">.Net Core<\/a> \u0442.\u0435. \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043d\u0430 EF 6.2, \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u00ab\u043a\u0430\u043a \u0435\u0441\u0442\u044c\u00bb \u0432 \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0430 net core.<\/p>\n<p>  <\/p>\n<p>\u0421 \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0440\u043e\u0434\u0435, \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043e\u0434\u043d\u0430\u043a\u043e, \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043f\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0443 \u043a\u043e\u0434\u0430 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043f\u043e\u0441\u043b\u0435 \u0431\u0435\u0433\u043b\u044b\u0445 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 \u0430\u0443\u0434\u0438\u0442\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441 \u043d\u0443\u043b\u044f. \u0411\u043b\u0430\u0433\u043e, \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0447\u0430\u0441\u0442\u044c ASP NET Identity, \u0432 \u0432\u0438\u0434\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0445 \u0441\u0431\u043e\u043a\u0443 \u00ab\u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u043e\u0432\u00bb. <\/p>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0435\u0441\u043b\u0438 \u0432 security \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043d\u0435 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044b, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: \u043f\u043e\u0434\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Open Id connect \u0438 OAuth \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"http:\/\/docs.identityserver.io\/en\/latest\/\">IdentityServer4<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"problemy-i-puti-resheniya\">\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u043f\u0443\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u043c \u0434\u0430\u043d\u043e: \u0438\u043c\u0435\u0435\u0442\u0441\u044f JavaScript \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Angular (Client \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 IS4), \u043e\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e WebAPI (Resources), \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0433\u043e ASP NET Identity \u0441 \u043b\u043e\u0433\u0438\u043d\u0430\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043d\u043e\u0432\u043e (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u0441\u0435\u0445 \u0435\u0449\u0435 \u0440\u0430\u0437), \u043f\u043b\u044e\u0441 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 Windows \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 IdentityServer4. \u0422.\u0435. \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0447\u0435\u0440\u0435\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u0432 \u0434\u043e\u043c\u0435\u043d\u0435 ActiveDirectory. <\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e (\u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432) \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0440\u043e\u0439 \u0438 \u043d\u043e\u0432\u043e\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 Identity. \u041c\u044b, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 SQL \u0441\u043a\u0440\u0438\u043f\u0442, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 Identity \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e. \u0422\u0443\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0435- \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 EFMigrationsHistory, \u0435\u0441\u043b\u0438 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f EF \u0438 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c IdentityUser \u043d\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c IdentityServer4 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 Windows \u0443\u0447\u0435\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0438\u0436\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"plan-realizacii\">\u041f\u043b\u0430\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c NDA \u044f \u043d\u0435 \u0441\u0442\u0430\u043d\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u044b \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f IS4 \u0443 \u0441\u0435\u0431\u044f \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u043e\u0434\u043d\u0430\u043a\u043e, \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0441\u0430\u0439\u0442\u0435 ASP.NET Core, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u0441 \u043d\u0443\u043b\u044f, \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a\u0438\u0435 \u0448\u0430\u0433\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u044f\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0435 \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 IdentityServer4.<br \/>  \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438: <\/p>\n<p>  <\/p>\n<ul>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 ASP.Net Core \u0438 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 IdentityServer4.<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0432\u0438\u0434\u0435 Angular \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 open-id-connect google<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u0430 Windows \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438 \u0432\u0441\u0435 \u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 (IdentityServer, WebAPI, Angular \u043a\u043b\u0438\u0435\u043d\u0442) \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 IdentityServer (GrantType) \u2013 Implicit flow, \u043a\u043e\u0433\u0434\u0430 access_token \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u0441 WebAPI. <em>\u0411\u043b\u0438\u0436\u0435 \u043a \u0440\u0435\u043b\u0438\u0437\u0443, \u0441\u0443\u0434\u044f \u043f\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 ASP.NET Core, Implicit flow \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u0430 \u043d\u0430 Authorization Code + PKCE.)<\/em><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 .NET Core, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0432 \u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 preview Core 3.0 (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 3.0.100-preview7-012821).<\/p>\n<p>  <\/p>\n<h2 id=\"sozdanie-i-konfigurirovanie-web-proekta\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 web \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>  <\/p>\n<p>\u0412\u044b\u0445\u043e\u0434 IdentityServer \u0432\u0435\u0440\u0441\u0438\u0438 4, \u043e\u0437\u043d\u0430\u043c\u0435\u043d\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u043c \u0432\u044b\u043f\u0438\u043b\u0438\u0432\u0430\u043d\u0438\u0435\u043c UI \u0441 \u044d\u0442\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u043e \u0441\u0430\u043c\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u0422\u0443\u0442 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 UI \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 QuickStart UI, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/IdentityServer\/IdentityServer4.Quickstart.UI\">github<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u043c, \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c, \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 ASP NET Core Identity UI, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u041f\u041e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e web \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">dotnet new webapp -n IdentityServer4WebApp<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u0440\u043a\u0430\u0441 \u0432\u044d\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0422\u0443\u0442 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0443, \u0447\u0442\u043e \u0432 .Net Core 3.0 \u0434\u043b\u044f Identity \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0435 RazorPages, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u0442\u044f\u0436\u0435\u043b\u043e\u0432\u0435\u0441\u043d\u043e\u0433\u043e MVC.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 IdentityServer \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">dotnet add package Microsoft.AspNetCore.ApiAuthorization.IdentityServer -v 3.0.0-preview7.19365.7 dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore -v 3.0.0-preview7.19365.7 dotnet add package Microsoft.EntityFrameworkCore.Tools -v 3.0.0-preview7.19362.6 dotnet add package Microsoft.EntityFrameworkCore.Sqlite -v 3.0.0-preview7.19362.6<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u043f\u0430\u043a\u0435\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 Entity Framework \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445 \u0432 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 Identity. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u0443 SQLite.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0430\u0437\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u043c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 ApplicationUser, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0439 \u043e\u0442 <em>IdentityUser<\/em> \u0432 \u043f\u0430\u043f\u043a\u0435 Models \u0438 <em>ApplicationDbContext<\/em>, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0439 \u043e\u0442: <em>ApiAuthorizationDbContext \u0432 \u043f\u0430\u043f\u043a\u0435 Data.<\/em>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 EntityFramework \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432 \u043c\u0435\u0442\u043e\u0434 <em>ConfigureServices<\/em> \u043a\u043b\u0430\u0441\u0441\u0430 Startup:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public void ConfigureServices(IServiceCollection services) {   services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;options.UseSqlite(Configuration.GetConnectionString(\"DefaultConnection\")));     services.AddRazorPages(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 <em>appsettings.json<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"json\">\"ConnectionStrings\": {     \"DefaultConnection\": \"Data Source=data.db\"   }, <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0438 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0443\u0442 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 tool \u0434\u043b\u044f ef core (\u0434\u043b\u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e preview \u043d\u0443\u0436\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044f 3.0.0-preview7.19362.6).<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">dotnet ef migrations add Init dotnet ef database update<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0448\u0430\u0433\u0438 \u0431\u044b\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a, \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f SQLite \u0444\u0430\u0439\u043b \u0434\u0430\u043d\u043d\u044b\u0445 data.db. <\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Asp.Net Core Identity. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043d\u0435\u0441\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u044b <em>Startup. Configure<\/em> \u0438 <em>Startup.ConfigureServices<\/em>.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/Startup.ConfigureServices: services.AddDefaultIdentity&lt;ApplicationUser&gt;()                 .AddEntityFrameworkStores&lt;ApplicationDbContext&gt;();  \/\/Startup. Configure: app.UseAuthentication(); app.UseAuthorization();  app.UseEndpoints(endpoints =&gt; {     endpoints.MapRazorPages(); });<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u0438\u043c\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0430\u043c\u0438 \u043c\u044b \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f Identity.<br \/>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u0438\u0442\u044c UI, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 Pages\\Shared \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Razor view \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <em>_LoginPartial.cshtml<\/em> \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">@using IdentityServer4WebApp.Models @using Microsoft.AspNetCore.Identity @inject SignInManager&lt;ApplicationUser&gt; SignInManager @inject UserManager&lt;ApplicationUser&gt; UserManager  &lt;ul class=\"navbar-nav\"&gt;     @if (SignInManager.IsSignedIn(User))     {         &lt;li class=\"nav-item\"&gt;             &lt;a class=\"nav-link text-dark\" asp-area=\"Identity\" asp-page=\"\/Account\/Manage\/Index\" title=\"Manage\"&gt;Hello @User.Identity.Name!&lt;\/a&gt;         &lt;\/li&gt;         &lt;li class=\"nav-item\"&gt;             &lt;form class=\"form-inline\" asp-area=\"Identity\" asp-page=\"\/Account\/Logout\" asp-route-returnUrl=\"\/\"&gt;                 &lt;button type=\"submit\" class=\"nav-link btn btn-link text-dark\"&gt;Logout&lt;\/button&gt;             &lt;\/form&gt;         &lt;\/li&gt;     }     else     {         &lt;li class=\"nav-item\"&gt;             &lt;a class=\"nav-link text-dark\" asp-area=\"Identity\" asp-page=\"\/Account\/Register\"&gt;Register&lt;\/a&gt;         &lt;\/li&gt;         &lt;li class=\"nav-item\"&gt;             &lt;a class=\"nav-link text-dark\" asp-area=\"Identity\" asp-page=\"\/Account\/Login\"&gt;Login&lt;\/a&gt;         &lt;\/li&gt;     } &lt;\/ul&gt; <\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Identity \u0441\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 (\u0432\u0432\u043e\u0434 \u043b\u043e\u0433\u0438\u043d\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u044f, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0442.\u0434.)<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u043d\u043e\u0432\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u043c\u0435\u043d\u044e, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0444\u0430\u0439\u043b <em>_Layout.cshtml<\/em>, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0442\u0443\u0434\u0430 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u044d\u0442\u043e\u0433\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">                    &lt;ul class=\"navbar-nav flex-grow-1\"&gt;                         &lt;li class=\"nav-item\"&gt;                             &lt;a class=\"nav-link text-dark\" asp-area=\"\" asp-page=\"\/Index\"&gt;Home&lt;\/a&gt;                         &lt;\/li&gt;                         &lt;li class=\"nav-item\"&gt;                             &lt;a class=\"nav-link text-dark\" asp-area=\"\" asp-page=\"\/Privacy\"&gt;Privacy&lt;\/a&gt;                         &lt;\/li&gt;                     &lt;\/ul&gt;                 &lt;\/div&gt;                 &lt;partial name=\"_LoginPartial\" \/&gt; &lt;!\u2013\u2013\u0417\u0434\u0435\u0441\u044c\u2013\u2013&gt;              &lt;\/div&gt; <\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u043c\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430\u043c \u0432 \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u043c<br \/>  \u043c\u0435\u043d\u044e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435\u043c \u0438 \u043f\u0440\u043e\u0441\u044c\u0431\u043e\u0439<br \/>  \u0432\u0432\u0435\u0441\u0442\u0438 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0437\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u2013 \u0432\u0441\u0435<br \/>  \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yl\/a2\/yl\/yla2yln6zflkftldetnacko8trm.png\"><\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 IdentityServer4 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 ASP.NET Identity \u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432 OAuth2, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043d\u043e\u0432\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 <em>Startup.ConfigureServices<\/em> \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 IS4 \u043f\u043e\u0432\u0435\u0440\u0445 ASP.NET Core Identity:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">services.AddIdentityServer()     .AddApiAuthorization&lt;ApplicationUser, ApplicationDbContext&gt;();<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 AddApiAuthorization \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u0433\u043b\u0430\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0444\u0430\u0439\u043b appsettings.json. \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e IS4 \u043d\u0435 \u0442\u0430\u043a\u0438\u0435 \u0433\u0438\u0431\u043a\u0438\u0435 \u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u043a \u043d\u0435\u043a\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0447\u0435\u0440\u0435\u0437 callback.<\/p>\n<p>  <\/p>\n<p>\u200b \u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 JWT, \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">services.AddAuthentication()     .AddIdentityServerJwt();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <em>Startup.Configure<\/em> \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e \u0434\u043b\u044f<br \/>  \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a Open ID Connect.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">app.UseAuthentication(); app.UseAuthorization(); app.UseIdentityServer();\/\/&lt;-\u0421\u044e\u0434\u0430<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0447\u0438\u0442\u0430\u044e\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432<br \/>  \u0444\u0430\u0439\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <em>appsettings.json<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e<br \/>  \u0441\u0435\u043a\u0446\u0438\u044e <em>IdentityServer<\/em>.<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">\"IdentityServer\": {     \"Clients\": {       \"TestIdentityAngular\": {         \"Profile\": \"IdentityServerSPA\"       }     }   }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c TestIdentityAngular, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043c \u0431\u0443\u0434\u0443\u0449\u0435\u043c\u0443 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0444\u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439\u2013 \u044d\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f IdentityServer, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0444\u0438\u043b\u044c <em>IdentityServerSPA<\/em>, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438 \u0438\u043c\u0435\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0420\u0435\u0441\u0443\u0440\u0441 redirect_uri, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 <em>\/authentication\/login-callback<\/em>.<\/li>\n<li>\u0420\u0435\u0441\u0443\u0440\u0441 post_logout_redirect_uri, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043d\u0430 <em>\/authentication\/logout-callback.<\/em><\/li>\n<li>\u041d\u0430\u0431\u043e\u0440 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 openid, profile, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 API \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/li>\n<li>\u041d\u0430\u0431\u043e\u0440 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430 OIDC \u2014 id_token token<\/li>\n<li>GrantType \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u2013 Implicit<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u0438 \u2013 <em>SPA<\/em> (\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 IS4), <em>IdentityServerJwt<\/em> (API \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 IS4), <em>API<\/em> (\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 API).<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>ApiResources: \u043e\u0434\u0438\u043d API \u0440\u0435\u0441\u0443\u0440\u0441 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c &lt;&lt; appname&gt;&gt;API \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c properties \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 (*).<\/li>\n<li>IdentityServerResources: <em>IdentityResources.OpenId()<\/em> \u0438 <em>IdentityResources.Profile()<\/em><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, IdentityServer \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b, \u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435, \u0442\u0430\u043a \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<br \/>  \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 x509-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 \u00abKey\u00bb \u0444\u0430\u0439\u043b\u0430 <em>appsettings.Development.json<\/em>.<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">\"IdentityServer\": {     \"Key\": {       \"Type\": \"Development\"     }   }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0431\u044d\u043a\u044d\u043d\u0434, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/alexs0ff\/IdentityServer4Core3Example\/commit\/51b62e4beb5347c9ced14e0e464850bb8052ec91\">IdentityServer \u0433\u043e\u0442\u043e\u0432<\/a> \u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"realizaciya-klienta-na-angular\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 Angular<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u0448\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0435 SPA \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 Angular. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0432\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043e\u0434\u043d\u0430 \u2013 \u0434\u043b\u044f \u043d\u0435\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0435\u0440\u0441\u0438\u044f 8.1.2<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0431\u0443\u0434\u0443\u0449\u0438\u0439 \u043a\u0430\u0440\u043a\u0430\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ng new ClientApp<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u201c\u0434\u0430\u201d \u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u043e\u0443\u0442\u0438\u043d\u0433. \u0418 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0438\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0447\u0435\u0440\u0435\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 bootstrap:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">cd ClientApp ng add bootstrap<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 SPA \u0432 \u043d\u0430\u0448\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0421\u043f\u0435\u0440\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 csproj \u2013 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0430\u0448\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;PropertyGroup&gt;     &lt;TargetFramework&gt;netcoreapp3.0&lt;\/TargetFramework&gt;      &lt;TypeScriptCompileBlocked&gt;true&lt;\/TypeScriptCompileBlocked&gt;     &lt;TypeScriptToolsVersion&gt;Latest&lt;\/TypeScriptToolsVersion&gt;     &lt;IsPackable&gt;false&lt;\/IsPackable&gt;     &lt;SpaRoot&gt;ClientApp\\&lt;\/SpaRoot&gt;     &lt;DefaultItemExcludes&gt;$(DefaultItemExcludes);$(SpaRoot)node_modules\\**&lt;\/DefaultItemExcludes&gt;     &lt;BuildServerSideRenderer&gt;false&lt;\/BuildServerSideRenderer&gt;   &lt;\/PropertyGroup&gt; \u2026 &lt;ItemGroup&gt;     &lt;Content Remove=\"$(SpaRoot)**\" \/&gt;     &lt;None Remove=\"$(SpaRoot)**\" \/&gt;     &lt;None Include=\"$(SpaRoot)**\" Exclude=\"$(SpaRoot)node_modules\\**\" \/&gt;   &lt;\/ItemGroup&gt;  &lt;Target Name=\"DebugEnsureNodeEnv\" BeforeTargets=\"Build\" Condition=\" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') \"&gt;     &lt;Exec Command=\"node --version\" ContinueOnError=\"true\"&gt;       &lt;Output TaskParameter=\"ExitCode\" PropertyName=\"ErrorCode\" \/&gt;     &lt;\/Exec&gt;     &lt;Error Condition=\"'$(ErrorCode)' != '0'\" Text=\"Node.js is required to build and run this project. To continue, please install Node.js from https:\/\/nodejs.org\/, and then restart your command prompt or IDE.\" \/&gt;     &lt;Message Importance=\"high\" Text=\"Restoring dependencies using 'npm'. This may take several minutes...\" \/&gt;     &lt;Exec WorkingDirectory=\"$(SpaRoot)\" Command=\"npm install\" \/&gt;   &lt;\/Target&gt; <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 nuget \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">dotnet add package Microsoft.AspNetCore.SpaServices.Extensions -v 3.0.0-preview7.19365.7<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/Startup. ConfigureServices: services.AddSpaStaticFiles(configuration =&gt;             {                 configuration.RootPath = \"ClientApp\/dist\";             });  \/\/Startup. Configure: app.UseSpa(spa =&gt;             {                 spa.Options.SourcePath = \"ClientApp\";                  if (env.IsDevelopment())                 {                     spa.UseAngularCliServer(npmScript: \"start\");                 }             }); <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b Razor <em>Index.chtml<\/em> \u0438 <em>_ViewStart.chtml<\/em>, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b SPA.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438, \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mv\/lv\/j6\/mvlvj6_2aqcutz9t0_9eozhoxk8.png\"><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u043e\u0443\u0442\u0438\u043d\u0433, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 2<br \/>  \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ng generate component Home -t=true -s=true --skipTests=true ng generate component Data -t=true -s=true --skipTests=true<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0445 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">const routes: Routes = [   { path: '', component: HomeComponent, pathMatch: 'full' },   { path: 'data', component: DataComponent } ];<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0430\u0439\u043b app.component.html, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043f\u0443\u043d\u043a\u0442\u044b \u043c\u0435\u043d\u044e.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;header&gt;     &lt;nav class='navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3'&gt;       &lt;div class=\"container\"&gt;         &lt;a class=\"navbar-brand\" [routerLink]='[\"\/\"]'&gt;Client App&lt;\/a&gt;         &lt;div class=\"navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse\" [ngClass]='{\"show\": isExpanded}'&gt;           &lt;ul class=\"navbar-nav flex-grow\"&gt;             &lt;li class=\"nav-item\" [routerLinkActive]='[\"link-active\"]' [routerLinkActiveOptions]='{ exact: true }'&gt;               &lt;a class=\"nav-link text-dark\" [routerLink]='[\"\/\"]'&gt;Home&lt;\/a&gt;             &lt;\/li&gt;             &lt;li class=\"nav-item\" [routerLinkActive]='[\"link-active\"]'&gt;               &lt;a class=\"nav-link text-dark\" [routerLink]='[\"\/data\"]'&gt;Web api data&lt;\/a&gt;             &lt;\/li&gt;           &lt;\/ul&gt;         &lt;\/div&gt;       &lt;\/div&gt;     &lt;\/nav&gt;   &lt;\/header&gt; &lt;div style=\"text-align:center\"&gt;   &lt;h1&gt;     Welcome to {{ title }}!   &lt;\/h1&gt; &lt;\/div&gt; &lt;div class=\"router-outlet\"&gt;   &lt;router-outlet&gt;&lt;\/router-outlet&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043a\u0430\u0440\u043a\u0430\u0441\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u043a\u0435\u043d\u044b, \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0435 IdentityServer.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a\u0430\u0440\u043a\u0430\u0441\u0430 \u043d\u0430\u0448\u0435\u0433\u043e SPA \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u043c \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0437\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c OpenID Connect \u0438 OAuth. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0442 Microsoft \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0443 \u043d\u0438\u0445. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u043e\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0438\u0448\u0435\u0442\u0441\u044f, \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u0440\u0435\u043b\u0438\u0437\u0435 7 ASP.NET Core 3.0, \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0431\u0440\u0430\u0442\u044c \u043f\u043e \u0440\u0435\u043b\u0438\u0437\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0435 \u00abv3.0.0-preview7.19365.7\u00bb \u043d\u0430 <a href=\"https:\/\/github.com\/aspnet\/AspNetCore\/tree\/v3.0.0-preview7.19365.7\">github<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u043c \u043a\u043e\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <em>oidc-client<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f<br \/>  \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435<br \/>  \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c\u0438 \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438 \u0438 \u0442\u043e\u043a\u0435\u043d\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0414\u043b\u044f<br \/>  \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0435\u0439 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0430\u043a\u0435\u0442. <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">npm install oidc-client@1.8.0<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043d\u0430\u0448\u0435 SPA \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c, \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u043d\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044c ApiAuthorizationModule \u0438\u0437 \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f ASP.NET Core \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/aspnet\/AspNetCore\/tree\/v3.0.0-preview7.19365.7\/src\/ProjectTemplates\/Web.Spa.ProjectTemplates\/content\/Angular-CSharp\/ClientApp\/src\/api-authorization\">\u0432\u0441\u0435 \u0435\u0433\u043e \u0444\u0430\u0439\u043b\u044b<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f AppModule:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">@NgModule({   declarations: [     AppComponent,     HomeComponent,     DataComponent   ],   imports: [     BrowserModule,     HttpClientModule,     ApiAuthorizationModule,\/\/&lt;-\u0421\u044e\u0434\u0430     AppRoutingModule   ],   providers: [],   bootstrap: [AppComponent] }) export class AppModule { }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432 \u043c\u0435\u043d\u044e \u0432 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <em>app-login-menu<\/em>,<br \/>  \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0432\u0430\u0448\u0438\u043c\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c<br \/>  \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0435\u0433\u043e \u0432 \u0441\u0435\u043a\u0446\u0438\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f <em>app.component.html<\/em>.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 API \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f OpenID connect \u043a\u043b\u0438\u0435\u043d\u0442\u0430 SPA \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 endpoint \u0432 \u0431\u044d\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b<br \/>  \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0418\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c ID \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 appsettings.json \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 IdentityServer:Clients, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e TestIdentityAngular, \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043d\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 api-authorization.constants.ts.<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 OidcConfigurationController, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">    [ApiController]     public class OidcConfigurationController: ControllerBase     {         private readonly IClientRequestParametersProvider _clientRequestParametersProvider;          public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider)         {             _clientRequestParametersProvider = clientRequestParametersProvider;         }          [HttpGet(\"_configuration\/{clientId}\")]         public IActionResult GetClientRequestParameters([FromRoute]string clientId)         {             var parameters = _clientRequestParametersProvider.GetClientParameters(HttpContext, clientId);             return Ok(parameters);         }     }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 API \u0442\u043e\u0447\u0435\u043a \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u044d\u043a\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/Startup.ConfigureServices: services.AddControllers();\/\/&lt;- \u0421\u044e\u0434\u0430 services.AddRazorPages();  \/\/Startup. Configure: app.UseEndpoints(endpoints =&gt;             {                 endpoints.MapRazorPages();                 endpoints.MapControllers();             }); <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u043c\u0435\u043d\u044e \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0434\u0432\u0430 \u043f\u0443\u043d\u043a\u0442\u0430 \u2013 <em>Login<\/em> \u0438 <em>Register<\/em>. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435. \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">{     \"authority\": \"https:\/\/localhost:44367\",     \"client_id\": \"TestIdentityAngular\",     \"redirect_uri\": \"https:\/\/localhost:44367\/authentication\/login-callback\",     \"post_logout_redirect_uri\": \"https:\/\/localhost:44367\/authentication\/logout-callback\",     \"response_type\": \"id_token token\",     \"scope\": \"IdentityServer4WebAppAPI openid profile\" }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u0440\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c id \u0442\u043e\u043a\u0435\u043d \u0438 \u0442\u043e\u043a\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u043d \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 API.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u043b\u0438 \u0436\u0435 \u043c\u044b \u0432\u044b\u0431\u0435\u0440\u0435\u043c \u043f\u0443\u043d\u043a\u0442 \u043c\u0435\u043d\u044e <em>Login<\/em>, \u043d\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043d\u0430\u0448\u0435\u0433\u043e IdentityServer4 \u0438 \u0442\u0443\u0442 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0432\u0435\u0441\u0442\u0438 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b, \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u043a\u0438\u043d\u0443\u0442\u044b \u043d\u0430\u0437\u0430\u0434 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442 <em>id_token<\/em> \u0438 <em>access_token<\/em>. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u043d\u0438\u0436\u0435, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 app-login-menu \u0441\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b, \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c, \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043b \u00ab\u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435\u00bb, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 \u0434\u043b\u044f <em>Logout<\/em>. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cr\/l-\/aa\/crl-aa3ehwgdjybwkmb7nbg92pk.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u00ab\u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u00bb, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 backstage \u0432\u0441\u0435 \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 OIDC\/OAuth. \u042d\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u044e\u0449\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435<br \/>  \u0447\u0435\u0440\u0435\u0437 endpoint <em>.well-known\/openid-configuration<\/em> \u0438 pooling \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0441\u0441\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0447\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 connect\/checksession. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u043c\u043e\u0434\u0443\u043b\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u00ab\u0442\u0438\u0445\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432\u00bb, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u0438\u0441\u0442\u0435\u043a\u0430\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0448\u0430\u0433\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0441\u043a\u0440\u044b\u0442\u043e\u043c iframe. \u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <em>includeIdTokenInSilentRenew<\/em> \u0440\u0430\u0432\u043d\u044b\u043c \u00abfalse\u00bb \u0432 \u0444\u0430\u0439\u043b\u0435 <em>authorize.service.ts<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0435\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 SPA \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c API \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c \u043d\u0430 \u0431\u044d\u043a\u0435. \u0412 \u0446\u0435\u043b\u044f\u0445 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e API \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0435 Models \u043a\u043b\u0430\u0441\u0441 <em>ExchangeRateItem,<\/em> \u0430 \u0442\u0430\u043a \u0436\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432 \u043f\u0430\u043f\u043a\u0435 Controller, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/Controller:     [ApiController]     public class ExchangeRateController     {         private static readonly string[] Currencies = new[]         {             \"EUR\", \"USD\", \"BGN\", \"AUD\", \"CNY\", \"TWD\", \"NZD\", \"TND\", \"UAH\", \"UYU\", \"MAD\"         };          [HttpGet(\"api\/rates\")]         public IEnumerable&lt;ExchangeRateItem&gt; Get()         {             var rng = new Random();             return Enumerable.Range(1, 5).Select(index =&gt; new ExchangeRateItem             {                 FromCurrency = \"RUR\",                 ToCurrency = Currencies[rng.Next(Currencies.Length)],                 Value = Math.Round(1.0+ 1.0\/rng.Next(1, 100),2)                 })                 .ToArray();         }     }  \/\/Models: public class ExchangeRateItem     {         public string FromCurrency { get; set; }          public string ToCurrency { get; set; }          public double Value { get; set; }     } <\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c<br \/>  \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043a\u0443\u0440\u0441\u0430\u043c \u0432\u0430\u043b\u044e\u0442 \u0438\u0437 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ng generate component ExchangeRate -t=true -s=true --skipTests=true<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">import { Component, OnInit, Input } from '@angular\/core'; import { HttpClient } from '@angular\/common\/http'; import { Observable, of, Subject } from 'rxjs'; import { catchError } from 'rxjs\/operators';  @Component({   selector: 'app-exchange-rate',   template: ` &lt;div class=\"alert alert-danger\" *ngIf=\"errorMessage | async as msg\"&gt;   {{msg}} &lt;\/div&gt; &lt;table class='table table-striped'&gt;   &lt;thead&gt;   &lt;tr&gt;     &lt;th&gt;From currency&lt;\/th&gt;     &lt;th&gt;To currency&lt;\/th&gt;     &lt;th&gt;Rate&lt;\/th&gt;       &lt;\/tr&gt;   &lt;\/thead&gt;   &lt;tbody&gt;   &lt;tr *ngFor=\"let rate of rates | async\"&gt;     &lt;td&gt;{{ rate.fromCurrency }} &lt;\/td&gt;     &lt;td&gt;{{ rate.toCurrency }}&lt;\/td&gt;     &lt;td&gt;{{ rate.value }}&lt;\/td&gt;   &lt;\/tr&gt;   &lt;\/tbody&gt; &lt;\/table&gt;    `,   styles: [] }) export class ExchangeRateComponent implements OnInit {   public rates: Observable&lt;ExchangeRateItem[]&gt;;    public errorMessage: Subject&lt;string&gt;;    @Input() public apiUrl: string;    constructor(private http: HttpClient) {     this.errorMessage = new Subject&lt;string&gt;();   }    ngOnInit() {     this.rates = this.http.get&lt;ExchangeRateItem[]&gt;(\"\/api\/\"+this.apiUrl).pipe(catchError(this.handleError(this.errorMessage)) );   }    private handleError(subject: Subject&lt;string&gt;): (te:any) =&gt; Observable&lt;ExchangeRateItem[]&gt; {     return (error) =&gt; {       let message = '';       if (error.error instanceof ErrorEvent) {         message = `Error: ${error.error.message}`;       } else {         message = `Error Code: ${error.status}\\nMessage: ${error.message}`;       }       subject.next(message);       let emptyResult: ExchangeRateItem[] = [];       return of(emptyResult);     }   } }  interface ExchangeRateItem {   fromCurrency: string;   toCurrency: string;   value: number; }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 app-data, \u043f\u0440\u043e\u0441\u0442\u043e \u0432 template \u0437\u0430\u043f\u0438\u0441\u0430\u0432 \u0441\u0442\u0440\u043e\u043a\u0443 &lt;app-exchange-rate apiUrl=\u00abrates\u00bb&gt;&lt;\/app-exchange-rate&gt;\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043d\u043e\u0432\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442. \u041c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043f\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u043c\u0443 \u043f\u0443\u0442\u0438, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0432\u044b\u0432\u0435\u043b \u0438\u0445 \u0432 \u0432\u0438\u0434\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 <em>ExchangeRateController<\/em> \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <em>[Authorize]<\/em> \u0438 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c SPA, \u043e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0441\u043d\u043e\u0432\u0430 \u043d\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0430\u0448\u0435 API, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443, \u0447\u0442\u043e \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u0445 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fo\/kv\/ov\/fokvovvxneeouxy0k30wuvlwj4u.png\"><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u043e\u043a\u0435\u043d\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e<br \/>  \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c Angular \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0447\u0438\u043a\u043e\u0432 Interceptors. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0442\u0438\u043f, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">providers: [     { provide: HTTP_INTERCEPTORS, useClass: AuthorizeInterceptor, multi: true }   ],<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u0448\u0430\u0433\u043e\u0432 \u0432\u0441\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0415\u0441\u043b\u0438 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0435\u043d \u043d\u043e\u0432\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 Bearer access_token. \u041d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d IdentityServer \u0438 \u043e\u043d \u0436\u0435 \u0434\u0430\u0441\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u0437\u043e\u0432 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 API.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e \u043e\u0431\u043c\u0435\u043d\u043d\u044b\u043c \u043a\u0443\u0440\u0441\u0430\u043c \u0432 SPA \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c Guard \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438, \u043e\u043d \u043d\u0435 \u0434\u0430\u0441\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u044b. \u0414\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u0449\u0438\u0442\u043d\u0438\u043a \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0440\u0430\u043d\u0435\u0435 \u043c\u043e\u0434\u0443\u043b\u0435, \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0432\u0435\u0441\u0438\u0442\u044c \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{ path: 'data', component: DataComponent, canActivate: [AuthorizeGuard]  }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0437\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u043b\u0441\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 \u0432\u044b\u0431\u0440\u0430\u043b \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0435\u0433\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0431\u0440\u043e\u0441\u0438\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u043f\u0440\u043e\u0441\u044c\u0431\u043e\u0439 \u0432\u0432\u0435\u0441\u0442\u0438 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c. \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/alexs0ff\/IdentityServer4Core3Example\/commit\/36ce262ef84c0105adc0a28ddf3877c7678b3bfb\">github<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"podklyuchenie-vneshnego-vhoda-v-sistemu-cherez-postavschika-google\">\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0432\u0445\u043e\u0434\u0430 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 Google<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 Google \u0434\u043b\u044f ASP.NET core 1.1\/2.0+ \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 Nuget \u043f\u0430\u043a\u0435\u0442 Microsoft.AspNetCore.Authentication.Google, \u043e\u0434\u043d\u0430\u043a\u043e, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0435 \u0441\u0430\u043c\u043e\u0439 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0446\u0438\u0438, \u0443 Microsoft \u0435\u0441\u0442\u044c \u043f\u043b\u0430\u043d\u044b \u0434\u043b\u044f ASP.NET Core 3.0+ \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u044c \u0435\u0433\u043e <a href=\"https:\/\/github.com\/aspnet\/AspNetCore\/issues\/6486\">\u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c<\/a>. \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <em>OpenIdConnectExtensions<\/em> \u0438 <em>AddOpenIdConnect<\/em>, \u0435\u0433\u043e \u043c\u044b \u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 OpenIdConnect:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">dotnet add package Microsoft.AspNetCore.Authentication.OpenIdConnect -v 3.0.0-preview7.19365.7<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0432\u0430 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 Google \u2013 Id Client \u0438 Client Secret, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/developers.google.com\/identity\/sign-in\/web\/sign-in#before_you_begin\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab CONFIGURE A PROJECT\u00bb.<\/li>\n<li>\u0412 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u0434\u0438\u0430\u043b\u043e\u0433\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c Web server.<\/li>\n<li>\u0414\u0430\u043b\u0435\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435 \u00abAuthorized redirect URI\u00bb \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0430 Google (\u0442.\u043a. \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u0430\u0439\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"https:\/\/localhost:44301\/\">https:\/\/localhost:44301\/<\/a>, \u0442\u043e \u043c\u044b \u0442\u0443\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c <a href=\"https:\/\/localhost:44301\/signin-google\">https:\/\/localhost:44301\/signin-google<\/a>)<\/li>\n<li>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0441\u0442\u0435\u0440 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ClientID \u0438 Client Secret.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u0439\u0442 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u043c \u043e\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c URL \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/aspnet\/AspNetCore.Docs\/blob\/master\/aspnetcore\/security\/app-secrets.md\">Secret Manager<\/a>. \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">dotnet user-secrets init dotnet user-secrets set \"Authentication:Google:ClientId\" \"\u0414\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c ClientID\" dotnet user-secrets set \"Authentication:Google:ClientSecret\" \"\u0414\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c ClientSecret\"<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u043d\u0435\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 Google.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">services.AddAuthentication()                 .AddOpenIdConnect(\"Google\", \"Google\",                     o =&gt;                     {                         IConfigurationSection googleAuthNSection =                             Configuration.GetSection(\"Authentication:Google\");                         o.ClientId = googleAuthNSection[\"ClientId\"];                         o.ClientSecret = googleAuthNSection[\"ClientSecret\"];                         o.Authority = \"https:\/\/accounts.google.com\";                         o.ResponseType = OpenIdConnectResponseType.Code;                         o.CallbackPath = \"\/signin-google\";                      })                 .AddIdentityServerJwt();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u043c <a href=\"https:\/\/github.com\/alexs0ff\/IdentityServer4Core3Example\/commit\/6795d097a6da83baad8a79823eb50206237081ab\">\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442<\/a> \u0438 \u0437\u0430\u0439\u0442\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043b\u043e\u0433\u0438\u043d\u0430, \u0442\u0430\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f<br \/>  \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u043e \u0432\u0445\u043e\u0434\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u044b Google. \u041c\u043e\u0436\u043d\u043e \u0435\u0433\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 \u0441\u043d\u043e\u0432\u0430 \u043d\u0430 SPA \u0438 \u0442\u0430\u043c \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043a\u0443\u0440\u0441\u043e\u0432 \u0432\u0430\u043b\u044e\u0442.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xi\/rl\/5h\/xirl5hobkgfaukb4wzp5sibosj4.png\"><\/p>\n<p>  <\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0448\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 OAuth \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043f\u0440\u0438\u0447\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a Nuget \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0441\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e <a href=\"https:\/\/www.nuget.org\/packages?q=owners%3Aaspnet-contrib+title%3AOAuth\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>. <\/p>\n<p>  <\/p>\n<h2 id=\"dorabotka-vozmozhnosti-vhoda-pod-polzovatelyami-windows\">\u0414\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u0445\u043e\u0434\u0430 \u043f\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 Windows<\/h2>\n<p>  <\/p>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 SPA \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0438\u043d\u0442\u0440\u0430\u0441\u0435\u0442\u044f\u0445 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c Microsoft, \u043c\u043e\u0436\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0445\u043e\u0434 \u043f\u043e\u0434 \u0443\u0447\u0435\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 ActiveDirectory. \u0412 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 Html \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0442\u0438\u043f\u0430 ASP.NET, WebForms \u0438 \u0442.\u0434., \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e Windows \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043a\u043e\u0434\u0435 \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 WindowsIdentity, \u043e\u0434\u043d\u0430\u043a\u043e, \u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0422\u0443\u0442 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0447\u044c Identity Server, \u043c\u044b \u0435\u043c\u0443 \u043c\u043e\u0436\u0435\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 Windows, \u043a\u0430\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u043b \u0432 claims <em>id_token<\/em> \u0438 <em>access_token<\/em>. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 IS4 \u0443\u0436\u0435 \u043d\u0430\u0441 \u0441\u043d\u0430\u0431\u0434\u0438\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c, \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e<br \/>  \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/damienbod\/AspNetCoreWindowsAuth\">github<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043d\u0430\u0448\u0438 \u043d\u0443\u0436\u0434\u044b \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 ASP.NET Core Identity 3.0.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 Identity, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0442\u044f\u043d\u0435\u043c Razor \u0448\u0430\u0431\u043b\u043e\u043d\u044b <em>Login<\/em> \u0438 <em>ExternalLogin<\/em> \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 (\u0443\u0442\u0438\u043b\u0438\u0442\u0430 CLI aspnet-codegenerator \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">dotnet add package Microsoft.EntityFrameworkCore.SqlServer dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design  dotnet aspnet-codegenerator identity -dc IdentityServer4WebApp.Data.ApplicationDbContext --files \"Account.Login;Account.ExternalLogin\"<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f Area \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <em>Identity<\/em> \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0432\u043d\u0443\u0442\u0440\u0438, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u044b \u0438 \u0432\u043d\u0435\u0441\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043b\u0441\u044f \u0432 \u043c\u0435\u043d\u044e \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u0445\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Identity \u0431\u0435\u0440\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437 I<em>AuthenticationSchemeProvider. GetAllSchemesAsync()<\/em> \u043f\u043e \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0443 DisplayName != null, \u0430 \u0432\u043e\u0442 \u0443 Windows \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e DisplayName = null. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c LoginModel \u0438 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <em>OnGetAsync<\/em> \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); \/\/ &lt;&lt;\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430&gt;&gt; ExternalLogins =(await _schemeProvider.GetAllSchemesAsync()).Where(x =&gt; x.DisplayName != null ||(x.Name.Equals(IISDefaults.AuthenticationScheme,StringComparison.OrdinalIgnoreCase))).ToList();<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441 \u044d\u0442\u0438\u043c \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 <em>private readonly<\/em> <em>AuthenticationSchemeProvider _schemeProvider<\/em>. \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u043e View \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 <em>Login.cshtml<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;button type=\"submit\" class=\"btn btn-primary\" name=\"provider\" value=\"@provider.Name\" title=\"Log in using your @provider.DisplayName account\"&gt;@provider.DisplayName&lt;\/button&gt; &lt;&lt;\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430&gt;&gt; &lt;button type=\"submit\" class=\"btn btn-primary\" name=\"provider\" value=\"@provider.Name\" title=\"Log in using your @(provider.DisplayName ??provider.Name) account\"&gt;@(provider.DisplayName ??provider.Name)&lt;\/button&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c windows \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 <em>launchSettings.json<\/em><br \/>  (\u043f\u0440\u0438 \u0434\u0435\u043f\u043b\u043e\u0435 \u043d\u0430 IIS, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 <em>web.config<\/em>).<\/p>\n<p>  <\/p>\n<pre><code class=\"json\"> \"iisSettings\": {     \"windowsAuthentication\": true,      \"anonymousAuthentication\": true,     \"iisExpress\": {       \"applicationUrl\": \"http:\/\/localhost:15479\",       \"sslPort\": 44301     }   },<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 \u00abWindows\u00bb \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/e_\/6s\/-m\/e_6s-m8ot5h52dv6dgvid8bgpky.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 SPA \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0441 IdentityServer \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u0435\u043c\u00bb \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <em>[AllowAnonymous]<\/em> \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b <em>LoginModel<\/em> \u043d\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <em>[Authorize(AuthenticationSchemes = &#171;Windows&#187;)]<\/em>, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c WindowsIdentity. <\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <em>ExternalLogin<\/em>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0430 Identity \u0441\u043c\u043e\u0433\u043b\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c Windows \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <em>ProcessWindowsLoginAsync<\/em>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">private async Task&lt;IActionResult&gt; ProcessWindowsLoginAsync(string returnUrl)         {             var result = await HttpContext.AuthenticateAsync(IISDefaults.AuthenticationScheme);             if (result?.Principal is WindowsPrincipal wp)             {                 var redirectUrl = Url.Page(\".\/ExternalLogin\", pageHandler: \"Callback\", values: new { returnUrl });                  var props = _signInManager.ConfigureExternalAuthenticationProperties(IISDefaults.AuthenticationScheme, redirectUrl);                 props.Items[\"scheme\"] = IISDefaults.AuthenticationScheme;                  var id = new ClaimsIdentity(IISDefaults.AuthenticationScheme);                 id.AddClaim(new Claim(JwtClaimTypes.Subject, wp.Identity.Name));                 id.AddClaim(new Claim(JwtClaimTypes.Name, wp.Identity.Name));                 id.AddClaim(new Claim(ClaimTypes.NameIdentifier, wp.Identity.Name));                  var wi = wp.Identity as WindowsIdentity;                 var groups = wi.Groups.Translate(typeof(NTAccount));                 var hasUsersGroup = groups.Any(i =&gt; i.Value.Contains(@\"BUILTIN\\Users\", StringComparison.OrdinalIgnoreCase));                  id.AddClaim(new Claim(\"hasUsersGroup\", hasUsersGroup.ToString()));                  await HttpContext.SignInAsync(IdentityConstants.ExternalScheme, new ClaimsPrincipal(id), props);                  return Redirect(props.RedirectUri);             }              return Challenge(IISDefaults.AuthenticationScheme);         }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043b\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <em>ExternalLoginModel.OnPost<\/em> \u043d\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">if (IISDefaults.AuthenticationScheme == provider)             {                 return await ProcessWindowsLoginAsync(returnUrl);             }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 Claim \u0434\u043b\u044f Windows \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043e\u0434\u0438\u043d \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 Claim \u00abhasUsersGroup\u00bb, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0431\u044b\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0442\u043e\u043a\u0435\u043d\u0430\u0445 ID \u0438 access, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u043c\u0438 ASP.NET Identity \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0435\u0433\u043e \u0432 UserClaims. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <em>ExternalLoginModel<\/em>.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private async Task UpdateClaims(ExternalLoginInfo info, ApplicationUser user, params string[] claimTypes)         {             if (claimTypes == null)             {                 return;             }              var claimTypesHash = new HashSet&lt;string&gt;(claimTypes);              var claims = (await _userManager.GetClaimsAsync(user)).Where(c =&gt; claimTypesHash.Contains(c.Type)).ToList();              await _userManager.RemoveClaimsAsync(user, claims);              foreach (var claimType in claimTypes)             {                 if (info.Principal.HasClaim(c =&gt; c.Type == claimType))                 {                     claims = info.Principal.FindAll(claimType).ToList();                     await _userManager.AddClaimsAsync(user, claims);                 }             }         }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u044b\u0437\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434 <em>OnPostConfirmationAsync<\/em> (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u043e\u043c\u0435\u043d\u0442<br \/>  \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u0445\u043e\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443).<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">result = await _userManager.AddLoginAsync(user, info);                     if (result.Succeeded)                     {                         await _signInManager.SignInAsync(user, isPersistent: false);                         _logger.LogInformation(\"User created an account using {Name} provider.\", info.LoginProvider);                          await UpdateClaims(info, user, \"hasUsersGroup\");\/\/\u0421\u044e\u0434\u0430                          return LocalRedirect(returnUrl);                     }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0432 \u043c\u0435\u0442\u043e\u0434 <em>OnGetCallbackAsync<\/em>, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0432\u0445\u043e\u0434\u0430\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">var result = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false, bypassTwoFactor : true);             if (result.Succeeded)             {                 var user = await _userManager.FindByLoginAsync(info.LoginProvider, info.ProviderKey);                  await UpdateClaims(info, user, \"hasUsersGroup\");\/\/\u0421\u044e\u0434\u0430<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 WebAPI \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u043b\u0438\u0447\u0438\u044f<br \/>  \u043a\u043b\u0435\u0439\u043c\u0430 \u00abhasUsersGroup\u00bb. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u00abShouldHasUsersGroup\u00bb<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">services.AddAuthorization(options =&gt;             {                 options.AddPolicy(\"ShouldHasUsersGroup\", policy =&gt; { policy.RequireClaim(\"hasUsersGroup\");});             });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 <em>ExchangeRateController<\/em> \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c<br \/>  \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e Policy.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">        [Authorize(Policy = \"ShouldHasUsersGroup\")]         [HttpGet(\"api\/internalrates\")]         public IEnumerable&lt;ExchangeRateItem&gt; GetInternalRates()         {             return Get().Select(i=&gt;{i.Value=Math.Round(i.Value-0.02,2);return i;});         }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 view \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ng generate component InternalData -t=true -s=true --skipTests=true<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043c\u0435\u043d\u0438\u043c \u0432 \u043d\u0435\u043c template \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043c\u0435\u043d\u044e.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">\/\/internal-data.component.ts: template: `&lt;app-exchange-rate apiUrl=\"internalrates\"&gt;&lt;\/app-exchange-rate&gt; `,  \/\/app-routing.module.ts: { path: ' internaldata', component: InternalDataComponent, canActivate: [AuthorizeGuard]  }  \/\/app.component.html: &lt;li class=\"nav-item\" [routerLinkActive]='[\"link-active\"]'&gt;               &lt;a class=\"nav-link text-dark\" [routerLink]='[\"\/internaldata\"]'&gt;Internal api data&lt;\/a&gt;             &lt;\/li&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u043d\u043e\u0432\u043e\u0439<br \/>  \u0441\u0441\u044b\u043b\u043a\u0435, \u043e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0430\u043c \u043e\u0448\u0438\u0431\u043a\u0443. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e accsee_token \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442<br \/>  \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 claim \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <em>hasUsersGroup<\/em>, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043a\u043b\u0435\u0439\u043c\u044b<br \/>  \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e ApiResources \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438, \u0442\u0430\u043a\u043e\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0444\u0430\u0439\u043b <em>appsettings.json<\/em>, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c \u043f\u0443\u0442\u0435\u043c \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <em>Startup. ConfigureServices<\/em>.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">services.AddIdentityServer()                 .AddApiAuthorization&lt;ApplicationUser, ApplicationDbContext&gt;(options =&gt;                 {                     var apiResource = options.ApiResources.First();                     apiResource.UserClaims = new[] { \"hasUsersGroup\" };                 });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0437\u0430\u043d\u043e\u0432\u043e \u0437\u0430\u0439\u0442\u0438 \u043f\u043e\u0434 windows \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435, \u0442\u043e \u043d\u043e\u0432\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435.<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0442\u0440\u0438\u0445 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u2013 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c Guard \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f claim \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00abhasUsersGroup\u00bb \u0434\u043b\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u043a \u00ab\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u043e\u0431\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u043a\u0443\u0440\u0441\u0443\u00bb. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c Guard \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ng generate guard AuthorizeWindowsGroupGuard --skipTests=true<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0432\u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0430\u043c \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">import { Injectable } from '@angular\/core'; import { Observable } from 'rxjs'; import { map,tap} from 'rxjs\/operators'; import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router, UrlTree } from '@angular\/router'; import { AuthorizeService } from \".\/authorize.service\"; import { ApplicationPaths, QueryParameterNames } from '.\/api-authorization.constants';  @Injectable({   providedIn: 'root' }) export class AuthorizeWindowsGroupGuardGuard implements CanActivate{   constructor(private authorize: AuthorizeService, private router: Router) {}    canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable&lt;boolean | UrlTree&gt; |                                                                           Promise&lt;boolean | UrlTree&gt; |                                                                           boolean |     UrlTree {     return this.authorize.getUser().pipe(map((u: any) =&gt; !!u &amp;&amp; !!u.hasUsersGroup)).pipe(tap((isAuthorized:boolean) =&gt; this.handleAuthorization(isAuthorized, state)));;   }    private handleAuthorization(isAuthenticated: boolean, state: RouterStateSnapshot) {     if (!isAuthenticated) {       window.location.href = \"\/Identity\/Account\/Login?\" + QueryParameterNames.ReturnUrl + \"=\/\";     }   } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0418, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{ path: 'internaldata', component: InternalDataComponent, canActivate: [AuthorizeWindowsGroupGuardGuard]  <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0448\u0435\u043c\u0443 IdentityServer, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u043f\u043e\u043c\u0438\u043c\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 claims (<em>sub<\/em>, <em>profile<\/em>), \u0435\u0449\u0435 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u00abhasUsersGroup\u00bb. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e IdentityResource, \u043e\u043f\u044f\u0442\u044c-\u0442\u0430\u043a\u0438 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f IdentityResources \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u044f\u0432\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0434 \u0432 <em>Startup.ConfigureServices<\/em>.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">  var identityResource = new IdentityResource                     {                         Name = \"customprofile\",                         DisplayName = \"Custom profile\",                         UserClaims = new[] { \"hasUsersGroup\" },                     };                    identityResource.Properties.Add(ApplicationProfilesPropertyNames.Clients, \"*\");                     options.IdentityResources.Add(identityResource); <\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e <a href=\"https:\/\/github.com\/alexs0ff\/IdentityServer4Core3Example\/commit\/0d2736573379d2ef528b0ab9b01d7631c8a58760\">\u043c\u044b \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u0438<\/a> \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c windows \u0438 \u043f\u0440\u043e\u0439\u0442\u0438 \u043f\u043e \u00ab\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u043a\u0443\u0440\u0441\u0430\u043c\u00bb \u0432 \u043c\u0435\u043d\u044e SPA \u2013 \u0432\u0441\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c\u0441\u044f, \u0430 \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 Guard \u043f\u0435\u0440\u0435\u0431\u0440\u043e\u0441\u0438\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 ASP.NET Core 3.0 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043b\u0438 \u043e\u0433\u0440\u043e\u043c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044e \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 IdentityServer4, \u0447\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043b\u0435\u0433\u043a\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u041f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 preview \u0432\u0435\u0440\u0441\u0438\u0438, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0435\u0449\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 <a href=\"https:\/\/github.com\/alexs0ff\/IdentityServer4Core3Example\">github<\/a> \u0432 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438.<\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/461433\/\"> https:\/\/habr.com\/ru\/post\/461433\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h2 id=\"vvedenie\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043c\u043e\u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 .NET \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 4.5 \u043d\u0430 .Net Core \u043f\u043e \u0441\u043b\u0443\u0447\u0430\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u0440\u0430\u0437\u0433\u0440\u0435\u0431\u0430\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043d\u0430\u043a\u043e\u043f\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u043e\u043b\u0433\u0430. \u0412\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 .NET Core 3.0, \u0442\u0430\u043a \u043a\u0430\u043a, \u0441\u0443\u0434\u044f \u043f\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u0442 Microsoft, \u0441 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u043b\u0438\u0437\u0430 \u0432\u0435\u0440\u0441\u0438\u0438 3.0, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0448\u0430\u0433\u0438 \u043f\u0440\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 legacy \u043a\u043e\u0434\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0430\u0441 \u0432 \u043d\u0435\u043c \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u043b\u0438 \u043f\u043b\u0430\u043d\u044b \u0432\u044b\u0445\u043e\u0434\u0430 EntityFramework 6.3 \u0434\u043b\u044f <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-entity-framework-6-3-preview-with-net-core-support\/\">.Net Core<\/a> \u0442.\u0435. \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043d\u0430 EF 6.2, \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u00ab\u043a\u0430\u043a \u0435\u0441\u0442\u044c\u00bb \u0432 \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0430 net core.<\/p>\n<p>  <\/p>\n<p>\u0421 \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0440\u043e\u0434\u0435, \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043e\u0434\u043d\u0430\u043a\u043e, \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043f\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0443 \u043a\u043e\u0434\u0430 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043f\u043e\u0441\u043b\u0435 \u0431\u0435\u0433\u043b\u044b\u0445 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 \u0430\u0443\u0434\u0438\u0442\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441 \u043d\u0443\u043b\u044f. \u0411\u043b\u0430\u0433\u043e, \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0447\u0430\u0441\u0442\u044c ASP NET Identity, \u0432 \u0432\u0438\u0434\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0445 \u0441\u0431\u043e\u043a\u0443 \u00ab\u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u043e\u0432\u00bb. <\/p>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0435\u0441\u043b\u0438 \u0432 security \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043d\u0435 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044b, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: \u043f\u043e\u0434\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Open Id connect \u0438 OAuth \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"http:\/\/docs.identityserver.io\/en\/latest\/\">IdentityServer4<\/a>.<\/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-292597","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292597","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=292597"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292597\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}