{"id":259226,"date":"2015-06-12T19:53:02","date_gmt":"2015-06-12T15:53:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=259226"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=259226","title":{"rendered":"\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Single Sign On \u0432 Symfony2 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438"},"content":{"rendered":"<br \/>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Single Sign On?<\/h3>\n<p>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Single_sign-on\">Single Sing On<\/a> \u2014 \u044d\u0442\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0431\u0443\u0434\u0443\u0447\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0435\u043c \u0446\u0435\u043d\u0442\u0440\u0435 <i>(\u0434\u0430\u043b\u0435\u0435 Identity Provider, IdP)<\/i>, \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 <i>(\u0434\u0430\u043b\u0435\u0435 Service Provider, SP \u0438\u043b\u0438 Consumer[1-N])<\/i> \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438.<\/p>\n<p>  \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c Single Sign On \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0430\u0439\u0442\u044b, \u043a\u0430\u043a <a href=\"https:\/\/id.tmtm.ru\/login\/\">\u0425\u0430\u0431\u0440\u0430\u0425\u0430\u0431\u0440<\/a>, <a href=\"https:\/\/passport.yandex.ru\/auth\">Yandex<\/a>, <a href=\"https:\/\/accounts.google.com\/ServiceLogin\">Google<\/a>. \u041f\u0440\u0438\u0435\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b:<\/p>\n<ul>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0440\u0430\u0437<\/li>\n<li>\u0418\u043b\u0438 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0430 IdP, \u0435\u0441\u043b\u0438 \u0442\u0430\u043c \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u0438\u043b\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c OpenID<\/li>\n<li>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438<\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0433\u0443\u0442 <i>\u043f\u043b\u0430\u0432\u0430\u0442\u044c<\/i> \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u043e\u0442 IdP \u0434\u043e SP \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a>\u041c\u0438\u043d\u0443\u0441\u044b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0442, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u0438\u0437 \u043f\u043b\u044e\u0441\u043e\u0432:<\/p>\n<ul>\n<li>\u041f\u043e\u0442\u0435\u0440\u044f \u043f\u0430\u0440\u043e\u043b\u044f \u043e\u0442 IdP \u0432\u043b\u0435\u0447\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0432\u0445\u043e\u0434\u0430 \u0432\u043e \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b<\/li>\n<li>\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u0440\u043e\u0441\u0448\u0438\u0439 \u0440\u0438\u0441\u043a \u043a\u0440\u0430\u0436\u0438 \u043c\u0430\u0441\u0442\u0435\u0440 \u0441\u0435\u0441\u0441\u0438\u0438 \u0441 IdP <i>(\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0441\u0435\u0441\u0441\u0438\u0438 \u043a \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/HTTPS\">HTTPS<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/HTTP_cookie#HttpOnly_cookie\">HTTP Only Cookies<\/a> \u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/HTTP_cookie#Secure_cookie\">SSL Only Cookies<\/a>)<\/i><\/li>\n<li>\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u0440\u043e\u0441\u0448\u0438\u0439 \u0440\u0438\u0441\u043a \u043a\u0440\u0430\u0436\u0438 \u043f\u0430\u0440\u043e\u043b\u044f \u043e\u0442 IdP<\/li>\n<li>&#8230;<\/li>\n<\/ul>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u044d\u0442\u043e, \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 user experience, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u0432\u0435\u0448\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u043c\u0438\u043d\u0443\u0441\u044b, \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u044d\u043f\u043e\u043f\u0435\u044f \u043f\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 SSO \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 SSO \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0445\u043e\u0440\u043e\u0448\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u044b \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435:<\/p>\n<ul>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Cross-site_request_forgery\">CSRF-\u0430\u0442\u0442\u0430\u043a\u0438<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Man-in-the-middle_attack\">MiTM-\u0430\u0442\u0442\u0430\u043a\u0438<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Directory_traversal_attack\">Path Traversal-\u0430\u0442\u0442\u0430\u043a\u0438<\/a><\/li>\n<li><a href=\"https:\/\/www.owasp.org\/index.php\/Execution_After_Redirect_(EAR)\">Execution After Redirect (EAR)-\u0430\u0442\u0442\u0430\u043a\u0438<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Timing_attack\">Timing-\u0430\u0442\u0442\u0430\u043a\u0438<\/a><\/li>\n<\/ul>\n<p>  <i><s>\u0430 \u0435\u0449\u0435 \u043b\u0443\u0447\u0448\u0435, \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0445 \u0441\u0430\u043c\u043e\u043c\u0443<\/s>.<\/i><\/p>\n<p>  \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f SSO, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043a SSO: \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u043e\u0442 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u0434\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435, \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u0443\u0433\u043e\u043d\u043e\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u0432 IdP, \u0447\u0442\u043e \u0432\u043b\u0435\u0447\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445. <\/p>\n<p>  \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u043c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Cookies \u0438 \u043a\u0430\u043a \u043d\u0430\u0434\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c Cookies, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0448\u0442\u0430\u043d\u043e\u0432: <a href=\"http:\/\/habrahabr.ru\/company\/mailru\/blog\/228997\/\">habrahabr.ru\/company\/mailru\/blog\/228997<\/a>.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u043e\u0441\u043b\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0441 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0442\u0435\u043e\u0440\u0438\u0435\u0439: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 SSO, \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u043c\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u2014 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c<\/h3>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c54\/d5a\/b67\/c54d5ab67f589be0bee0ea4ff83f7d38.png\" alt=\"image\"\/><\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u0437\u0430\u0449\u0438\u0449\u0443\u043d\u043d\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <i>(\u043f. 1 \u043d\u0430 \u0441\u0445\u0435\u043c\u0435)<\/i>.<br \/>  \u0414\u0430\u043b\u0435\u0435 \u0432 Symfony2 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <a href=\"http:\/\/symfony.com\/doc\/current\/components\/security\/firewall.html#entry-points\">Entry point<\/a> \u0438 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0441 \u043d\u0430 \u043d\u0430\u0448 IdP, \u0433\u0434\u0435 \u043d\u0430\u043c \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u043a\u0438\u043d\u0443\u0442\u044c OTP. \u0422\u0443\u0442 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439:<\/p>\n<ol>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 IdP, \u0442\u043e\u0433\u0434\u0430 IdP \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u043a\u0438\u043d\u0435\u0442 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0439 OTP <i>(\u043f. 3 \u043d\u0430 \u0441\u0445\u0435\u043c\u0435, \u0437\u0435\u043b\u0435\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f)<\/i><\/li>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 IdP, \u0442\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u043d\u0430\u0434\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0444\u043e\u0440\u043c\u0443 \u0432\u0432\u043e\u0434\u0430 \u043b\u043e\u0433\u0438\u043d\u0430\/\u043f\u0430\u0440\u043e\u043b\u044f <i>(\u043f. 3 \u043d\u0430 \u0441\u0445\u0435\u043c\u0435, \u043a\u0440\u0430\u0441\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f)<\/i><\/li>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u043d\u0430\u0441 \u0432\u0438\u0434\u0438\u0442, \u043d\u043e \u0445\u043e\u0447\u0435\u0442 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0444\u043e\u0440\u043c\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 <i>(\u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u043d\u0430 IdP \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d SP, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u043f\u0440\u0438\u0448\u0435\u043b.)<\/i><\/li>\n<\/ol>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0448\u0435\u043b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e, \u0435\u0433\u043e \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043f. 3 \u043f\u043e \u0437\u0435\u043b\u0435\u043d\u043e\u0439 \u043b\u0438\u043d\u0438\u0438 \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e OTP \u043d\u0430 SP, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u043d\u0430\u043c \u043d\u0430 IdP. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430 SP \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c OTP, \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0439 REST \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 IdP, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 OTP \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u0435\u0449\u0435 \u043d\u0435 \u0438\u0441\u0442\u0435\u043a \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 REST \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 OTP. <b>\u0421\u0442\u0430\u0432\u044c\u0442\u0435 \u043b\u043e\u043a, \u044d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430<\/b>. \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u0442\u0430\u043a\u0438\u043c OTP \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043b\u0438\u0431\u043e HTTP 400, \u043b\u0438\u0431\u043e HTTP 404 \u0434\u043b\u044f SP. <\/p>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 IdP \u043e\u0442\u0432\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 OTP \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u0432\u0430\u043b\u0438\u0434\u0435\u043d, SP \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0434\u0430\u0447\u0438 \u0435\u043c\u0443 PreAuthenticatedToken&#8217;\u0430.<\/p>\n<p>  \u0412\u044b\u0445\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/32b\/f4b\/57a\/32bf4b57a9f0c255678fb7d6ef256b4d.png\" alt=\"image\"\/><\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0432\u044b\u0445\u043e\u0434\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043d\u0430 SP. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u0442\u0443\u0434\u0430, \u0433\u0434\u0435 \u043e\u043d \u043d\u0430\u0447\u0430\u043b \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u044b\u043b \u043d\u0430 \u043d\u0435\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <i>\/secured_area<\/i> \u0438 \u043d\u0430\u0436\u0430\u043b \u043d\u0430 \u00ab\u0412\u044b\u0445\u043e\u0434\u00bb. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u043e\u0433\u0430\u0443\u0442 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 SP. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0443\u0445\u043e\u0434\u0438\u043c \u043d\u0430 IdP \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 URL <i>\/sso\/logout<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0432\u044b\u0445\u043e\u0434\u0430 \u0441\u043e \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0422.\u043a. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u043f\u0440\u0438\u0448\u0435\u043b \u0441 SP, \u0442\u043e IdP \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0441\u0442\u044c \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430 \u043d\u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0445\u043e\u0434. \u0422\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u043d\u043e\u0432\u0430 \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0441 \u043d\u0430 IdP \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043a\u043e\u043d\u0447\u0438\u043b\u0438\u0441\u044c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434 (\u043f. 5 \u043d\u0430 \u0441\u0445\u0435\u043c\u0435). \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 SP, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u043d\u0430\u0447\u0430\u043b \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0445\u043e\u0434. <\/p>\n<p>  \u0415\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0445\u043e\u0434\u0430 \u043d\u0435 \u0441 SP \u0430 \u0441 IdP. \u0418 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9d2\/39a\/ea5\/9d239aea5a33aa9c79833ecfad6bd1f5.png\" alt=\"image\"\/><\/p>\n<h3>\u0423\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u0446\u0435\u043d\u0442\u0440 (IdentityProvider)<\/h3>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u0446\u0435\u043d\u0442\u0440, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0432\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c, \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0443 Yandex (\u042f\u043d\u0434\u0435\u043a\u0441.\u041f\u0430\u0441\u043f\u043e\u0440\u0442) \u0438\u043b\u0438 \u0443 Google (Google Accounts).<\/p>\n<p>  \u0412 \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u044c \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c: <a href=\"https:\/\/github.com\/korotovsky\/SingleSignOnIdentityProviderBundle\">SingleSignOnIdentityProviderBundle<\/a><\/p>\n<p>  SingleSignOnIdentityProviderBundle \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430:<\/p>\n<ul>\n<li>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u043e\u043b\u0435\u0439 (<a href=\"https:\/\/en.wikipedia.org\/wiki\/One-time_password\">OTP<\/a>)<\/li>\n<li>\u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0432 \u0441\u0435\u0441\u0441\u0438\u044e, \u0441 \u043a\u0430\u043a\u043e\u0433\u043e SP \u043f\u0440\u0438\u0448\u0435\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c<\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0441\u043e \u0432\u0441\u0435\u0445 SP-\u043e\u0432<\/li>\n<\/ul>\n<p>  \u0421\u0442\u0430\u0432\u0438\u043c \u0447\u0435\u0440\u0435\u0437 composer:<\/p>\n<pre><code class=\"bash\">php composer.phar require &quot;korotovsky\/sso-idp-bundle:~0.2.0&quot;<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u0431\u0430\u043d\u0434\u043b \u0432 AppKernel:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/AppKernel.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\/\/ app\/AppKernel.php $bundles[] = new \\Krtv\\Bundle\\SingleSignOnIdentityProviderBundle\\KrtvSingleSignOnIdentityProviderBundle(); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u043e\u0443\u0442\u044b <i>\/sso\/login<\/i> \u0438 <i>\/sso\/logout<\/i> \u0438\u0437 \u0431\u0430\u043d\u0434\u043b\u0430:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/config\/routing.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code># app\/config\/routing.yml: sso:     resource: .     type:     sso <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c IdP \u0431\u0430\u043d\u0434\u043b:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/config\/config.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code># app\/config\/config.yml: krtv_single_sign_on_identity_provider:     host:             idp.example.com # \u0425\u043e\u0441\u0442 \u043d\u0430\u0448\u0435\u0433\u043e IdP \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f     host_scheme:      http            # \u0421\u0445\u0435\u043c\u0430 \u043d\u0430\u0448\u0435\u0433\u043e IdP \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.      login_path:       \/sso\/login\/ # \u041f\u0443\u0442\u044c, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c\u0441\u044f OTP     logout_path:      \/sso\/logout # \u041f\u0443\u0442\u044c, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430      services:         - consumer1 # \u041a\u043e\u0434\u043e\u0432\u043e\u0435 \u0438\u043c\u044f SP \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c, \u043d\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0438 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445      otp_parameter:    _otp   # \u0418\u043c\u044f OTP \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430     secret_parameter: secret # \u0418\u043c\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432 Dependency Injection \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0432\u0441\u0435\u0445 \u0443\u0440\u043b\u043e\u0432 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0438,                               # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043c security.yml:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/config\/security.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code># app\/config\/security.yml security:     access_control:         - { path: ^\/sso\/login$, roles: [ROLE_USER, IS_AUTHENTICATED_FULLY] } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c SP \u0432 \u043d\u0430\u0448 \u0431\u0430\u043d\u0434\u043b, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <i>\\Krtv\\Bundle\\SingleSignOnIdentityProviderBundle\\Manager\\ServiceProviderInterface<\/i> \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u0433\u0430  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">src\/Acme\/Bundle\/AppBundle\/Resources\/config\/security.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>services:     acme_bundle.sso.consumer1:         class: Acme\\Bundle\\AppBundle\\Sso\\ServiceProviders\\ServiceProvider1         tags:             - { name: sso.service_provider, service: consumer1 } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 IdP \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 SP \u0447\u0430\u0441\u0442\u0438.<\/p>\n<p>  \u0421\u0442\u0430\u0432\u0438\u043c \u0447\u0435\u0440\u0435\u0437 composer:<\/p>\n<pre><code class=\"bash\">php composer.phar require &quot;korotovsky\/sso-sp-bundle:~0.2.0&quot;<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u0431\u0430\u043d\u0434\u043b \u0432 AppKernel:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/AppKernel.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\/\/ app\/AppKernel.php $bundles[] = new \\Krtv\\Bundle\\SingleSignOnServiceProviderBundle\\SingleSignOnServiceProviderBundle(); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u043e\u0443\u0442 <i>\/otp\/validate\/<\/i> \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 OTP:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/config\/routing.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code># app\/config\/routing.yml: otp:     # this needs to be the same as the check_path, specified later on in security.yml     path: \/otp\/validate\/ <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c IdP \u0431\u0430\u043d\u0434\u043b:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/config\/config.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code># app\/config\/config.yml: krtv_single_sign_on_service_provider:     host:             idp.example.com # \u0425\u043e\u0441\u0442 \u043d\u0430\u0448\u0435\u0433\u043e IdP \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f     host_scheme:      http            # \u0421\u0445\u0435\u043c\u0430 \u043d\u0430\u0448\u0435\u0433\u043e IdP \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.      login_path:       \/sso\/login\/ # \u041f\u0443\u0442\u044c \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c\u0441\u044f OTP      # Configuration for OTP managers     otp_manager:         name:       http         managers:             http:                 provider:    service # Active provider for HTTP OTP manager                 providers:           # Available HTTP providers                     service:                         id: acme_bundle.your_own_fetch_service.id                      guzzle:                         client:   acme_bundle.guzzle_service.id                         resource: http:\/\/idp.example.com\/internal\/v1\/sso      otp_parameter:    _otp   # \u0418\u043c\u044f OTP \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430     secret_parameter: secret # \u0418\u043c\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432 Dependency Injection \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0432\u0441\u0435\u0445 \u0443\u0440\u043b\u043e\u0432 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0438,                               # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b \u00ab\u0447\u0435\u0441\u0442\u043d\u044b\u0439\u00bb SSO \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c <i>http<\/i> \u043c\u0435\u0442\u043e\u0434, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c <i>service<\/i>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <i>Krtv\\SingleSignOn\\Manager\\Http\\Provider\\ProviderInterface<\/i>.<\/p>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043c security.yml:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">app\/config\/security.yml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code># app\/config\/security.yml     firewalls:         main:             pattern: ^\/             sso:                 require_previous_session: false                 provider:                 main                 check_path:               \/otp\/validate\/ # Same as in app\/config\/routing.yml                  sso_scheme:       http              # Required                 sso_host:         idp.example.com   # Required                 sso_otp_scheme:   http              # Optional                 sso_otp_host:     consumer1.com     # Optional                 sso_failure_path: \/login                 sso_path:         \/sso\/login\/       # SSO endpoint on IdP.                 sso_service:      consumer1         # Consumer name              logout:                 invalidate_session: true                 path:               \/logout                 target:             http:\/\/idp.example.com\/sso\/logout?service=consumer1 <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0431\u0430\u043d\u0434\u043b\u043e\u0432, \u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u00ab\u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0438\u00bb \u0434\u043b\u044f \u043d\u0438\u0445:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/korotovsky\/SingleSignOnIdentityProviderBundle\">github.com\/korotovsky\/SingleSignOnIdentityProviderBundle<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/korotovsky\/SingleSignOnServiceProviderBundle\">github.com\/korotovsky\/SingleSignOnServiceProviderBundle<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/korotovsky\/SingleSignOnLibrary\">github.com\/korotovsky\/SingleSignOnLibrary<\/a><\/li>\n<\/ul>\n<div class=\"clear\"><\/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\/260183\/\"> http:\/\/habrahabr.ru\/post\/260183\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Single Sign On?<\/h3>\n<p>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Single_sign-on\">Single Sing On<\/a> \u2014 \u044d\u0442\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0431\u0443\u0434\u0443\u0447\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0435\u043c \u0446\u0435\u043d\u0442\u0440\u0435 <i>(\u0434\u0430\u043b\u0435\u0435 Identity Provider, IdP)<\/i>, \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 <i>(\u0434\u0430\u043b\u0435\u0435 Service Provider, SP \u0438\u043b\u0438 Consumer[1-N])<\/i> \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438.<\/p>\n<p>  \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c Single Sign On \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0430\u0439\u0442\u044b, \u043a\u0430\u043a <a href=\"https:\/\/id.tmtm.ru\/login\/\">\u0425\u0430\u0431\u0440\u0430\u0425\u0430\u0431\u0440<\/a>, <a href=\"https:\/\/passport.yandex.ru\/auth\">Yandex<\/a>, <a href=\"https:\/\/accounts.google.com\/ServiceLogin\">Google<\/a>. \u041f\u0440\u0438\u0435\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b:<\/p>\n<ul>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0440\u0430\u0437<\/li>\n<li>\u0418\u043b\u0438 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0430 IdP, \u0435\u0441\u043b\u0438 \u0442\u0430\u043c \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u0438\u043b\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c OpenID<\/li>\n<li>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438<\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0433\u0443\u0442 <i>\u043f\u043b\u0430\u0432\u0430\u0442\u044c<\/i> \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u043e\u0442 IdP \u0434\u043e SP \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<\/ul>\n<p>  <\/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-259226","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/259226","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=259226"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/259226\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=259226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=259226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=259226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}