{"id":198424,"date":"2013-10-24T12:39:03","date_gmt":"2013-10-24T08:39:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=198424"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=198424","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u00abclaims-based\u00bb \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u00abxml-based\u00bb \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/e4e\/e14\/7eb\/e4ee147eb1092edf893fbb2ab8c55aa5.png\"\/><\/p>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0422\u0435\u043c\u0430 \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\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 web-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041c\u043d\u043e\u0433\u0438\u0435 .NET \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0443\u0436\u0435 \u0443\u0441\u043f\u0435\u043b\u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 Windows Identity Foundation (WIF), \u0435\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u043c\u0438 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u00abidentity-aware\u00bb \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0443\u0441\u043f\u0435\u043b \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 WIF, \u043f\u0435\u0440\u0432\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/hh377151(v=vs.110).aspx\">\u0440\u0430\u0437\u0434\u0435\u043b\u0430 MSDN<\/a>. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0436\u0435 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u00abclaims-based\u00bb \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u0443\u0442\u0435\u043c \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>Claims-Based Authorization<\/h4>\n<p>  \u00abClaims-Based\u00bb \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u043e \u043f\u043e\u0434\u0445\u043e\u0434, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u0435\u0442\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0435\u043a\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u00abclaims\u00bb \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u041f\u0440\u043e\u0432\u043e\u0434\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u0441 \u00abRole-Based\u00bb \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c, \u0443 \u043d\u0435\u043a\u043e\u0433\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0432 \u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0435 \u00abclaims\u00bb \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u0442\u0438\u043f\u043e\u043c \u00abRole\u00bb \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u00abAdministrator\u00bb, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440. \u0411\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e, \u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u0445 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/hh545448(v=vs.110).aspx\">MSDN<\/a>, \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"http:\/\/vimeo.com\/43549130\">\u043b\u0435\u043a\u0446\u0438\u044e \u0414\u043e\u043c\u0438\u043d\u0438\u043a\u0430 \u0411\u0430\u0439\u0435\u0440\u0430<\/a>.<\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u043e\u0449\u0440\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442 \u043b\u043e\u0433\u0438\u043a\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e. \u0422\u0430\u043a \u043a\u0430\u043a \u0436\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435? \u041a \u043d\u0435\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<h4>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h4>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 API \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c. \u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u043d\u044b\u0439, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0442\u0430\u043a\u0436\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0435\u0449\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0438 \u0441\u0445\u0435\u043c\u043e\u0439 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 API, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043c\u0435\u0442\u044c \u0433\u0438\u0431\u043a\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\/\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. API \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c ASP.NET Web API 2.0, \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0431\u0443\u0434\u0443\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Windows Phone \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 Web-\u0441\u0430\u0439\u0442.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e:<\/p>\n<h6>Windows Phone \u043a\u043b\u0438\u0435\u043d\u0442<\/h6>\n<p> <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/3d4\/88f\/8ff\/3d488f8ff9ac662700a3c1642ca86b83.png\" align=\"left\" alt=\"Windows Phone\"\/><\/p>\n<ol>\n<li> \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/li>\n<li> \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442: <br \/> \n<ul>\n<li> \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c;<\/li>\n<li> \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c;<\/li>\n<li> \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043c\u0435\u043d\u0443 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0430\u0440\u043e\u043b\u044f;<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>  <\/p>\n<h6>Web \u043a\u043b\u0438\u0435\u043d\u0442<\/h6>\n<p> <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/417\/a6f\/ae6\/417a6fae6757ca74088ef2cccae8b9bc.png\" align=\"left\" alt=\"Web Site\"\/><\/p>\n<ol>\n<li> \u0421\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API.<\/li>\n<li> \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442: <br \/> \n<ul>\n<li> \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c;<\/li>\n<li> \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c;<\/li>\n<li> \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043c\u0435\u043d\u0443 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0430\u0440\u043e\u043b\u044f;<\/li>\n<\/ul>\n<p>   <\/li>\n<li> \u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u0433\u0443\u0442:<br \/> \n<ul>\n<li> \u0432\u0441\u0451 \u0442\u043e \u0436\u0435, \u0447\u0442\u043e \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430;<\/li>\n<li> \u0432\u0441\u0451 \u0442\u043e \u0436\u0435, \u0447\u0442\u043e \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0434\u043b\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f;<\/li>\n<li> \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439;<\/li>\n<li> \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\/\u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439;<\/li>\n<\/ul>\n<p>   <\/li>\n<\/ol>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 API, \u043a\u0430\u043a\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u0438 \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438. \u0427\u0442\u043e \u0436, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438!<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e API \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/p>\n<pre><code class=\"cs\">    public interface IUsersApiController     {         \/\/ List all users.         IEnumerable&lt;User&gt; GetAllUsers();          \/\/ Lookup single user.         User GetUserById(int id);          \/\/ Create user.         HttpResponseMessage Post(RegisterModel user);          \/\/ Restore user's password.         HttpResponseMessage RestorePassword(string email);          \/\/ Update user.         HttpResponseMessage Put(int id, UpdateUserModel value);          \/\/ Delete user.         HttpResponseMessage Delete(string email);     } <\/code><\/pre>\n<p>  \u041d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e API \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0437\u0430 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043e\u0439\u0434\u0435\u0442 \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code class=\"cs\">    public class UsersController : ApiController     {         \/\/...         public HttpResponseMessage Post([FromBody]RegisterModel user)         {             if (ModelState.IsValid)             {                 return Request.CreateResponse(HttpStatusCode.OK, &quot;Created!&quot;);             }             else             {                 return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);             }         }         \/\/...     } <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 ClaimsAuthorizationManager \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u044b. <code>ClaimsAuthorizationManager<\/code> \u2014 \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 WIF, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 <u>\u043d\u0430\u0431\u043e\u0440\u0430 \u00abclaims\u00bb \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/u>* \u0440\u0435\u0448\u0430\u0435\u0442 \u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u0435\u0442\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<\/p>\n<p>  * \u2014 \u043e \u0442\u043e\u043c, \u0433\u0434\u0435 \u044d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  \u041d\u0435 \u0443\u0445\u043e\u0434\u044f \u0434\u0430\u043b\u0435\u043a\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u0437 MSDN \u043f\u043e <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.security.claims.claimsauthorizationmanager(v=vs.110).aspx\">\u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/a>. \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u0438\u0437 \u0441\u0435\u043a\u0446\u0438\u0438 \u00abExamples\u00bb \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:<\/p>\n<pre><code class=\"cs\">    \/\/\/ &lt;summary&gt;      \/\/\/ Overloads  the base class method to load the custom policies from the config file      \/\/\/ &lt;\/summary&gt;      \/\/\/ &lt;param name=&quot;nodelist&quot;&gt;XmlNodeList containing the policy information read from the config file&lt;\/param&gt;     public override void LoadCustomConfiguration(XmlNodeList nodelist)     {...}      \/\/\/ &lt;summary&gt;      \/\/\/ Checks if the principal specified in the authorization context is authorized      \/\/\/ to perform action specified in the authorization context on the specified resource      \/\/\/ &lt;\/summary&gt;      \/\/\/ &lt;param name=&quot;pec&quot;&gt;Authorization context&lt;\/param&gt;     \/\/\/ &lt;returns&gt;true if authorized, false otherwise&lt;\/returns&gt;     public override bool CheckAccess(AuthorizationContext pec)     {...} <\/code><\/pre>\n<p>  \u0413\u043b\u044f\u0434\u044f \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u043d\u0435\u0439, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u043c. \u041e\u0442\u043c\u0435\u0447\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430:<\/p>\n<pre><code class=\"xml\">   ...    &lt;policy resource=&quot;http:\/\/localhost:28491\/Developers.aspx&quot; action=&quot;GET&quot;&gt;      &lt;or&gt;        &lt;claim claimType=&quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role&quot; claimValue=&quot;developer&quot; \/&gt;        &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/claims\/Group&quot; claimValue=&quot;Administrator&quot; \/&gt;      &lt;\/or&gt;    &lt;\/policy&gt;    &lt;policy resource=&quot;http:\/\/localhost:28491\/Administrators.aspx&quot; action=&quot;GET&quot;&gt;      &lt;and&gt;        &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/claims\/Group&quot; claimValue=&quot;Administrator&quot; \/&gt;        &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/ws\/2005\/05\/identity\/claims\/country&quot; claimValue=&quot;USA&quot; \/&gt;      &lt;\/and&gt;    &lt;\/policy&gt;    &lt;policy resource=&quot;http:\/\/localhost:28491\/Default.aspx&quot; action=&quot;GET&quot;&gt;    &lt;\/policy&gt;    ... <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0437\u0434\u0435\u0441\u044c \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0441\u0435\u043a\u0446\u0438\u0439 \u00abpolicy\u00bb, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 \u043a\u0430\u043a \u00abresource\u00bb \u0438 \u00abaction\u00bb. \u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u0430\u043a\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u00abclaims\u00bb \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0443. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 WebApi \u00abresource\u00bb \u2014 \u044d\u0442\u043e \u0438\u043c\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u00abaction\u00bb \u2014 \u0438\u043c\u044f action-\u043c\u0435\u0442\u043e\u0434\u0430. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <u>\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439<\/u>*. <\/p>\n<p>  <a name=\"Fail\"><\/a>* \u2014 \u0438 \u0432\u0441\u0451 \u0431\u044b \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u044b\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 2-x \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u00abclaim\u00bb \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u043e\u0432 \u00aband\u00bb \u0438\u043b\u0438 \u00abor\u00bb.<\/p>\n<p>  \u041f\u043e\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0441\u0451 \u00abas-is\u00bb, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430, \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043d\u0430 <code>XmlBasedAuthorizationManager<\/code>. \u0415\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0431\u0438\u043b\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442, \u0442\u043e \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>PolicyReader<\/code>, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0438\u0437 <a href=\"http:\/\/code.msdn.microsoft.com\/vstudio\/Claims-Based-Authorization-89cf736e\/sourcecode?fileId=54328&amp;pathId=1068860546\">\u043f\u043e\u043b\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432<\/a> MSDN-\u043f\u0440\u0438\u043c\u0435\u0440\u0430.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u043e\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u0430, \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c WebAPI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e:<\/p>\n<p>  1. \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b WIF:<\/p>\n<pre><code class=\"xml\">  &lt;configSections&gt;     &lt;section name=&quot;system.identityModel&quot; type=&quot;System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089&quot; \/&gt;     &lt;section name=&quot;system.identityModel.services&quot; type=&quot;System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089&quot; \/&gt;     &lt;!-- Others sections--&gt;   &lt;\/configSections&gt; <\/code><\/pre>\n<p>  2. \u0423\u043a\u0430\u0436\u0435\u043c \u043a\u0430\u043a\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"xml\">  &lt;system.identityModel&gt;     &lt;identityConfiguration&gt;       &lt;claimsAuthorizationManager type=&quot;YourProject.WebApi.Security.XmlBasedAuthorizationManager, YourProject.WebApi, Version=1.0.0.0, Culture=neutral&quot;&gt;         &lt;!-- Policies --&gt;       &lt;\/claimsAuthorizationManager&gt;       &lt;claimsAuthenticationManager type=&quot;YourProject.WebApi.Security.AuthenticationManager, YourProject.WebApi, Version=1.0.0.0, Culture=neutral&quot; \/&gt;     &lt;\/identityConfiguration&gt;   &lt;\/system.identityModel&gt; <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 WIF \u043a\u0430\u043a\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u043a\u0430\u043a \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0448\u0435 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0434\u0432\u0435 \u0434\u0435\u0442\u0430\u043b\u0438:  <\/p>\n<ol>\n<li> \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0430\u0431\u043e\u0440\u0430 xml-\u0441\u0435\u043a\u0446\u0438\u0439 \u00abpolicy\u00bb \u0443 \u043d\u0430\u0441 \u043f\u0443\u0441\u0442\u043e;<\/li>\n<li><a name=\"claimsAuthenticationManager\"><\/a>\u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 xml-\u044d\u043b\u0435\u043c\u0435\u043d\u0442 &quot;<code>claimsAuthenticationManager<\/code>&quot;, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u0440\u0430\u043d\u0435\u0435.<\/li>\n<\/ol>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u0438 \u043f\u0443\u043d\u043a\u0442\u044b \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<h5>1. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/h5>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e API. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0430\u0432\u0438\u043b:<\/p>\n<pre><code class=\"xml\">   &lt;policy resource=&quot;Users&quot; action=&quot;GetAllUsers&quot;&gt;      &lt;and&gt;        &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/ws\/2005\/05\/identity\/claims\/system&quot; claimValue=&quot;WebApplication&quot; \/&gt;        &lt;claim claimType=&quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role&quot; claimValue=&quot;Admin&quot; \/&gt;      &lt;\/and&gt;    &lt;\/policy&gt;    &lt;policy resource=&quot;Users&quot; action=&quot;Post&quot;&gt;        &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/ws\/2005\/05\/identity\/claims\/system&quot; claimValue=&quot;WPhoneApplication&quot; \/&gt;    &lt;\/policy&gt;    &lt;policy resource=&quot;Users&quot; action=&quot;RestorePassword&quot;&gt;      &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/ws\/2005\/05\/identity\/claims\/system&quot; claimValue=&quot;WPhoneApplication&quot; \/&gt;    &lt;\/policy&gt;    &lt;policy resource=&quot;Users&quot; action=&quot;GetUserById&quot;&gt;      &lt;or&gt;        &lt;and&gt;          &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/ws\/2005\/05\/identity\/claims\/system&quot; claimValue=&quot;WebApplication&quot; \/&gt;          &lt;claim claimType=&quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role&quot; claimValue=&quot;Admin&quot; \/&gt;        &lt;\/and&gt;        &lt;and&gt;          &lt;claim claimType=&quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role&quot; claimValue=&quot;User&quot; \/&gt;          &lt;!-- \u041a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e {0} \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b &quot;request&quot; ? --&gt;          &lt;!-- &lt;claim claimType=&quot;UserId&quot; claimValue=&quot;{0}&quot; \/&gt; --&gt;        &lt;\/and&gt;      &lt;\/or&gt;    &lt;\/policy&gt;    &lt;policy resource=&quot;Users&quot; action=&quot;Put&quot;&gt;      &lt;or&gt;        &lt;and&gt;          &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/ws\/2005\/05\/identity\/claims\/system&quot; claimValue=&quot;WebApplication&quot; \/&gt;          &lt;claim claimType=&quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role&quot; claimValue=&quot;Admin&quot; \/&gt;        &lt;\/and&gt;        &lt;and&gt;          &lt;claim claimType=&quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role&quot; claimValue=&quot;User&quot; \/&gt;          &lt;!-- \u041a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e {0} \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b &quot;request&quot; ? --&gt;          &lt;!-- &lt;claim claimType=&quot;UserId&quot; claimValue=&quot;{0}&quot; \/&gt; --&gt;        &lt;\/and&gt;      &lt;\/or&gt;    &lt;\/policy&gt; <\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 policy-\u0441\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0449\u0435, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442\u0441\u044f. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u2014 <i>\u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/i>:<\/p>\n<pre><code class=\"xml\">   &lt;policy resource=&quot;Users&quot; action=&quot;GetAllUsers&quot;&gt;      &lt;and&gt;        &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/ws\/2005\/05\/identity\/claims\/system&quot; claimValue=&quot;WebApplication&quot; \/&gt;        &lt;claim claimType=&quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role&quot; claimValue=&quot;Admin&quot; \/&gt;      &lt;\/and&gt;    &lt;\/policy&gt; <\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e: \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0435\u0441\u0442\u044c \u0443 \u0442\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043d\u0430\u0431\u043e\u0440 \u00abclaims\u00bb \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0431\u0430 \u00ab\u0441laim\u00bb \u2014 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 <i>\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u043f\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443<\/i>:<\/p>\n<pre><code class=\"xml\">   &lt;policy resource=&quot;Users&quot; action=&quot;GetUserById&quot;&gt;      &lt;or&gt;        &lt;and&gt;          &lt;claim claimType=&quot;http:\/\/schemas.xmlsoap.org\/ws\/2005\/05\/identity\/claims\/system&quot; claimValue=&quot;WebApplication&quot; \/&gt;          &lt;claim claimType=&quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role&quot; claimValue=&quot;Admin&quot; \/&gt;        &lt;\/and&gt;        &lt;and&gt;          &lt;claim claimType=&quot;http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role&quot; claimValue=&quot;User&quot; \/&gt;          &lt;!-- \u041a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e {0} \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b &quot;request&quot; ? --&gt;          &lt;!-- &lt;claim claimType=&quot;UserId&quot; claimValue=&quot;{0}&quot; \/&gt; --&gt;        &lt;\/and&gt;      &lt;\/or&gt;    &lt;\/policy&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c, \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u044b \u0432\u0435\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 <u>\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0443<\/u>. \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u043f\u0435\u0440\u0432\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u044b \u0431\u0435\u0437 \u0442\u0440\u0443\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432 \u043f\u0435\u0440\u0432\u043e\u043c <code>&lt;and&gt;..&lt;\/and&gt;<\/code> \u0431\u043b\u043e\u043a\u0435. \u041d\u043e \u043a\u0430\u043a \u0436\u0435 \u0431\u044b\u0442\u044c \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438?<\/p>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u041c\u044b \u0434\u043e\u0431\u043b\u0435\u0441\u0442\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438, \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0435\u0439\u0447\u0430\u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043a\u0430\u043a \u044f \u0443\u0436\u0435 <a href=\"#Fail\">\u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u0432\u044b\u0448\u0435<\/a>, \u043e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 &quot;<code>and\/or<\/code>&quot; \u0431\u043b\u043e\u043a\u043e\u0432 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u0415\u0441\u043b\u0438 \u0443\u0436 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u0447\u0435\u0441\u0442\u043d\u044b\u043c, \u0442\u043e \u044d\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0436\u0435\u0441\u0442\u043a\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u00abclaim\u00bb \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0432\u043d\u043e\u0435 \u0434\u0432\u0443\u043c \u0432\u043d\u0443\u0442\u0440\u0438 &quot;<code>and\/or<\/code>&quot; \u0431\u043b\u043e\u043a\u043e\u0432.<\/p>\n<p>  \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u00ab\u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 <u>\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0443<\/u>\u00bb, \u0442\u043e \u044f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u043a\u0430 \u0441\u043c\u0438\u0440\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u0440\u0443\u0433 \u043e \u0434\u0440\u0443\u0433\u0435, \u043a\u0430\u043a \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <code>GetUserById<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a <code>throw new NotImplementedException()<\/code>.<\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0447\u0442\u043e\u0431\u044b \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e \u043c\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u0430 <code>PolicyReader<\/code>:<\/p>\n<pre><code class=\"cs\">   \/\/\/ &lt;summary&gt;     \/\/\/ Read the Or Node     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rdr&quot;&gt;XmlDictionaryReader of the policy Xml&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;subject&quot;&gt;ClaimsPrincipal subject&lt;\/param&gt;     \/\/\/ &lt;returns&gt;A LINQ expression created from the Or node&lt;\/returns&gt;     private Expression&lt;Func&lt;ClaimsPrincipal, bool&gt;&gt; ReadOr(XmlDictionaryReader rdr, ParameterExpression subject)    {        Expression defaultExpr = Expression.Invoke((Expression&lt;Func&lt;bool&gt;&gt;)(() =&gt; false));        while (rdr.Read())        {            if (rdr.NodeType != XmlNodeType.EndElement && rdr.Name != &quot;or&quot;)            {                defaultExpr = Expression.OrElse(defaultExpr, Expression.Invoke(ReadNode(rdr, subject), subject));            }            else                break;        }        rdr.ReadEndElement();        Expression&lt;Func&lt;ClaimsPrincipal, bool&gt;&gt; resultExpr               = Expression.Lambda&lt;Func&lt;ClaimsPrincipal, bool&gt;&gt;(defaultExpr, subject);        return resultExpr;    }     \/\/\/ &lt;summary&gt;     \/\/\/ Read the And Node     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rdr&quot;&gt;XmlDictionaryReader of the policy Xml&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;subject&quot;&gt;ClaimsPrincipal subject&lt;\/param&gt;     \/\/\/ &lt;returns&gt;A LINQ expression created from the And node&lt;\/returns&gt;     private Expression&lt;Func&lt;ClaimsPrincipal, bool&gt;&gt; ReadAnd(XmlDictionaryReader rdr, ParameterExpression subject)    {        Expression defaultExpr = Expression.Invoke((Expression&lt;Func&lt;bool&gt;&gt;)(() =&gt; true));        while (rdr.Read())        {            if (rdr.NodeType != XmlNodeType.EndElement && rdr.Name != &quot;and&quot;)            {                defaultExpr = Expression.AndAlso(defaultExpr, Expression.Invoke(ReadNode(rdr, subject), subject));            }            else                break;        }        rdr.ReadEndElement();        Expression&lt;Func&lt;ClaimsPrincipal, bool&gt;&gt; resultExpr              = Expression.Lambda&lt;Func&lt;ClaimsPrincipal, bool&gt;&gt;(defaultExpr, subject);        return resultExpr;    } <\/code><\/pre>\n<p>  \u0427\u0442\u043e \u0436, \u043c\u044b \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u043d\u0430\u0448\u0435\u0433\u043e API, \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u2014 \u044d\u0442\u0430\u043f\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h5>2. \u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438 ClaimsAuthenticationManager<\/h5>\n<p>  \u0415\u0449\u0435 \u0434\u043e \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0443, \u0441\u043f\u0435\u0440\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u0430 \u2014 \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u00abclaims\u00bb \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/p>\n<p>  \u0414\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/www.asp.net\/web-api\/overview\/security\/basic-authentication\">Basic Authentication<\/a> \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432 <a href=\"https:\/\/github.com\/thinktecture\/Thinktecture.IdentityModel.45\">Thinktecture.IdentityModel.45<\/a>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 NuGet-\u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"bash\">Install-Package Thinktecture.IdentityModel<\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 <code>WebApiConfig<\/code> \u0438\u0437\u043c\u0435\u043d\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0431\u044b\u043b \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<pre><code class=\"cs\">   public static class WebApiConfig    {        public static void Register(HttpConfiguration config)        {            var authentication = CreateAuthenticationConfiguration();            config.MessageHandlers.Add(new AuthenticationHandler(authentication));             config.MapHttpAttributeRoutes();            config.Routes.MapHttpRoute(                name: &quot;DefaultApi&quot;,                routeTemplate: &quot;api\/{controller}\/{id}&quot;,                defaults: new { id = RouteParameter.Optional }            );             config.EnableSystemDiagnosticsTracing();             config.Filters.Add(new ClaimsAuthorizeAttribute());        }         private static AuthenticationConfiguration CreateAuthenticationConfiguration()        {            var authentication = new AuthenticationConfiguration            {                ClaimsAuthenticationManager = new AuthenticationManager(),                RequireSsl = false \/\/only for testing            };             #region Basic Authentication            authentication.AddBasicAuthentication((username, password) =&gt;                {                    var webSecurityService = ServiceLocator.Current.GetInstance&lt;IWebSecurityService&gt;();                    return webSecurityService.Login(username, password);                });            #endregion             return authentication;        }    } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043e\u0442\u043c\u0435\u0447\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 credentials \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0445 \u0438\u0437 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0443 \u043c\u0435\u043d\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u0438\u0439 <code>IWebSecurityService<\/code>. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u0441\u0432\u043e\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <s><code>return username == password;<\/code><\/s><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043d\u043e \u0435\u0449\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u00abclaims\u00bb \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u042d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.security.claims.claimsauthenticationmanager.aspx\"><code>ClaimsAuthenticationManager<\/code><\/a>, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u043d\u0430\u0448 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b <a href=\"#claimsAuthenticationManager\">\u0443\u0436\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438<\/a>:<\/p>\n<pre><code class=\"cs\">   public class AuthenticationManager : ClaimsAuthenticationManager    {        public override ClaimsPrincipal Authenticate(string resourceName, ClaimsPrincipal incomingPrincipal)        {            if (!incomingPrincipal.Identity.IsAuthenticated)            {                return base.Authenticate(resourceName, incomingPrincipal);            }             var claimsService = ServiceLocator.Current.GetInstance&lt;IUsersClaimsService&gt;();            var claims = claimsService.GetUserClaims(incomingPrincipal.Identity.Name);            foreach (var userClaim in claims)            {                incomingPrincipal.Identities.First().AddClaim(new Claim(userClaim.Type, userClaim.Value));            }            return incomingPrincipal;        }    } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0448\u0435\u043b \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u2014 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u00abclaims\u00bb, \u0441\u043a\u0430\u0436\u0435\u043c \u0438\u0437 \u0411\u0414, \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043d\u043e\u0432\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 <code>IUsersClaimsService<\/code>. \u041f\u043e\u0441\u043b\u0435 \u00ab\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438\u00bb \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.security.claims.claimsprincipal.aspx\">ClaimsPrincipal<\/a> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u043a\u043e\u043d\u0432\u0435\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430<\/h4>\n<p>  \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0441 \u0442\u0435\u043c\u0438 \u0438\u043b\u0438 \u0438\u043d\u044b\u043c\u0438 \u00abclaims\u00bb. \u041d\u0435 \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u043b\u0433\u043e \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0434 \u0442\u0435\u043c \u043e\u0442\u043a\u0443\u0434\u0430 \u0438\u0445 \u0432\u0437\u044f\u0442\u044c \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u043e\u0438\u0437\u043c\u0435\u043d\u0438\u043c <code>AuthenticationManager<\/code> \u0432 \u0446\u0435\u043b\u044f\u0445 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>IUsersClaimsService<\/code> \u0432\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">   public class AuthenticationManager : ClaimsAuthenticationManager    {        public override ClaimsPrincipal Authenticate(string resourceName, ClaimsPrincipal incomingPrincipal)        {            ...            if (incomingPrincipal.Identity.Name.ToLower().Contains(&quot;user&quot;))            {                incomingPrincipal.Identities.First().AddClaim(new Claim(ClaimTypes.Role, &quot;User&quot;));            }            return incomingPrincipal;        }    } <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u043b\u043e\u0433\u0438\u043d \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u043e\u0432\u043e \u00abuser\u00bb \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 \u00abclaim\u00bb.<br \/>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"http:\/\/localhost\">localhost<\/a>:[port]\/api\/users<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/cf6\/e88\/924\/cf6e889248db3ec3ba4aadeaca91df60.png\" \/><\/div>\n<p>  \u0412\u0432\u043e\u0434\u0438\u043c \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u043d\u0430\u0448\u0430 \u043d\u0435\u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u0430\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e, \u0430 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u00abclaims\u00bb:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/9ef\/7fc\/e47\/9ef7fce474ac51f7cbd646dfc6a93441.png\" \/><\/div>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043c\u0435\u0440\u0442\u043d\u044b\u0439 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/ca5\/cb8\/dc9\/ca5cb8dc91005aaca1747bf4a2f8debb.png\" \/><\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u0440\u0443\u0433 \u043e \u0434\u0440\u0443\u0433\u0435, \u044d\u0442\u0438\u043c \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0441 Id=100, \u0437\u0430\u0439\u0434\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 ~\/api\/users\/100:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/b29\/946\/054\/b29946054b6a7e302eb4e81d5f492065.png\" \/><\/div>\n<p>  \u0418 \u0432\u043e\u0442 \u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0435\u043a\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0432 \u043a\u0443\u043b\u0443\u0430\u0440\u0430\u0445, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043b\u044e\u0431\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \ud83d\ude42<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0418\u0442\u0430\u043a \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 WIF, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u0441 \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0433\u0438\u0431\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u00ab\u043f\u043e\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u00bb.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/198424\/\"> http:\/\/habrahabr.ru\/post\/198424\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/e4e\/e14\/7eb\/e4ee147eb1092edf893fbb2ab8c55aa5.png\"\/><\/p>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0422\u0435\u043c\u0430 \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\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 web-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041c\u043d\u043e\u0433\u0438\u0435 .NET \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0443\u0436\u0435 \u0443\u0441\u043f\u0435\u043b\u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 Windows Identity Foundation (WIF), \u0435\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u043c\u0438 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u00abidentity-aware\u00bb \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0443\u0441\u043f\u0435\u043b \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 WIF, \u043f\u0435\u0440\u0432\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/hh377151(v=vs.110).aspx\">\u0440\u0430\u0437\u0434\u0435\u043b\u0430 MSDN<\/a>. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0436\u0435 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u00abclaims-based\u00bb \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u0443\u0442\u0435\u043c \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.  <\/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-198424","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/198424","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=198424"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/198424\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=198424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=198424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=198424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}