{"id":362480,"date":"2024-05-21T01:35:56","date_gmt":"2024-05-21T01:35:56","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=362480"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=362480","title":{"rendered":"<span>Ory Kratos \u2014 \u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043d\u044b\u0439 SSO<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a70\/cb2\/df3\/a70cb2df365dace01a215cfb3190dc63.png\" width=\"1810\" height=\"905\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a70\/cb2\/df3\/a70cb2df365dace01a215cfb3190dc63.png\"\/><\/figure>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>Ory Kratos &#8212; \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 cloud native \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 PassKeys, MFA, FIDO2, TOTP, WebAuthn, \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044f\u043c\u0438, \u0441\u0445\u0435\u043c\u0430\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0432\u0445\u043e\u0434\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439, \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430, \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 passwordless \u0432\u0445\u043e\u0434\u0430. \u041d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Go, headless, API-first.<\/p>\n<p>\u0426\u0435\u043b\u044c\u044e \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438 \u043c\u043e\u0439 \u043e\u043f\u044b\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<h2>\u0417\u0430\u0447\u0435\u043c?<\/h2>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0441\u0442\u0440\u043e \u0432\u0441\u0442\u0430\u0432\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043a\u0430\u043a-\u0442\u043e \u0440\u0430\u0437 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u0442\u0440\u043e\u0438\u043b \u0431\u044b \u043c\u0435\u043d\u044f \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0435\u0442\u0430\u0445 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0438\u0445.<\/p>\n<p>\u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u0440\u0438\u0448\u043b\u043e \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0435\u0442\u0443 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0442\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u044e\u0437\u0435\u0440\u043e\u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 (\u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u044d\u043c\u0435\u0439\u043b\u0443, \u0433\u0434\u0435-\u0442\u043e \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443, \u0430 \u0433\u0434\u0435-\u0442\u043e \u0435\u0449\u0435 \u0438 oauth2\/oidc \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0441\u044f \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0440\u044b\u043b\u0438 \u0431\u044b \u043c\u043e\u0438 \u0445\u043e\u0442\u0435\u043b\u043a\u0438. \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043d\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441 \u044d\u043b. \u043f\u043e\u0447\u0442\u044b \u0438 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f)<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0441\u043e\u0431\u0430\u0447\u0438\u0442\u044c OAuth2\/OpenID Connect \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432, \u0441 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u043c\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0438 open source, \u0441 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438 \u0438 \u043c\u043d\u043e\u0433\u043e \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u0435\u043a \u0432 github (\u043a\u0443\u0434\u0430 \u0436\u0435 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e)<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u044e\u0437\u0435\u0440\u043e\u0432, \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u0435\u0439 \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>headless, \u0441 \u043d\u0430\u043b\u0438\u0447\u0438\u0435\u043c HTTP\/gRPC API<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b:<\/p>\n<ul>\n<li>\n<p>Firebase, auth0 (\u043f\u043b\u0430\u0442\u043d\u043e, \u043d\u0435\u0442\u0443 self hosted \u0440\u0435\u0448\u0435\u043d\u0438\u044f)<\/p>\n<\/li>\n<li>\n<p>Keycloak (\u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u0434\u0438\u043d\u043e\u0437\u0430\u0432\u0440\u043e\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0439\u0434\u044f \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0443 \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u043d\u0435 \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f). \u041c\u043e\u0436\u0435\u0442\u0435 \u043a\u0438\u0434\u0430\u0442\u044c \u0432 \u043c\u0435\u043d\u044f \u043a\u0430\u043c\u043d\u044f\u043c\u0438 \u0437\u0430 \u0442\u0430\u043a\u043e\u0435 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0437\u044f\u0442\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u0434\u043b\u044f \u043f\u0435\u0442\u043e\u0432 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435<\/p>\n<\/li>\n<li>\n<p>SuperTokens, FusionAuth (\u043d\u0435\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c)<\/p>\n<\/li>\n<li>\n<p><strong><em>Ory Kratos<\/em><\/strong>. \u041d\u0430 \u043d\u0435\u043c \u044f \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f, \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432\u0441\u0435 \u0445\u043e\u0442\u0435\u043b\u043a\u0438 \u0431\u044b\u043b\u0438 \u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043f\u0435\u0440\u0432\u0443\u044e \u043c\u0430\u0436\u043e\u0440\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 Ory. \u0414\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u0432 \u0443\u0433\u043e\u0434\u0443 \u043c\u043e\u0435\u0433\u043e \u043d\u0435\u0437\u0434\u043e\u0440\u043e\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u043d\u0430 \u043d\u0435\u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u0442 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0411\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0435 vs \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 API<\/h2>\n<p>\u0412 Kratos \u0432\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u0434\u0432\u0430 API \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><strong><em>\u0411\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0435<\/em><\/strong> &#8212; \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c. \u041f\u0440\u0438 \u043b\u043e\u0433\u0438\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u043d\u0430 \u043a\u0443\u043a\u0430 \u0441\u0435\u0441\u0441\u0438\u0438 \u0438 \u0430\u043d\u0442\u0438 <a href=\"https:\/\/owasp.org\/www-community\/attacks\/csrf\" rel=\"noopener noreferrer nofollow\">CSRF<\/a> \u0442\u043e\u043a\u0435\u043d, \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u0435\u0441\u0441\u0438\u0438 \u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 (react, vue, angular \u0438.\u0442.\u0434.) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>toSession()<\/code> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><strong><em>\u041d\u0430\u0442\u0438\u0432\u043d\u043e\u0435<\/em><\/strong> &#8212; \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0449\u0430\u044e\u0442\u0441\u044f \u0441 Kratos \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e API (\u0442\u0430\u043a\u0436\u0435 \u044d\u0442\u043e\u0442 \u0432\u0438\u0434 API \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439). \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u044d\u0442\u0438\u043c API \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u043d \u0442\u043e\u043a\u0435\u043d \u0441\u0435\u0441\u0441\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0443\u043a\u0438, \u043e\u043d \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d \u043a\u0443\u043a\u0435 \u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 <code>toSession()<\/code> \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430 \u0442\u0430 \u0436\u0435 \u0441\u0435\u0441\u0441\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 API \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438, Kratos \u0432\u0435\u0440\u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443:<\/p>\n<pre><code class=\"json\"> \"messages\": [ { \"id\": 4000001, \"text\": \"The HTTP Request Header included the \\\"Cookie\\\" key, indicating that this request was made by a Browser. The flow however was initiated as an API request. To prevent potential misuse and mitigate several attack vectors including CSRF, the request has been blocked. Please consult the documentation.\", \"type\": \"error\" } ]<\/code><\/pre>\n<h2>\u041c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (Identity)<\/h2>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 Kratos \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 Identity, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 <a href=\"https:\/\/json-schema.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 JSON schema<\/a> \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0439\u0442\u043e\u0432 (\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c. <\/p>\n<p>\u0423 \u043a\u0430\u0436\u0434\u043e\u0439 identity \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u0432\u043e\u044f JSON \u0441\u0445\u0435\u043c\u0430, \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0436\u0438\u0432\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>client<\/code> \u0438 <code>manager<\/code>), \u0442\u0430\u043a \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u0440\u043e\u0431\u043e\u0442\u044b \u0438.\u0442.\u0434. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430 \u0441\u0445\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u0441\u0445\u0435\u043c\u043e\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u0434\u0430\u043b\u0435\u0435 flows) \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u044d\u0442\u043e\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 (\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f, \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438.\u0442.\u0434). <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c identity \u0441\u043e \u0441\u0445\u0435\u043c\u043e\u0439 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0430\u0434\u043c\u0438\u043d\u0441\u043a\u0438\u0439 API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>POST \/admin\/identities<\/code> \u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/www.ory.sh\/docs\/kratos\/manage-identities\/invite-users\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439<\/a>. <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0445\u0435\u043c\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"yaml\"># kratos.yml identity:   # \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 flows   default_schema_id: user    schemas:     - id: user       # \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0432 base64 \u0438\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c url \u0434\u043e \u0441\u0445\u0435\u043c\u044b       url: file:\/\/\/etc\/config\/kratos\/schemas\/user.schema.json      - id: organizer       url: file:\/\/\/etc\/config\/kratos\/schemas\/organizer.schema.json<\/code><\/pre>\n<h2>\u0422\u0440\u0435\u0439\u0442\u044b (\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f)<\/h2>\n<p>\u0422\u0440\u0435\u0439\u0442\u044b \u044d\u0442\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 identity, \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 JSON \u0441\u0445\u0435\u043c\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u0438\u043d \u0442\u0440\u0435\u0439\u0442 \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 email \u0438\u043b\u0438 username) \u0438 \u043e\u0434\u0438\u043d \u0442\u0440\u0435\u0439\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (\u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435).<\/p>\n<p>\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0445\u0435\u043c\u044b <code>user<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0440\u0435\u0439\u0442\u044b, \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u043e\u0434\u0438\u043d \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 &#8212; email \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/www.ory.sh\/docs\/kratos\/manage-identities\/overview\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>):<\/p>\n<pre><code class=\"json\">\/\/ user.schema.json {   \"$id\": \"user\",   \"$schema\": \"http:\/\/json-schema.org\/draft-07\/schema#\",   \"title\": \"User\",   \"type\": \"object\",   \"properties\": {     \"traits\": {       \"type\": \"object\",       \"properties\": {         \"email\": {           \"type\": \"string\",           \"format\": \"email\",           \/\/ \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0432 GUI           \"title\": \"E-Mail\",           \"minLength\": 3,           \"ory.sh\/kratos\": {             \"credentials\": {               \"password\": {                 \/\/ email \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c                 \"identifier\": true               }             },             \"verification\": {               \"via\": \"email\"             },             \"recovery\": {               \"via\": \"email\"             }           }         },         \"name\": {           \"type\": \"object\",           \"properties\": {             \"first\": {               \"title\": \"First Name\",               \"type\": \"string\"             },             \"last\": {               \"title\": \"Last Name\",               \"type\": \"string\"             }           }         }       },       \"required\": [         \"email\"       ],       \"additionalProperties\": false     }   } }<\/code><\/pre>\n<h2>\u041f\u043e\u0442\u043e\u043a\u0438? (flows)<\/h2>\n<p>\u042d\u0442\u043e \u0434\u0432\u0443\u0445\u044d\u0442\u0430\u043f\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u043c. \u0412 Kratos \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 flows:<\/p>\n<ul>\n<li>\n<p>\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0445\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044f (\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0435\u0439\u0442\u043e\u0432)<\/p>\n<\/li>\n<li>\n<p>\u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430\/\u0430\u0434\u0440\u0435\u0441\u0430 \u044d\u043b. \u043f\u043e\u0447\u0442\u044b<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 <\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u043d\u0438 \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 2 \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (submit) flow. <\/p>\n<p>\u041d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043d\u0438\u0436\u0435 \u0441\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d \u043e\u0434\u0438\u043d \u0438\u0437 flow &#8212; \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/30c\/6b0\/4b8\/30c6b04b862e8c09dd21bd94f050c371.png\" alt=\"Sign Up flow\" title=\"Sign Up flow\" width=\"1706\" height=\"1260\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/30c\/6b0\/4b8\/30c6b04b862e8c09dd21bd94f050c371.png\"\/><\/p>\n<div><figcaption>Sign Up flow<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 flow \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0440\u0435\u0439\u0442\u043e\u0432 \u0438\u0437 \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0442\u0440\u0435\u0439\u0442\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0432 \u043f\u043e\u043b\u0435 <code>ui<\/code> \u0432 \u0432\u0438\u0434\u0435 \u0444\u043e\u0440\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435), \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 CSRF \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u0438 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b:<\/p>\n<pre><code class=\"json\">{     \/\/ ...     \"type\": \"browser\",     \"ui\": {         \"action\": \"http:\/\/127.0.0.1:4433\/self-service\/login?flow=8fb1a5a7-84a5-48ad-8acf-d6b7cc8b2870\",         \"method\": \"POST\",         \"nodes\": [             {                 \"type\": \"input\",                 \"group\": \"default\",                 \"attributes\": {                     \"name\": \"csrf_token\",                     \"type\": \"hidden\",                     \"value\": \"I99Gz\/6E81iBy7d82QLknt6MNO\/jEw\/k8B60l101XbTCIsh5izXLmZV5GiOEU45XEF2JV4FKldMi5+Cyvj7LAA==\",                     \"required\": true,                     \"disabled\": false,                     \"node_type\": \"input\"                 },                 \"messages\": [],                 \"meta\": {}             },             {                 \"type\": \"input\",                 \"group\": \"default\",                 \"attributes\": {                     \"name\": \"identifier\",                     \"type\": \"text\",                     \"value\": \"\",                     \"required\": true,                     \"disabled\": false,                     \"node_type\": \"input\"                 },                 \"messages\": [],                 \"meta\": {                     \"label\": {                         \"id\": 1070004,                         \"text\": \"ID\",                         \"type\": \"info\"                     }                 }             },             {                 \"type\": \"input\",                 \"group\": \"password\",                 \"attributes\": {                     \"name\": \"password\",                     \"type\": \"password\",                     \"required\": true,                     \"autocomplete\": \"current-password\",                     \"disabled\": false,                     \"node_type\": \"input\"                 },                 \"messages\": [],                 \"meta\": {                     \"label\": {                         \"id\": 1070001,                         \"text\": \"Password\",                         \"type\": \"info\"                     }                 }             },             {                 \"type\": \"input\",                 \"group\": \"password\",                 \"attributes\": {                     \"name\": \"method\",                     \"type\": \"submit\",                     \"value\": \"password\",                     \"disabled\": false,                     \"node_type\": \"input\"                 },                 \"messages\": [],                 \"meta\": {                     \"label\": {                         \"id\": 1010001,                         \"text\": \"Sign in\",                         \"type\": \"info\",                         \"context\": {}                     }                 }             }         ]     },     \/\/ ... }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f flow, \u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435:<\/p>\n<pre><code class=\"yaml\">selfservice: flows: login: before: # \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 flow hooks:           - hook: hook_1 after: # \u043f\u0440\u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438 flow hooks:                 # \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438                 # \u043a\u0440\u043e\u043c\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e - hook: hook_2  password: hooks:             # \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e - hook: hook_3 <\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0445\u0443\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.ory.sh\/docs\/kratos\/hooks\/configure-hooks\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0435\u0441\u0441\u0438\u0438 \u0438\u0437 Go \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 HTTP middleware:<\/p>\n<pre><code class=\"go\">package httpapi  import ( \"errors\" \"fmt\" \"net\/http\" \"context\"  kratos \"github.com\/ory\/kratos-client-go\" )  func newAuthMiddleware(client *kratos.APIClient) func(http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { cookie, err := r.Cookie(\"ory_kratos_session\") if err != nil { w.WriteHeader(http.StatusUnauthorized) return }  ctx := r.Context()  \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0435\u0441\u0441\u0438\u044e \u0438\u0437 Kratos session, resp, err := client.FrontendApi. ToSession(ctx). Cookie(cookie.String()). Execute() if err != nil { w.WriteHeader(http.StatusUnauthorized) return }  if resp.StatusCode != http.StatusOK { w.WriteHeader(http.StatusUnauthorized) return }  if !session.GetActive() { w.WriteHeader(http.StatusUnauthorized) return }              identity := session.GetIdentity()  \/\/ \u0435\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u044e\u0437\u0435\u0440 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0445\u0435\u043c\u0435 \u0441 id = organizer if identity.SchemaId != \"organizer\" { w.WriteHeader(http.StatusForbidden) return }  \/\/ \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c identity id \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ctx = context.WithValue(ctx, \"identity_id\", identity.Id) r = r.WithContext(ctx) next.ServeHTTP(w, r) }) } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043c\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u0445\u043e\u0434\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u043e \u0441\u0435\u0442\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u0440\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Ory Oathkeeper \u043a\u0430\u043a \u043f\u0440\u043e\u043a\u0441\u0438 \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u041f\u0440\u043e\u043a\u0441\u0438 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0441\u0435\u0441\u0441\u0438\u044e \u0432 JWT \u0438 \u0434\u0430\u043b\u0435\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435, \u0432\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>sessionToken()<\/code> \u0432 \u043c\u0435\u0441\u0442\u0435 \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0432 \u043d\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0442\u043e\u043a\u0435\u043d. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e Oathkeeper \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/www.ory.sh\/docs\/oathkeeper\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<h2>\u0412\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b<\/h2>\n<p>Kratos \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/oauth.net\/2\/\" rel=\"noopener noreferrer nofollow\">OAuth2<\/a>  \u0438\u043b\u0438 <a href=\"https:\/\/openid.net\/specs\/openid-connect-core-1_0.html\" rel=\"noopener noreferrer nofollow\">OpenID Connect<\/a>, \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u0445\u043e\u0434 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <code>twitch<\/code>, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f <code>SELFSERVICE_METHODS_OIDC_CONFIG_PROVIDERS<\/code> \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON \u043c\u0430\u0441\u0441\u0438\u0432\u0430:<\/p>\n<pre><code class=\"json\">[   {     \"id\": \"twitch\",     \"provider\": \"generic\",     \/\/ \u0432\u0437\u044f\u0442\u044c \u0432 \u041b\u041a twitch dev.twitch.tv\/console     \"client_id\": \"CLIENT_ID\",      \"client_secret\": \"CLIENT_SECRET\",     \"issuer_url\": \"https:\/\/id.twitch.tv\/oauth2\",     \/\/ \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 base64 \u0438\u043b\u0438 url \u043d\u0430 jsonnet      \"mapper_url\": \"file:\/\/\/etc\/oidc\/oidc.twitch.jsonnet\",      \"scope\": [       \"openid\",       \"user:read:email\"     ],     \"requested_claims\": {       \"id_token\": {         \"email\": {           \"essential\": true         },         \"email_verified\": {           \"essential\": true         }       }     }   } ]<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043c\u0430\u043f\u043f\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 (claims), \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u043c, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u043f\u043f\u0435\u0440 <a href=\"https:\/\/jsonnet.org\/\" rel=\"noopener noreferrer nofollow\">Jsonnet<\/a>, \u043f\u0443\u0442\u044c \u043d\u0430 \u043c\u0430\u043f\u043f\u0435\u0440 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u043a \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0443 \u0432 \u043f\u043e\u043b\u0435 <code>mapper_url<\/code> (\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0448\u0435). \u041c\u0430\u043f\u043f\u0435\u0440 \u0434\u043b\u044f twitch:<\/p>\n<pre><code class=\"json\">\/\/ oidc.twitch.jsonnet ocal claims = {   email_verified: false, } + std.extVar('claims');  { identity: { traits: { \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u044d\u043b. \u043f\u043e\u0447\u0442\u044b \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 claims,             \/\/\u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0430 \u0432 twitch     [if 'email' in claims &amp;&amp; claims.email_verified then 'email' else null]: claims.email, }, }, }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433, \u0434\u043b\u044f flow \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0438 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438 \u0444\u043e\u0440\u043c\u044b:<\/p>\n<pre><code class=\"json\">{     \/\/ ...     \"ui\": {         \"action\": \"http:\/\/127.0.0.1:4433\/self-service\/login?flow=8fb1a5a7-84a5-48ad-8acf-d6b7cc8b2870\",         \"method\": \"POST\",         \"nodes\": [             {                 \"type\": \"input\",                 \"group\": \"oidc\",                 \"attributes\": {                     \"name\": \"provider\",                     \"type\": \"submit\",                     \"value\": \"twitch\",                     \"disabled\": false,                     \"node_type\": \"input\"                 },                 \"messages\": [],                 \"meta\": {                     \"label\": {                         \"id\": 1010002,                         \"text\": \"Sign in with twitch\",                         \"type\": \"info\",                         \"context\": {                             \"provider\": \"twitch\"                         }                     }                 }             },             \/\/ ...         ]     },     \/\/ ... }<\/code><\/pre>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442: <a href=\"https:\/\/www.ory.sh\/docs\/kratos\/social-signin\/generic\" rel=\"noopener noreferrer nofollow\">\u0442\u044b\u043a<\/a>.<\/p>\n<h2>\u041f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a<\/h2>\n<p>\u0412 <a href=\"https:\/\/github.com\/ory\/kratos\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 Kratos<\/a> \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 docker-compose, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043a\u0430\u0436\u0443 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0435:<\/p>\n<pre><code class=\"yaml\"># docker-compose.yml version: '3.7'  networks:   intranet:  volumes:   kratos-pg:  services:   kratos-pg:     image: postgres:16.1-alpine     volumes:       - type: volume         source: kratos-pg         target: \/var\/lib\/postgresql\/data         read_only: false     ports:       - \"5432:5432\"     environment:       - POSTGRES_USER=kratos       - POSTGRES_PASSWORD=secret       - POSTGRES_DB=kratos     networks:       - intranet   kratos-migrate:     depends_on:       - kratos-pg     image: oryd\/kratos:1.0.0     env_file:       - .env     environment:       - DSN=postgres:\/\/kratos:secret@kratos-pg:5432\/kratos?sslmode=disable&amp;max_conns=20&amp;max_idle_conns=4     volumes:       - type: volume         source: kratos-pg         target: \/var\/lib\/postgresql\/data         read_only: false       - type: bind         source: ${CONFIG_PATH:?err} # \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u0440\u0430\u0442\u043e\u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0430         target: \/etc\/config\/kratos\/kratos.yml     command: -c \/etc\/config\/kratos\/kratos.yml migrate sql -e --yes     restart: on-failure     networks:       - intranet   kratos:     depends_on:       - kratos-migrate     image: oryd\/kratos:1.0.0     ports:       - '4433:4433' # \u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e API       - '4434:4434' # \u043f\u043e\u0440\u0442 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d API     restart: unless-stopped     env_file:       - .env     environment:       - DSN=postgres:\/\/kratos:secret@kratos-pg:5432\/kratos?sslmode=disable&amp;max_conns=20&amp;max_idle_conns=4     command: serve -c \/etc\/config\/kratos\/kratos.yml --dev --watch-courier     volumes:       - type: volume         source: kratos-pg         target: \/var\/lib\/postgresql\/data         read_only: false       - type: bind         source: ${CONFIG_PATH:?err}         target: \/etc\/config\/kratos\/kratos.yml       - type: bind         source: .\/schemas\/ # \u043f\u0443\u0442\u044c \u0434\u043e identity \u0441\u0445\u0435\u043c         target: \/etc\/config\/kratos\/schemas\/       - type: bind         source: .\/oidc         target: \/etc\/oidc     networks:       - intranet   kratos-selfservice-ui-node: # \u0434\u0435\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u0432\u0441\u0435 flow     image: oryd\/kratos-selfservice-ui-node:1.0.0     ports:       - \"4455:4455\"     env_file:       - .env     environment:       - PORT=4455       - SECURITY_MODE=     networks:       - intranet     restart: on-failure   mailslurper: # smtp \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438     image: oryd\/mailslurper:latest-smtps     ports:       - '4436:4436'       - '4437:4437'     networks:       - intranet<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 <code>4455<\/code> \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0434\u0435\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u0432\u0441\u0435 flow. \u0424\u043e\u0440\u043c\u044b \u0434\u043b\u044f flow \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0438\u0437 Kratos \u0441 \u043f\u043e\u043b\u044f\u043c\u0438 identity \u0441\u0445\u0435\u043c \u0438 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0434\u043b\u044f oauth\/oidc \u0432\u0445\u043e\u0434\u0430 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f flow:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8fe\/3a8\/eba\/8fe3a8ebaf0fd84d664dd3094d2671c0.png\" alt=\"Flow \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438\" title=\"Flow \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438\" width=\"3436\" height=\"1986\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8fe\/3a8\/eba\/8fe3a8ebaf0fd84d664dd3094d2671c0.png\"\/><\/p>\n<div><figcaption>Flow \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043f\u043e email. \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 flow \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043f\u0438\u0441\u044c\u043c\u043e, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 <a href=\"https:\/\/github.com\/mailslurper\/mailslurper\" rel=\"noopener noreferrer nofollow\">mailslurper<\/a> \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 <code>4436<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/182\/02b\/744\/18202b744fcf7d4b7b9200a44bafec47.png\" alt=\"\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 mailslurper\" title=\"\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 mailslurper\" width=\"3440\" height=\"1994\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/182\/02b\/744\/18202b744fcf7d4b7b9200a44bafec47.png\"\/><\/p>\n<div><figcaption>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 mailslurper<\/figcaption><\/div>\n<\/figure>\n<h2>\u041c\u0435\u0442\u0440\u0438\u043a\u0438<\/h2>\n<p>\u0412\u0441\u0435 Ory \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e Kratos, \u0438\u043c\u0435\u044e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f prometheus \u043c\u0435\u0442\u0440\u0438\u043a: <code>\/metrics\/prometheus<\/code><\/p>\n<h2>\u0422\u0440\u0435\u0439\u0441\u0438\u043d\u0433<\/h2>\n<p>\u041a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0440\u0435\u0439\u0441\u0438\u043d\u0433 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/www.ory.sh\/docs\/kratos\/guides\/tracing\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/www.jaegertracing.io\/\" rel=\"noopener noreferrer nofollow\">Jaeger<\/a>.<\/p>\n<h2>\u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b Ory<\/h2>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e identity \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0443 Ory \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/ory\/oathkeeper\" rel=\"noopener noreferrer nofollow\">Ory Oathkeeper<\/a> &#8212; zero trust \u043f\u0440\u043e\u043a\u0441\u0438 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ory\/keto\" rel=\"noopener noreferrer nofollow\">Ory Keto<\/a> &#8212; \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ory\/hydra\" rel=\"noopener noreferrer nofollow\">Ory Hydra<\/a> &#8212; OpenID Connect\/OAuth2 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/quickstart\" rel=\"noopener noreferrer nofollow\">\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ory\/kratos\/blob\/master\/.schema\/openapi.json\" rel=\"noopener noreferrer nofollow\">HTTP API \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/manage-identities\/overview\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u043c\u043e\u0434\u0435\u043b\u0438 Identity<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/self-service\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e Flows<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/manage-identities\/invite-users\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/session-management\/overview\" rel=\"noopener noreferrer nofollow\">\u0421\u0435\u0441\u0441\u0438\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/reference\/configuration\" rel=\"noopener noreferrer nofollow\">\u0428\u0430\u0431\u043b\u043e\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/emails-sms\/sending-emails-smtp\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 SMTP<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/social-signin\/overview\" rel=\"noopener noreferrer nofollow\">\u0412\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/passwordless\/passwordless\" rel=\"noopener noreferrer nofollow\">Paswordless \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/mfa\/overview\" rel=\"noopener noreferrer nofollow\">\u041c\u043d\u043e\u0433\u043e\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u0430\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/guides\/deploy-kratos-example\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u0434\u0435\u043f\u043b\u043e\u044e \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/guides\/tracing\" rel=\"noopener noreferrer nofollow\">\u0422\u0440\u0435\u0439\u0441\u0438\u043d\u0433<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.ory.sh\/docs\/kratos\/guides\/zero-trust-iap-proxy-identity-access-proxy\" rel=\"noopener noreferrer nofollow\">Zero Trust \u043f\u0440\u043e\u043a\u0441\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ory\/kratos-client-go\" rel=\"noopener noreferrer nofollow\">Kratos Go \u043a\u043b\u0438\u0435\u043d\u0442<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/ory\/client-go\" rel=\"noopener noreferrer nofollow\">Ory Go \u043a\u043b\u0438\u0435\u043d\u0442<\/a> &#8212; \u043a\u043b\u0438\u0435\u043d\u0442 \u043a\u043e \u0432\u0441\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c Ory \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0430\u043a\u0435\u0442\u0435<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/779534\/\"> https:\/\/habr.com\/ru\/articles\/779534\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>Ory Kratos &#8212; \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 cloud native \u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 PassKeys, MFA, FIDO2, TOTP, WebAuthn, \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044f\u043c\u0438, \u0441\u0445\u0435\u043c\u0430\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0432\u0445\u043e\u0434\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439, \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430, \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 passwordless \u0432\u0445\u043e\u0434\u0430. \u041d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Go, headless, API-first.<\/p>\n<p>\u0426\u0435\u043b\u044c\u044e \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438 \u043c\u043e\u0439 \u043e\u043f\u044b\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<h2>\u0417\u0430\u0447\u0435\u043c?<\/h2>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0441\u0442\u0440\u043e \u0432\u0441\u0442\u0430\u0432\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043a\u0430\u043a-\u0442\u043e \u0440\u0430\u0437 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u0442\u0440\u043e\u0438\u043b \u0431\u044b \u043c\u0435\u043d\u044f \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0435\u0442\u0430\u0445 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0438\u0445.<\/p>\n<p>\u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u0440\u0438\u0448\u043b\u043e \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0435\u0442\u0443 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0442\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u044e\u0437\u0435\u0440\u043e\u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 (\u043c\u043e\u0433\u043b\u0430 \u0431\u044b\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e \u044d\u043c\u0435\u0439\u043b\u0443, \u0433\u0434\u0435-\u0442\u043e \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443, \u0430 \u0433\u0434\u0435-\u0442\u043e \u0435\u0449\u0435 \u0438 oauth2\/oidc \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0441\u044f \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0440\u044b\u043b\u0438 \u0431\u044b \u043c\u043e\u0438 \u0445\u043e\u0442\u0435\u043b\u043a\u0438. \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043d\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441 \u044d\u043b. \u043f\u043e\u0447\u0442\u044b \u0438 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f)<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0441\u043e\u0431\u0430\u0447\u0438\u0442\u044c OAuth2\/OpenID Connect \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432, \u0441 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u043c\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0438 open source, \u0441 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438 \u0438 \u043c\u043d\u043e\u0433\u043e \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u0435\u043a \u0432 github (\u043a\u0443\u0434\u0430 \u0436\u0435 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e)<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u044e\u0437\u0435\u0440\u043e\u0432, \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u0435\u0439 \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>headless, \u0441 \u043d\u0430\u043b\u0438\u0447\u0438\u0435\u043c HTTP\/gRPC API<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b:<\/p>\n<ul>\n<li>\n<p>Firebase, auth0 (\u043f\u043b\u0430\u0442\u043d\u043e, \u043d\u0435\u0442\u0443 self hosted \u0440\u0435\u0448\u0435\u043d\u0438\u044f)<\/p>\n<\/li>\n<li>\n<p>Keycloak (\u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u0434\u0438\u043d\u043e\u0437\u0430\u0432\u0440\u043e\u043c, \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0439\u0434\u044f \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0443 \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u043d\u0435 \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f). \u041c\u043e\u0436\u0435\u0442\u0435 \u043a\u0438\u0434\u0430\u0442\u044c \u0432 \u043c\u0435\u043d\u044f \u043a\u0430\u043c\u043d\u044f\u043c\u0438 \u0437\u0430 \u0442\u0430\u043a\u043e\u0435 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0437\u044f\u0442\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u0434\u043b\u044f \u043f\u0435\u0442\u043e\u0432 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435<\/p>\n<\/li>\n<li>\n<p>SuperTokens, FusionAuth (\u043d\u0435\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c)<\/p>\n<\/li>\n<li>\n<p><strong><em>Ory Kratos<\/em><\/strong>. \u041d\u0430 \u043d\u0435\u043c \u044f \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f, \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432\u0441\u0435 \u0445\u043e\u0442\u0435\u043b\u043a\u0438 \u0431\u044b\u043b\u0438 \u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043f\u0435\u0440\u0432\u0443\u044e \u043c\u0430\u0436\u043e\u0440\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 Ory. \u0414\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u0432 \u0443\u0433\u043e\u0434\u0443 \u043c\u043e\u0435\u0433\u043e \u043d\u0435\u0437\u0434\u043e\u0440\u043e\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u043d\u0430 \u043d\u0435\u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u0442 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0411\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0435 vs \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 API<\/h2>\n<p>\u0412 Kratos \u0432\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u0434\u0432\u0430 API \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><strong><em>\u0411\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0435<\/em><\/strong> &#8212; \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c. \u041f\u0440\u0438 \u043b\u043e\u0433\u0438\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u043d\u0430 \u043a\u0443\u043a\u0430 \u0441\u0435\u0441\u0441\u0438\u0438 \u0438 \u0430\u043d\u0442\u0438 <a href=\"https:\/\/owasp.org\/www-community\/attacks\/csrf\" rel=\"noopener noreferrer nofollow\">CSRF<\/a> \u0442\u043e\u043a\u0435\u043d, \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u0435\u0441\u0441\u0438\u0438 \u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 (react, vue, angular \u0438.\u0442.\u0434.) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>toSession()<\/code> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><strong><em>\u041d\u0430\u0442\u0438\u0432\u043d\u043e\u0435<\/em><\/strong> &#8212; \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0449\u0430\u044e\u0442\u0441\u044f \u0441 Kratos \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e API (\u0442\u0430\u043a\u0436\u0435 \u044d\u0442\u043e\u0442 \u0432\u0438\u0434 API \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439). \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u044d\u0442\u0438\u043c API \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u043d \u0442\u043e\u043a\u0435\u043d \u0441\u0435\u0441\u0441\u0438\u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0443\u043a\u0438, \u043e\u043d \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d \u043a\u0443\u043a\u0435 \u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 <code>toSession()<\/code> \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430 \u0442\u0430 \u0436\u0435 \u0441\u0435\u0441\u0441\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 API \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438, Kratos \u0432\u0435\u0440\u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443:<\/p>\n<pre><code class=\"json\"> \"messages\": [ { \"id\": 4000001, \"text\": \"The HTTP Request Header included the \\\"Cookie\\\" key, indicating that this request was made by a Browser. The flow however was initiated as an API request. To prevent potential misuse and mitigate several attack vectors including CSRF, the request has been blocked. Please consult the documentation.\", \"type\": \"error\" } ]<\/code><\/pre>\n<h2>\u041c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (Identity)<\/h2>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 Kratos \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 Identity, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 <a href=\"https:\/\/json-schema.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 JSON schema<\/a> \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0439\u0442\u043e\u0432 (\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c. <\/p>\n<p>\u0423 \u043a\u0430\u0436\u0434\u043e\u0439 identity \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u0432\u043e\u044f JSON \u0441\u0445\u0435\u043c\u0430, \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0436\u0438\u0432\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>client<\/code> \u0438 <code>manager<\/code>), \u0442\u0430\u043a \u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u0440\u043e\u0431\u043e\u0442\u044b \u0438.\u0442.\u0434. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430 \u0441\u0445\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u0441\u0445\u0435\u043c\u043e\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u0434\u0430\u043b\u0435\u0435 flows) \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u044d\u0442\u043e\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 (\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f, \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438.\u0442.\u0434). <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c identity \u0441\u043e \u0441\u0445\u0435\u043c\u043e\u0439 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0430\u0434\u043c\u0438\u043d\u0441\u043a\u0438\u0439 API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>POST \/admin\/identities<\/code> \u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/www.ory.sh\/docs\/kratos\/manage-identities\/invite-users\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439<\/a>. <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0445\u0435\u043c\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"yaml\"># kratos.yml identity:   # \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 flows   default_schema_id: user    schemas:     - id: user       # \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0432 base64 \u0438\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c url \u0434\u043e \u0441\u0445\u0435\u043c\u044b       url: file:\/\/\/etc\/config\/kratos\/schemas\/user.schema.json      - id: organizer       url: file:\/\/\/etc\/config\/kratos\/schemas\/organizer.schema.json<\/code><\/pre>\n<h2>\u0422\u0440\u0435\u0439\u0442\u044b (\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f)<\/h2>\n<p>\u0422\u0440\u0435\u0439\u0442\u044b \u044d\u0442\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 identity, \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 JSON \u0441\u0445\u0435\u043c\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u0438\u043d \u0442\u0440\u0435\u0439\u0442 \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 email \u0438\u043b\u0438 username) \u0438 \u043e\u0434\u0438\u043d \u0442\u0440\u0435\u0439\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (\u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435).<\/p>\n<p>\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0445\u0435\u043c\u044b <code>user<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0440\u0435\u0439\u0442\u044b, \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u043e\u0434\u0438\u043d \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 &#8212; email \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/www.ory.sh\/docs\/kratos\/manage-identities\/overview\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>):<\/p>\n<pre><code class=\"json\">\/\/ user.schema.json {   \"$id\": \"user\",   \"$schema\": \"http:\/\/json-schema.org\/draft-07\/schema#\",   \"title\": \"User\",   \"type\": \"object\",   \"properties\": {     \"traits\": {       \"type\": \"object\",       \"properties\": {         \"email\": {           \"type\": \"string\",           \"format\": \"email\",           \/\/ \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0432 GUI           \"title\": \"E-Mail\",           \"minLength\": 3,           \"ory.sh\/kratos\": {             \"credentials\": {               \"password\": {                 \/\/ email \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c                 \"identifier\": true               }             },             \"verification\": {               \"via\": \"email\"             },             \"recovery\": {               \"via\": \"email\"             }           }         },         \"name\": {           \"type\": \"object\",           \"properties\": {             \"first\": {               \"title\": \"First Name\",               \"type\": \"string\"             },             \"last\": {               \"title\": \"Last Name\",               \"type\": \"string\"             }           }         }       },       \"required\": [         \"email\"       ],       \"additionalProperties\": false     }   } }<\/code><\/pre>\n<h2>\u041f\u043e\u0442\u043e\u043a\u0438? (flows)<\/h2>\n<p>\u042d\u0442\u043e \u0434\u0432\u0443\u0445\u044d\u0442\u0430\u043f\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u043c. \u0412 Kratos \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 flows:<\/p>\n<ul>\n<li>\n<p>\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0445\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u044f (\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0435\u0439\u0442\u043e\u0432)<\/p>\n<\/li>\n<li>\n<p>\u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043d\u043e\u043c\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430\/\u0430\u0434\u0440\u0435\u0441\u0430 \u044d\u043b. \u043f\u043e\u0447\u0442\u044b<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 <\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u043d\u0438 \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 2 \u0437\u0430\u043f\u0440\u043e\u0441\u0430: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (submit) flow. <\/p>\n<p>\u041d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043d\u0438\u0436\u0435 \u0441\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d \u043e\u0434\u0438\u043d \u0438\u0437 flow &#8212; \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>Sign Up flow<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 flow \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0440\u0435\u0439\u0442\u043e\u0432 \u0438\u0437 \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0442\u0440\u0435\u0439\u0442\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0432 \u043f\u043e\u043b\u0435 <code>ui<\/code> \u0432 \u0432\u0438\u0434\u0435 \u0444\u043e\u0440\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435), \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 CSRF \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u0438 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b:<\/p>\n<pre><code class=\"json\">{     \/\/ ...     \"type\": \"browser\",     \"ui\": {         \"action\": \"http:\/\/127.0.0.1:4433\/self-service\/login?flow=8fb1a5a7-84a5-48ad-8acf-d6b7cc8b2870\",         \"method\": \"POST\",         \"nodes\": [             {                 \"type\": \"input\",                 \"group\": \"default\",                 \"attributes\": {                     \"name\": \"csrf_token\",                     \"type\": \"hidden\",                     \"value\": \"I99Gz\/6E81iBy7d82QLknt6MNO\/jEw\/k8B60l101XbTCIsh5izXLmZV5GiOEU45XEF2JV4FKldMi5+Cyvj7LAA==\",                     \"required\": true,                     \"disabled\": false,                     \"node_type\": \"input\"                 },                 \"messages\": [],                 \"meta\": {}             },             {                 \"type\": \"input\",                 \"group\": \"default\",                 \"attributes\": {                     \"name\": \"identifier\",                     \"type\": \"text\",                     \"value\": \"\",                     \"required\": true,                     \"disabled\": false,                     \"node_type\": \"input\"                 },                 \"messages\": [],                 \"meta\": {                     \"label\": {                         \"id\": 1070004,                         \"text\": \"ID\",                         \"type\": \"info\"                     }                 }             },             {                 \"type\": \"input\",                 \"group\": \"password\",                 \"attributes\": {                     \"name\": \"password\",                     \"type\": \"password\",                     \"required\": true,                     \"autocomplete\": \"current-password\",                     \"disabled\": false,                     \"node_type\": \"input\"                 },                 \"messages\": [],                 \"meta\": {                     \"label\": {                         \"id\": 1070001,                         \"text\": \"Password\",                         \"type\": \"info\"                     }                 }             },             {                 \"type\": \"input\",                 \"group\": \"password\",                 \"attributes\": {                     \"name\": \"method\",                     \"type\": \"submit\",                     \"value\": \"password\",                     \"disabled\": false,                     \"node_type\": \"input\"                 },                 \"messages\": [],                 \"meta\": {                     \"label\": {                         \"id\": 1010001,                         \"text\": \"Sign in\",                         \"type\": \"info\",                         \"context\": {}                     }                 }             }         ]     },     \/\/ ... }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f flow, \u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435:<\/p>\n<pre><code class=\"yaml\">selfservice: flows: login: before: # \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 flow hooks:           - hook: hook_1 after: # \u043f\u0440\u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438 flow hooks:                 # \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-362480","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/362480","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=362480"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/362480\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=362480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=362480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=362480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}