{"id":269553,"date":"2015-12-03T13:37:03","date_gmt":"2015-12-03T10:37:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=269553"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=269553","title":{"rendered":"KeyCloak \u2013 \u0449\u0438\u0442 \u043e\u0442 JBOSS \u0434\u043b\u044f WEB \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439"},"content":{"rendered":"<br \/>\n<blockquote><p>\u0418\u0437 \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432:<br \/>   \u2014 \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0443 \u043d\u0430\u0441 \u0434\u044b\u0440\u0430 \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438!<br \/>   \u2014 \u0421\u043b\u0430\u0432\u0430 \u0411\u043e\u0433\u0443, \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0443 \u043d\u0430\u0441 \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438\u2026  <\/p><\/blockquote>\n<p>  <\/p>\n<h2> 1. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <\/h2>\n<p>  \u041f\u0430\u0440\u0443 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u043c\u044b \u0443\u0436\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u043b\u0438 \u0442\u0435\u043c\u0443 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u0422\u043e\u0433\u0434\u0430 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0440\u0430\u0431\u043e\u0442 \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 Service Provider \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c Shibboleth \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 SAML 2.0. <\/p>\n<p>  \u0412 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u0437\u043e\u0440 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 KeyCloak (\u0434\u043e\u0441\u0435\u043b\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0431\u0435\u0437 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c Habr). <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/0ba\/c87\/955\/0bac879557424d68b9f3a62b7f2d4c9e.png\"\/><br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 JEE \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 KeyCloak, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043e\u0431 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043e \u2013 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u043d\u0430\u043b\u0438\u0447\u0438\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u0438 \u043f\u0440\u0430\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0439\u0442\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 (\u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0437\u0430 \u043a\u043e\u0433\u043e \u0441\u0435\u0431\u044f \u0432\u044b\u0434\u0430\u0435\u0442). \u0421\u0430\u043c\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043d\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u044f. \u0422.\u0435. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0441\u0432\u043e\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 (\u0438\u043b\u0438 \u043b\u043e\u0433\u0438\u043d) \u0438 \u043f\u043e\u0434\u043a\u0440\u0435\u043f\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u0430\u0440\u043e\u043b\u0435\u043c, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0435\u043c\u0443. \u0414\u0430\u043b\u0435\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0442\u0435 \u043f\u0440\u0430\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b. \u041a\u0430\u043a \u044d\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u043e\u0442\u043a\u0443\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a \u0432\u0430\u0436\u043d\u043e. \u0412\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0430\u0441\u0441\u0430, \u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b, \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0411\u0414, LDAP \u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433 \u2013 \u044d\u0442\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041e\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. <\/p>\n<h2>2. KeyCloak \u0438 PicketLink \u2013 \u0434\u0432\u0430 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043f\u043e\u0434 \u043e\u0434\u043d\u043e\u0439 \u043a\u0440\u044b\u0448\u0435\u0439<\/h2>\n<p>  \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f JBoss \u0432\u0435\u0434\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439: KeyCloak \u0438 PicketLink. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043e\u0431\u0430 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442 \u0432 \u043e\u0434\u0438\u043d, \u043e \u0447\u0435\u043c \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u0435\u043d\u044c\u043a\u043e \u0445\u043e\u0434\u044f\u0442 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u044b: <a href=\"http:\/\/picketlink.org\/news\/2015\/03\/10\/PicketLink-and-Keycloak-project-merge\/\">picketlink.org\/news\/2015\/03\/10\/PicketLink-and-Keycloak-project-merge<\/a>.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432, \u0445\u043e\u0442\u044f \u043a\u043e\u0435-\u0447\u0442\u043e \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: <a href=\"http:\/\/planet.jboss.org\/post\/what_is_the_difference_between_picketlink_and_keycloak\">planet.jboss.org\/post\/what_is_the_difference_between_picketlink_and_keycloak<\/a>.<\/p>\n<p>  \u0411\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e PicketLink \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. PicketLink \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 API \u0438 \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u0432\u0438\u0434\u0435 quick start \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0412\u0441\u0435 \u044d\u0442\u043e \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/picketlink.org\/\">picketlink.org<\/a>. \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u0435-\u043a\u0430\u043a\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 API \u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u041e\u043a\u043e\u043b\u043e \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434 \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b \u043e\u043f\u044b\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f PicketLink \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 idP \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f SSO \u043d\u0430 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 SAML 2.0. \u0422\u0430\u043a\u0436\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 PicketLink \u0431\u044b\u043b \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d STS \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b REST \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0435\u043c\u0430, \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>  KeyCloak, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u0425\u043e\u0442\u0438\u0442\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0444\u043e\u0440\u043c\u0443 \u043b\u043e\u0433\u0438\u043d\u0430\/\u043f\u0430\u0440\u043e\u043b\u044f, \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u043e\u0442 \u043b\u043e\u0433\u0438\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c SSO, \u043f\u043e\u0434\u043d\u044f\u0442\u044c SAML 2.0 idP \u0441\u0435\u0440\u0432\u0435\u0440 \u2013 \u044d\u0442\u043e \u043f\u043e\u0432\u043e\u0434 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 KeyCloak. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e. <\/p>\n<h2>3. KeyCloak \u2013 \u0431\u0435\u0440\u0435\u043c \u0432\u0441\u0435 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u2026<\/h2>\n<p>  Keycloak (<a href=\"http:\/\/keycloak.jboss.org\/\">http:\/\/keycloak.jboss.org\/<\/a>) \u2014 \u044d\u0442\u043e open-source \u0441\u0435\u0440\u0432\u0435\u0440 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0447\u0435\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 (IDM) \u043e\u0442 JBoss, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0431\u0430\u0437\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 OAuth 2.0, Open ID Connect, JSON Web Token (JWT) \u0438 SAML 2.0.<\/p>\n<p>  \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0438\u0447 KeyCloak \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 SSO, Social Login, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0441 LDAP \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u0438 \u0440\u043e\u043b\u044f\u043c\u0438, \u0438 \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043b\u044e\u0448\u0435\u043a. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0438\u0447 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0443\u0442: <a href=\"http:\/\/keycloak.github.io\/docs\/userguide\/keycloak-server\/html_single\/index.html#Overview\">keycloak.github.io\/docs\/userguide\/keycloak-server\/html_single\/index.html#Overview<\/a>. <\/p>\n<h3>3.1 \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432 KeyCloak?<\/h3>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u0430\u043f\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 KeyCloak \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441\u0445\u0435\u043c\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/26b\/253\/a6e\/26b253a6eb834b908d37add052f13893.jpg\"\/><\/p>\n<p>  \u0428\u0430\u0433 1: \u0417\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u043e URL \u043a \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443. <br \/>  \u0428\u0430\u0433 2: \u0417\u0430\u043a\u0440\u044b\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 KeyCloak.<br \/>  \u0428\u0430\u0433 3: KeyCloak \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 (\u043b\u043e\u0433\u0438\u043d\/\u043f\u0430\u0440\u043e\u043b\u044c, \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043b\u043e\u0433\u0438\u043d, \u0438 \u0442.\u0434.). <br \/>  \u0428\u0430\u0433 4: \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u044d\u0442\u0430\u043f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u0432\u043e\u0434\u0438\u0442 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c.<br \/>  \u0428\u0430\u0433 5: KeyCloak \u0432\u044b\u0434\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d (\u0441\u0435\u043a\u0440\u0435\u0442) \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/>  \u0428\u0430\u0433 6 \u0438 \u0428\u0430\u0433 7: \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u0438 \u043c\u0435\u043d\u044f\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 JWT \u0442\u043e\u043a\u0435\u043d.<br \/>  \u0428\u0430\u0433 8: \u041d\u0430 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u044d\u0442\u0430\u043f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441. <\/p>\n<h3>3.2 \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e JWT<\/h3>\n<p>  JWT (JSON Web Token) \u2014 \u043c\u043e\u043b\u043e\u0434\u043e\u0439 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 (<a href=\"https:\/\/tools.ietf.org\/html\/rfc7519\">https:\/\/tools.ietf.org\/html\/rfc7519<\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u0438 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u043c\u0438 \u0432 \u0432\u0438\u0434\u0435 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u0430. <\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430:  <\/p>\n<ol>\n<li><i>\u041a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439.<\/i> \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 SAML \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 XML), \u0444\u043e\u0440\u043c\u0430\u0442 JWT \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435. \u0421\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0438 \u0446\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c. <\/li>\n<li><i>\u0415\u043c\u043a\u0438\u0439.<\/i> \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0440\u043e\u043b\u0438.<\/li>\n<li><i>\u0421\u0430\u043c\u043e\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0439.<\/i> \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0435\u0434\u0438\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 (\u0441\u0435\u0440\u0432\u0435\u0440\u0443 idP, \u0441\u0435\u0440\u0432\u0438\u0441\u0443 sts). \u042d\u0442\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0438\u043c\u0435\u044f \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447.<\/li>\n<\/ol>\n<p>  \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 \u0442\u043e\u043a\u0435\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0432 base-64 \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0442\u043e\u0447\u043a\u0430\u043c\u0438. \u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c (header), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0442\u0438\u043f \u0442\u043e\u043a\u0435\u043d\u0430 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0445\u044d\u0448-\u0430\u043b\u043e\u0433\u0438\u0440\u0438\u0442\u043c\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438. \u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u0440\u043e\u043b\u0438 \u0438 \u0442.\u0434.). \u0422\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u2013 \u0446\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c. \u0411\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0443\u0442: <a href=\"http:\/\/jwt.io\/introduction\/\">http:\/\/jwt.io\/introduction\/<\/a>. \u0411\u044b\u043b\u0438 \u043f\u043e\u0441\u0442\u044b \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u0438 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <a href=\"http:\/\/habrahabr.ru\/post\/243427\/\">http:\/\/habrahabr.ru\/post\/243427\/<\/a>).<\/p>\n<h3>3.3 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 SSO<\/h3>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u0432 JWT \u0442\u043e\u043a\u0435\u043d, \u043c\u044b \u043f\u043e \u0441\u0443\u0442\u0438 \u0434\u0435\u043b\u0430 \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 SSO. \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432 \u0438 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. <\/p>\n<h2>4. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h2>\n<p>  \u0417\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 KeyCloak \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0432 \u0445\u043e\u0434\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<ol>\n<li>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (video-app), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0438\u0434\u0435\u043e-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. <\/li>\n<li>\u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c KeyCloak.<\/li>\n<li>\u0417\u0430\u0449\u0438\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 KeyCloak.<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c REST \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (video-rest). <\/li>\n<li>\u0417\u0430\u0449\u0438\u0442\u0438\u043c REST \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 KeyCloak. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c bearer \u0442\u043e\u043a\u0435\u043d, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a REST \u0441\u0435\u0440\u0432\u0438\u0441\u0443.<\/li>\n<li>\u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c SSO: \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 video-app, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f video-rest. <\/li>\n<\/ol>\n<p>  \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043d\u0443\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438. \u0423\u0436\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0438\u0437 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f: <a href=\"https:\/\/github.com\/EBTRussia\/keycloak-demo.git\">github.com\/EBTRussia\/keycloak-demo.git<\/a><\/p>\n<h3>4.1 \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438<\/h3>\n<p>  <\/p>\n<ol>\n<li>Maven (\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 3.2) \u043a\u0430\u043a \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0441\u0431\u043e\u0440\u043a\u0438.<\/li>\n<li>WildFly (\u0432\u0435\u0440\u0441\u0438\u044f 9.0.1) \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u0434\u0435\u043f\u043b\u043e\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f KeyCloak). \u0412\u0437\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u0443\u0442: <a href=\"http:\/\/wildfly.org\/downloads\/\">http:\/\/wildfly.org\/downloads\/<\/a>. <\/li>\n<li>KeyCloak (\u0432\u0435\u0440\u0441\u0438\u044f 1.6.1).<\/li>\n<li>RestEasy \u043a\u0430\u043a \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f JAX-RS \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f REST \u0441\u0435\u0440\u0432\u0438\u0441\u0430.\u0418\u0434\u0435\u0442 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0441 WildFly.<\/li>\n<li>JSP\/JSTL \u2013 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044c\u044e\u0448\u0435\u043a. <\/li>\n<li>\u0427\u0443\u0442\u044c-\u0447\u0443\u0442\u044c CSS \u0438 JS. <\/li>\n<\/ol>\n<p>  \u041c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c, \u0447\u0442\u043e \u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0439 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c KeyCloak). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u0441\u0435\u0440\u0438\u0438, \u0447\u0442\u043e-\u0442\u0430\u043a\u043e\u0435 JAX-RS \u0438\u043b\u0438 EJB \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c.<\/p>\n<h3>4.2 \u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u2013 keycloak-demo<\/h3>\n<p>  \u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u0431\u0449\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0432\u0435\u0440\u0441\u0438\u044e JVM.<\/p>\n<h4>4.2.1 \u0424\u0430\u0439\u043b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u2013 pom.xml<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">pom.xml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot;          xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;          xsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&quot;&gt;     &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;      &lt;groupId&gt;com.ebt.ressearch.keycloak&lt;\/groupId&gt;     &lt;artifactId&gt;keycloak-demo&lt;\/artifactId&gt;     &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;     &lt;packaging&gt;pom&lt;\/packaging&gt;      &lt;modules&gt;         &lt;module&gt;common&lt;\/module&gt;         &lt;module&gt;video-app&lt;\/module&gt;         &lt;module&gt;video-rest&lt;\/module&gt;     &lt;\/modules&gt;      &lt;properties&gt;         &lt;version.java&gt;1.8&lt;\/version.java&gt;          &lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;         &lt;version.wildfly.maven.plugin&gt;1.0.2.Final&lt;\/version.wildfly.maven.plugin&gt;         &lt;version.compiler.plugin&gt;3.1&lt;\/version.compiler.plugin&gt;         &lt;version.war.plugin&gt;2.5&lt;\/version.war.plugin&gt;         &lt;version.jboss.bom&gt;9.0.1.Final&lt;\/version.jboss.bom&gt;         &lt;version.keycloak&gt;1.6.1.Final&lt;\/version.keycloak&gt;         &lt;version.jstl&gt;1.2&lt;\/version.jstl&gt;     &lt;\/properties&gt;      &lt;build&gt;         &lt;plugins&gt;             &lt;plugin&gt;                 &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;                 &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;                 &lt;version&gt;2.3.2&lt;\/version&gt;                 &lt;configuration&gt;                     &lt;source&gt;${version.java}&lt;\/source&gt;                     &lt;target&gt;${version.java}&lt;\/target&gt;                 &lt;\/configuration&gt;             &lt;\/plugin&gt;         &lt;\/plugins&gt;     &lt;\/build&gt;      &lt;dependencyManagement&gt;         &lt;dependencies&gt;             &lt;dependency&gt;                 &lt;groupId&gt;org.wildfly.bom&lt;\/groupId&gt;                 &lt;artifactId&gt;jboss-javaee-7.0-wildfly-with-tools&lt;\/artifactId&gt;                 &lt;version&gt;${version.jboss.bom}&lt;\/version&gt;                 &lt;type&gt;pom&lt;\/type&gt;                 &lt;scope&gt;import&lt;\/scope&gt;             &lt;\/dependency&gt;              &lt;dependency&gt;                 &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;                 &lt;artifactId&gt;keycloak-core&lt;\/artifactId&gt;                 &lt;version&gt;${version.keycloak}&lt;\/version&gt;                 &lt;scope&gt;provided&lt;\/scope&gt;             &lt;\/dependency&gt;             &lt;dependency&gt;                 &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;                 &lt;artifactId&gt;keycloak-adapter-core&lt;\/artifactId&gt;                 &lt;version&gt;${version.keycloak}&lt;\/version&gt;                 &lt;scope&gt;provided&lt;\/scope&gt;             &lt;\/dependency&gt;             &lt;dependency&gt;                 &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;                 &lt;artifactId&gt;keycloak-services&lt;\/artifactId&gt;                 &lt;version&gt;${version.keycloak}&lt;\/version&gt;                 &lt;scope&gt;provided&lt;\/scope&gt;             &lt;\/dependency&gt;             &lt;dependency&gt;                 &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;                 &lt;artifactId&gt;keycloak-jboss-adapter-core&lt;\/artifactId&gt;                 &lt;version&gt;${version.keycloak}&lt;\/version&gt;                 &lt;scope&gt;provided&lt;\/scope&gt;             &lt;\/dependency&gt;             &lt;dependency&gt;                 &lt;groupId&gt;javax.servlet&lt;\/groupId&gt;                 &lt;artifactId&gt;jstl&lt;\/artifactId&gt;                 &lt;version&gt;${version.jstl}&lt;\/version&gt;                 &lt;scope&gt;provided&lt;\/scope&gt;             &lt;\/dependency&gt;         &lt;\/dependencies&gt;     &lt;\/dependencyManagement&gt;  &lt;\/project&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3>4.3 \u041c\u043e\u0434\u0443\u043b\u044c \u043e\u0431\u0449\u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 (common)<\/h3>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043e\u0431\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445\/\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430. <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c78\/c07\/85a\/c78c0785aee34edba1aebdfbf8b71e05.png\"\/><\/p>\n<h4>4.3.1 \u0424\u0430\u0439\u043b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u2013 pom.xml<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0424\u0430\u0439\u043b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u2013 pom.xml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot;          xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;          xsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&quot;&gt;     &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;      &lt;parent&gt;         &lt;groupId&gt;com.ebt.ressearch.keycloak&lt;\/groupId&gt;         &lt;artifactId&gt;keycloak-demo&lt;\/artifactId&gt;         &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;     &lt;\/parent&gt;      &lt;artifactId&gt;common&lt;\/artifactId&gt;     &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;     &lt;packaging&gt;jar&lt;\/packaging&gt; &lt;\/project&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>4.3.2 \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u0438\u0434\u0435\u043e \u2013 Video.java<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Video.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package com.ebt.common;  \/**  * \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u0438\u0434\u0435\u043e.  *  * @author EastBanc Technologies (http:\/\/eastbanctech.ru\/)  *\/ public interface Video {      String getSource();      String getId();      String getTitle();      String getUrl();      Double getRating();      VideoCategory getCategory();  } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>4.3.3 \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0432\u0438\u0434\u0435\u043e \u2014 VideoCategory.java<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">VideoCategory.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package com.ebt.common;  \/**  * \u0412\u0438\u0434\u0435\u043e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0412\u0438\u0434\u0435\u043e.  *  * @author EastBanc Technologies (http:\/\/eastbanctech.ru\/)  *\/ public enum VideoCategory {     SPORT,     CARS,     MUSIC, } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3> 4.4 \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0438\u0434\u0435\u043e (video-app)<\/h3>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f53\/621\/034\/f53621034cf54ebda2ea7899b73ac0f4.png\"\/><\/p>\n<h4> 4.4.1 \u0424\u0430\u0439\u043b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u2013 pom.xml <\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">pom.xml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot;          xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;          xsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&quot;&gt;     &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;      &lt;parent&gt;         &lt;groupId&gt;com.ebt.ressearch.keycloak&lt;\/groupId&gt;         &lt;artifactId&gt;keycloak-demo&lt;\/artifactId&gt;         &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;     &lt;\/parent&gt;      &lt;artifactId&gt;video-app&lt;\/artifactId&gt;     &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;     &lt;packaging&gt;war&lt;\/packaging&gt;      &lt;build&gt;         &lt;finalName&gt;video-app&lt;\/finalName&gt;         &lt;plugins&gt;             &lt;plugin&gt;                 &lt;groupId&gt;org.wildfly.plugins&lt;\/groupId&gt;                 &lt;artifactId&gt;wildfly-maven-plugin&lt;\/artifactId&gt;                 &lt;version&gt;${version.wildfly.maven.plugin}&lt;\/version&gt;             &lt;\/plugin&gt;         &lt;\/plugins&gt;     &lt;\/build&gt;      &lt;dependencies&gt;         &lt;dependency&gt;             &lt;groupId&gt;com.ebt.ressearch.keycloak&lt;\/groupId&gt;             &lt;artifactId&gt;common&lt;\/artifactId&gt;             &lt;version&gt;${project.version}&lt;\/version&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;javax.enterprise&lt;\/groupId&gt;             &lt;artifactId&gt;cdi-api&lt;\/artifactId&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.jboss.spec.javax.annotation&lt;\/groupId&gt;             &lt;artifactId&gt;jboss-annotations-api_1.2_spec&lt;\/artifactId&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.jboss.resteasy&lt;\/groupId&gt;             &lt;artifactId&gt;resteasy-jaxrs&lt;\/artifactId&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;javax.servlet&lt;\/groupId&gt;             &lt;artifactId&gt;jstl&lt;\/artifactId&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;             &lt;artifactId&gt;keycloak-core&lt;\/artifactId&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;             &lt;artifactId&gt;keycloak-adapter-core&lt;\/artifactId&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;             &lt;artifactId&gt;keycloak-services&lt;\/artifactId&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;             &lt;artifactId&gt;keycloak-jboss-adapter-core&lt;\/artifactId&gt;         &lt;\/dependency&gt;     &lt;\/dependencies&gt; &lt;\/project&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>4.4.2 \u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u2013 VideoImpl.java<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">VideoImpl.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package com.ebt.videoapp.model;  import com.ebt.common.Video; import com.ebt.common.VideoCategory;  \/**  * \u041e\u0431\u044a\u0435\u043a\u0442 \u0432\u0438\u0434\u0435\u043e.  *  * @author EastBanc Technologies (http:\/\/eastbanctech.ru\/)  *\/ public class VideoImpl implements Video {      private String id;      private String title;      private String url;      private Double rating;      private VideoCategory category;      private String source;      \/\/ \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 get & set \u043c\u0435\u0442\u043e\u0434\u043e\u0432.      } <\/code><\/pre>\n<p>  <i>\u0414\u043b\u044f \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u043c\u0435\u0441\u0442\u0430 get \u0438 set \u043c\u0435\u0442\u043e\u0434\u044b \u043d\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c.<\/i>  <\/div>\n<\/div>\n<h4>4.4.3 \u0421\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0438\u0434\u0435\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u2013 VideoService.java<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">VideoService.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package com.ebt.videoapp.service;  import com.ebt.common.Video; import com.ebt.common.VideoCategory; import com.ebt.videoapp.model.VideoImpl; import java.util.Collections; import java.util.LinkedList; import java.util.List;  \/**  * \u0421\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0412\u0438\u0434\u0435\u043e.  *  * @author EastBanc Technologies (http:\/\/eastbanctech.ru\/)  *\/ public class VideoService {      private List&lt;Video&gt; list = new LinkedList&lt;&gt;();      public VideoService() {          VideoImpl video = new VideoImpl();         video.setTitle(&quot;\u041a\u0440\u0430\u0441\u043d\u0430\u044f \u0424\u0435\u0440\u0440\u0430\u0440\u0438&quot;);         video.setUrl(&quot;http:\/\/www.youtube.com\/watch?v=YJDz2-tT8b4&quot;);         video.setCategory(VideoCategory.CARS);         video.setRating(0.75);         video.setSource(&quot;VIDEO-APP&quot;);         list.add(video);          video = new VideoImpl();         video.setTitle(&quot;Lamborghini Aventador LP700-4&quot;);         video.setUrl(&quot;http:\/\/www.youtube.com\/watch?v=ujn7jEQ4ib4&quot;);         video.setCategory(VideoCategory.CARS);         video.setRating(0.65);         video.setSource(&quot;VIDEO-APP&quot;);         list.add(video);          video = new VideoImpl();         video.setTitle(&quot;Lady Gaga - Bad Romance&quot;);         video.setUrl(&quot;http:\/\/www.youtube.com\/watch?v=qrO4YZeyl0I&quot;);         video.setCategory(VideoCategory.MUSIC);         video.setRating(0.89);         video.setSource(&quot;VIDEO-APP&quot;);         list.add(video);          video = new VideoImpl();         video.setTitle(&quot;Shakira - La La La&quot;);         video.setUrl(&quot;http:\/\/www.youtube.com\/watch?v=7-7knsP2n5w&quot;);         video.setCategory(VideoCategory.MUSIC);         video.setRating(0.88);         video.setSource(&quot;VIDEO-APP&quot;);         list.add(video);          video = new VideoImpl();         video.setTitle(&quot;Zlatan Ibrahimovic Goals & Skills&quot;);         video.setUrl(&quot;http:\/\/www.youtube.com\/watch?v=ijAuwXZnxXc&quot;);         video.setCategory(VideoCategory.SPORT);         video.setRating(0.74);         video.setSource(&quot;VIDEO-APP&quot;);         list.add(video);          video = new VideoImpl();         video.setTitle(&quot;Goodbye Steven Gerrard - You're Irreplaceable&quot;);         video.setUrl(&quot;http:\/\/www.youtube.com\/watch?v=bADTiAUWygA&quot;);         video.setCategory(VideoCategory.SPORT);         video.setRating(0.90);         video.setSource(&quot;VIDEO-APP&quot;);         list.add(video);          Collections.sort(list, (o1, o2) -&gt; Double.compare(o1.getRating(), o2.getRating()));      }      public List&lt;Video&gt; list() {         return list;     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043f\u0440\u044f\u043c\u043e \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 DAO \u0441\u043b\u043e\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<h4>4.4.4 \u0421\u0435\u0440\u0432\u043b\u0435\u0442 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0438\u0434\u0435\u043e<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0435\u0440\u0432\u043b\u0435\u0442 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0438\u0434\u0435\u043e<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package com.ebt.videoapp.servlet;  import com.ebt.videoapp.service.VideoService; import org.keycloak.KeycloakSecurityContext; import javax.annotation.security.DeclareRoles; import javax.inject.Inject; import javax.servlet.ServletException; import javax.servlet.annotation.HttpConstraint; import javax.servlet.annotation.ServletSecurity; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException;  \/**  * \u0421\u0435\u0440\u0432\u043b\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0438\u0434\u0435\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441.  *  * @author EastBanc Technologies (http:\/\/eastbanctech.ru\/)  *\/ @WebServlet(&quot;\/video-list-servlet&quot;) public class VideoListServlet extends HttpServlet {      @Inject     private VideoService videoService;      @Override     protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {         req.setAttribute(&quot;list&quot;, videoService.list());         getServletContext().getRequestDispatcher(&quot;\/WEB-INF\/jsp\/list.jsp&quot;).forward(req, resp);     } } <\/code><\/pre>\n<p>  \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432:  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u043a\u043b\u0430\u0441\u0441\u0430 HttpServlet.<\/li>\n<li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 doGet().<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e  @WebServlet \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u0443. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u0435\u0440\u0432\u043b\u0435\u0442 \u0438 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u0432 web.xml.<\/li>\n<\/ol>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f  @WebServlet \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Servlet API 3.0 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u044b \u043f\u0440\u044f\u043c\u043e \u0432 Java \u043a\u043e\u0434\u0435.<\/p>\n<h4>4.4.5 \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u2013 list.jsp<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">list.jsp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;%@ page contentType=&quot;text\/html;charset=UTF-8&quot; language=&quot;java&quot; %&gt; &lt;%@ taglib uri=&quot;http:\/\/java.sun.com\/jsp\/jstl\/core&quot; prefix=&quot;c&quot; %&gt; &lt;html&gt; &lt;head&gt;     &lt;title&gt;\u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0438\u0434\u0435\u043e&lt;\/title&gt;     &lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.5\/css\/bootstrap.min.css&quot;           integrity=&quot;sha512-dTfge\/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz\/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==&quot;           crossorigin=&quot;anonymous&quot;&gt;  &lt;\/head&gt; &lt;body&gt;  &lt;h2&gt;\u0414\u0430\u043d\u043d\u044b\u0435&lt;\/h2&gt; &lt;table class=&quot;table table-striped&quot;&gt;     &lt;thead&gt;     &lt;tr&gt;         &lt;th&gt;\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a&lt;\/th&gt;         &lt;th&gt;\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435&lt;\/th&gt;         &lt;th&gt;\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f&lt;\/th&gt;         &lt;th&gt;\u0420\u0435\u0439\u0442\u0438\u043d\u0433&lt;\/th&gt;         &lt;th&gt;\u0421\u0441\u044b\u043b\u043a\u0430&lt;\/th&gt;     &lt;\/tr&gt;     &lt;\/thead&gt;     &lt;tbody&gt;     &lt;c:forEach var=&quot;video&quot; items=&quot;${list}&quot;&gt;         &lt;tr&gt;             &lt;td&gt;${video.source}&lt;\/td&gt;             &lt;td&gt;${video.title}&lt;\/td&gt;             &lt;td&gt;${video.category}&lt;\/td&gt;             &lt;td&gt;${video.rating}&lt;\/td&gt;             &lt;td&gt;&lt;a href=&quot;${video.url}&quot; target=&quot;_new&quot;&gt;\u0421\u043c\u043e\u0442\u0440\u0435\u0442\u044c&lt;\/a&gt;&lt;\/td&gt;         &lt;\/tr&gt;     &lt;\/c:forEach&gt;     &lt;\/tbody&gt; &lt;\/table&gt; &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>4.4.6 \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 CDI \u2013 beans.xml<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">beans.xml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;!-- enable CDI  --&gt; &lt;beans xmlns=&quot;http:\/\/xmlns.jcp.org\/xml\/ns\/javaee&quot; xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;        xsi:schemaLocation=&quot;         http:\/\/xmlns.jcp.org\/xml\/ns\/javaee         http:\/\/xmlns.jcp.org\/xml\/ns\/javaee\/beans_1_1.xsd&quot; bean-discovery-mode=&quot;all&quot;&gt; &lt;\/beans&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>4.4.7 \u0414\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2013 index.jsp<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">index.jsp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;%@ page contentType=&quot;text\/html;charset=UTF-8&quot; language=&quot;java&quot; %&gt; &lt;html&gt; &lt;body onload=&quot;document.location='&lt;%=request.getContextPath()%&gt;\/video-list-servlet'&quot;&gt; &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>4.4.8 \u0424\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 web.xml<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">web.xml<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u0444\u0430\u0439\u043b. \u0414\u0430\u043b\u0435\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.  <\/p>\n<pre><code>&lt;web-app version=&quot;3.0&quot; xmlns=&quot;http:\/\/java.sun.com\/xml\/ns\/javaee&quot;          xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;          xsi:schemaLocation=&quot;http:\/\/java.sun.com\/xml\/ns\/javaee http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_3_0.xsd&quot;&gt; &lt;\/web-app&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>4.4.9 \u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0434\u0435\u043f\u043b\u043e\u0439<\/h4>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 maven: mvn clean install.<\/p>\n<p>  \u0414\u0435\u043f\u043b\u043e\u0438\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 WildFly. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 video-app.war \u0432 &lt;WILDFLY_HOME&gt;\/standalone\/deployments.<\/p>\n<p>  \u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443: <a href=\"http:\/\/localhost:8080\/video-app\/video-list-servlet\">http:\/\/localhost:8080\/video-app\/video-list-servlet<\/a> \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/201\/2fa\/ee0\/2012faee059345b2be60021bdc2cebae.png\"\/><\/p>\n<h3>4.5 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 KeyCloak<\/h3>\n<p>  <\/p>\n<h4>4.5.1 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 KeyCloak \u0432 WildFly<\/h4>\n<p>  \u0428\u0430\u0433\u0438 \u0432\u0437\u044f\u0442\u044b \u0438\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (<a href=\"http:\/\/keycloak.github.io\/docs\/userguide\/keycloak-server\/html_single\/index.html\">http:\/\/keycloak.github.io\/docs\/userguide\/keycloak-server\/html_single\/index.html<\/a>): <\/p>\n<ol>\n<li> \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 KeyCloak (<a href=\"http:\/\/keycloak.jboss.org\/keycloak\/downloads\">http:\/\/keycloak.jboss.org\/keycloak\/downloads<\/a>) \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u043f\u0430\u0442\u0447\u0430 WildFly \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0422\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e KeyCloak 1.6.1, \u043d\u0443\u0436\u0435\u043d \u0444\u0430\u0439\u043b keycloak-overlay-1.6.1.Final.zip.<br \/>  \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0432 &lt;WILDFLY_HOME&gt; \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c.\n<p>  \u042d\u0442\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 KeyCloak \u0432 WildFly. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043f\u043e \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c\u0443 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0443 \/auth.<\/p>\n<\/li>\n<li> \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 KeyCloak \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445<br \/>  \u041a\u0430\u0447\u0430\u0435\u043c \u0430\u0434\u0430\u043f\u0442\u0435\u0440 \u0434\u043b\u044f wildfly, \u0444\u0430\u0439\u043b \u00abkeycloak-wf9-adapter-dist-1.6.1.Final.zip\u00bb \u0441 \u0441\u0430\u0439\u0442\u0430 KeyCloak: <a href=\"http:\/\/keycloak.jboss.org\/keycloak\/downloads.html?dir=0%3Dadapters\/keycloak-oidc%3B\">keycloak.jboss.org\/keycloak\/downloads.html?dir=0%3Dadapters\/keycloak-oidc%3B<\/a> <br \/>  \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0432 &lt;WILDFLY_HOME&gt; \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c.\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c KeyCloak \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 (\u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435).<\/p>\n<\/li>\n<li> \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c KeyCloak \u043a \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0444\u0438\u043b\u044e WildFly:<br \/>  &nbsp;a. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c WildFly: &lt;WILDFLY_HOME&gt;\/bin\/standalone.sh <br \/>  &nbsp;b. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 &lt;WILDFLY_HOME&gt;\/bin \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<br \/>  &nbsp;&nbsp;.\/jboss-cli.sh -c &#8212;file=keycloak-install.cli<br \/>  &nbsp;&nbsp;.\/jboss-cli.sh -c &#8212;file=adapter-install.cli<br \/>  &nbsp;c. \u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440 WildFly.  <\/li>\n<\/ol>\n<h4> 4.5.2 \u0421\u043e\u0437\u0434\u0430\u0435\u043c Realm<\/h4>\n<p>  Realm \u2013 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0432 KeyCloak. Realm\u2019\u044b \u0432 KeyCloak \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. <\/p>\n<p>  \u0412\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e Realm: \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f, \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u043a\u0430\u043a\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0438 \u0442.\u0434. <\/p>\n<p>  \u0428\u0430\u0433\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Realm:  <\/p>\n<ol>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c WildFly \u0441\u0435\u0440\u0432\u0435\u0440 (\u0435\u0441\u043b\u0438 \u043e\u043d \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d).<\/li>\n<li>\u0418\u0434\u0435\u043c \u0432 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c Keycloak:<br \/>  <a href=\"http:\/\/localhost:8080\/auth\/admin\/index.html\">http:\/\/localhost:8080\/auth\/admin\/index.html<\/a><\/li>\n<li>\u0412\u0432\u043e\u0434\u0438\u043c \u043b\u043e\u0433\u0438\u043d \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c. (\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f admin\/admin, \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c).<\/li>\n<li>\u0420\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 (\u0433\u0430\u043b\u043e\u0447\u043a\u0430 \u0432 \u043b\u0435\u0432\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0433\u043b\u0443):<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c16\/b16\/8ea\/c16b168eaf514bd7ab20694e1c5ae50f.png\"\/>\n<\/li>\n<li>\u041f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 Realm\u2019\u043e\u0432 \u0438 \u043a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e. \u041a\u043b\u0438\u043a\u0430\u0435\u043c \u043d\u0430 \u043d\u0435\u0435.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/3a7\/b84\/620\/3a7b84620fd34ced989dc37046326a88.png\"\/>\n<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 Realm \u0441 \u0438\u043c\u0435\u043d\u0435\u043c videomanager \u0438 \u0436\u043c\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 Create.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/575\/2a8\/cc8\/5752a8cc8bec40fa84b074a749fa730c.png\"\/>\n<\/li>\n<\/ol>\n<h4>4.5.3 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h4>\n<p>  <\/p>\n<ol>\n<li>\u041a\u043b\u0438\u043a\u0430\u0435\u043c \u043d\u0430 \u043f\u0443\u043d\u043a\u0442 Users \u0432 \u043b\u0435\u0432\u043e\u043c \u043d\u0438\u0436\u043d\u0435\u043c \u043c\u0435\u043d\u044e (\u0441\u0435\u043a\u0446\u0438\u044f Manage)<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/79b\/d90\/908\/79bd90908eaa4a7589a36c1e27de80d5.png\"\/>\n<\/li>\n<li>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7db\/a9e\/56b\/7dba9e56bc324e03a0712f5a9432b1c2.png\"\/>\n<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f appuser, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (\u0438\u043c\u044f, \u0444\u0430\u043c\u0438\u043b\u0438\u044f, email) \u0438 \u0436\u043c\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/bd1\/8e2\/30f\/bd18e230f8b3446c8fd0245584232b0b.png\"\/>\n<\/li>\n<li>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0435\u043a\u0446\u0438\u044e Credentials. \u041f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c, \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438 \u0436\u043c\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 Reset Password.<br \/>   <i>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u041d\u0430 \u043d\u0430\u0448 \u0432\u0437\u0433\u043b\u044f\u0434 Reset Password \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043de \u0441\u0430\u043c\u044b\u043c \u043b\u0443\u0447\u0448\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0431\u0438\u0442\u044c \u0441 \u0442\u043e\u043b\u043a\u0443. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0430\u0437\u0432\u0430\u0442\u044c Update Password \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e Save.<\/i><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4f8\/ddb\/cd5\/4f8ddbcd5904420789c8f9f7b6f50416.png\"\/>\n<p>  \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u043e\u0441\u044c\u0431\u043e\u0439 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0441\u043c\u0435\u043d\u0443 \u043f\u0430\u0440\u043e\u043b\u044f.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/165\/e79\/1dd\/165e791dd7334e94b497193a87a7d73e.png\"\/>  <\/li>\n<\/ol>\n<h3>4.6 \u0417\u0430\u0449\u0438\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f video-app \u0447\u0435\u0440\u0435\u0437 KeyCloak<\/h3>\n<p>  1. \u0418\u0434\u0435\u043c \u0432 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c Keycloak:<br \/>  <a href=\"http:\/\/localhost:8080\/auth\/admin\/index.html\">http:\/\/localhost:8080\/auth\/admin\/index.html<\/a><br \/>  2. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 Realm videomanager. <b>\u0412\u0441\u0435 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e Realm.<\/b><\/p>\n<h4> 4.6.1 \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0440\u043e\u043b\u0438<\/h4>\n<p>  <\/p>\n<ol>\n<li>\u041a\u043b\u0438\u043a\u0430\u0435\u043c \u043d\u0430 \u043f\u0443\u043d\u043a\u0442 Roles \u0432 \u043b\u0435\u0432\u043e\u043c \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043c\u0435\u043d\u044e (\u0441\u0435\u043a\u0446\u0438\u044f Configure).<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/de9\/f29\/2a1\/de9f292a1fff4323bd16726d59c5ff74.png\"\/>  <\/li>\n<li>\u0412 \u043f\u0440\u0430\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 Add Role.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/6fd\/bf5\/272\/6fdbf5272847441da44111e0622af50b.png\"\/>  <\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0420\u043e\u043b\u044c video-app-user \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 Save.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7ef\/ab4\/7ad\/7efab47ad9a4492e80cbc3e73e6dc38a.png\"\/>  <\/li>\n<\/ol>\n<h4>4.6.2 \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e<\/h4>\n<p>  <\/p>\n<ol>\n<li>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f appuser (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435).<\/li>\n<li>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 Role Mappings. \u0412 \u0441\u0435\u043a\u0446\u0438\u0438 Available Roles \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u043e\u043b\u044c video-app-user \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 Add Selected.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/21a\/771\/a75\/21a771a7551e448d95832fb3eca5aa35.png\"\/>\n<p>  \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<h4>4.6.3 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 video-app \u0432 KeyCloak<\/h4>\n<p>  \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 Clients \u0434\u043b\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e Realm\u2019\u0430. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u0443\u0434\u0430 \u0438 \u043a\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0442.\u0434.<\/p>\n<ol>\n<li>\u0412 \u0441\u0435\u043a\u0446\u0438\u0438 Configure \u043a\u043b\u0438\u043a\u0430\u0435\u043c \u043d\u0430 \u043f\u0443\u043d\u043a\u0442 Clients.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/884\/11c\/7ef\/88411c7ef3964d3bb61a6488d44c41be.png\"\/>\n<\/li>\n<li>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0412 \u043f\u0440\u0430\u0432\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0433\u043b\u0443 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 Create.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a0c\/a9d\/28f\/a0ca9d28f65e49d8ae9e1cbae03f697c.png\"\/>\n<\/li>\n<li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u041d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c ID \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 URL \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u043f\u043e\u0441\u043b\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/1ce\/20c\/623\/1ce20c623ad342ca80448011f750077e.png\"\/>\n<p>  \u041f\u043e\u043b\u0435 Valid Redirect URIs \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0442\u0435\u0445 \u0442\u043e\u0447\u0435\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u0443\u0434\u0430 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u043e\u0441\u043b\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 (JWT \u0442\u043e\u043a\u0435\u043d\u043e\u043c). \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u0442\u043e\u0447\u0435\u043a, \u0442\u043e \u0432\u0441\u0435 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0442\u0443\u0442 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043d\u043e\u043f\u043a\u0443 &quot;+&quot;). \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043c\u0430\u0441\u043a\u0443: \/video-app\/*. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u043e KeyCloak \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u0430\u0441\u043a\u0435.  <\/li>\n<\/ol>\n<h4>4.6.4 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 video-app<\/h4>\n<p>  <i>4.6.4.1 \u0417\u0430\u0449\u0438\u0449\u0430\u0435\u043c \u0421\u0435\u0440\u0432\u043b\u0435\u0442 VideoListServlet<\/i><br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u043a\u043b\u0430\u0441\u0441 VideoListServlet \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 DeclaredRoles, ServletSecurity.   <\/p>\n<pre><code>@WebServlet(&quot;\/video-list-servlet&quot;) @DeclareRoles(&quot;video-app-user&quot;) @ServletSecurity(@HttpConstraint(rolesAllowed = {&quot;video-app-user&quot;})) public class VideoListServlet extends HttpServlet { } <\/code><\/pre>\n<p>  \u041e\u043f\u044f\u0442\u044c \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 web.xml, \u043d\u043e \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<p>  <i>4.6.4.2 \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/i><br \/>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c web.xml \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:  <\/p>\n<pre><code>    &lt;login-config&gt;         &lt;auth-method&gt;KEYCLOAK&lt;\/auth-method&gt;         &lt;realm-name&gt;videomanager&lt;\/realm-name&gt;     &lt;\/login-config&gt; <\/code><\/pre>\n<p>  \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e <br \/>  \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f KEYCLOAK. \u042d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 WildFly \u043d\u0430 \u0448\u0430\u0433\u0435 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 KeyCloak. <\/p>\n<p>  <i>4.6.4.3 \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 KeyCloak<\/i><br \/>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 KeyCloak. \u042d\u0442\u043e\u0442 \u0448\u0430\u0433 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e.  <\/p>\n<ol>\n<li>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432 KeyCloak \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 video-app. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 Installation, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c KeyCloak JSON \u0444\u043e\u0440\u043c\u0430\u0442. <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ab6\/ce6\/945\/ab6ce69454874472b9aa29a1be6d1736.png\"\/>  <\/li>\n<li>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 JSON, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b web-app\/WEB-INF\/keycloak.json \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f video-app.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c68\/382\/d00\/c68382d00491459c8d2bf433e835eef2.png\"\/>  <\/li>\n<\/ol>\n<h4>4.6.5 \u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0434\u0435\u043f\u043b\u043e\u0439<\/h4>\n<p>  \u0421\u043d\u043e\u0432\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u0434\u0435\u043f\u043b\u043e\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443: <a href=\"http:\/\/localhost:8080\/video-app\/video-list-servlet\">http:\/\/localhost:8080\/video-app\/video-list-servlet<\/a>.<br \/>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432\u0435\u0440\u043d\u043e, \u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442 \u0432\u0430\u0441 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u0442 KeyCloak. \u0412\u0432\u043e\u0434\u0438\u043c \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f Realm videomanager \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043b\u043e\u0433\u0438\u043d\u0435 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, KeyCloak \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041c\u0435\u043d\u044f\u0435\u043c \u0438 \u0436\u043c\u0435\u043c Submit.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f3a\/3ac\/667\/f3a3ac667af24b23b2ddf5b8b7a9a011.png\"\/><br \/>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0432\u044b \u0441\u043d\u043e\u0432\u0430 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0438\u0434\u0435\u043e.<\/p>\n<h3>4.7 REST \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u0430\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0432\u0438\u0434\u0435\u043e \u2013 (video-rest)<\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 REST \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0438\u0434\u0435\u043e.<br \/>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8b2\/37d\/0f2\/8b237d0f2b794a80a43bf1685528996a.png\"\/><\/p>\n<h4>4.7.1 \u0424\u0430\u0439\u043b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u2013 pom.xml<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">pom.xml<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot;          xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;          xsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&quot;&gt;     &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;      &lt;parent&gt;         &lt;groupId&gt;com.ebt.ressearch.keycloak&lt;\/groupId&gt;         &lt;artifactId&gt;keycloak-demo&lt;\/artifactId&gt;         &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;     &lt;\/parent&gt;      &lt;artifactId&gt;video-rest&lt;\/artifactId&gt;     &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;     &lt;packaging&gt;war&lt;\/packaging&gt;      &lt;build&gt;         &lt;finalName&gt;video-rest&lt;\/finalName&gt;         &lt;plugins&gt;             &lt;plugin&gt;                 &lt;groupId&gt;org.wildfly.plugins&lt;\/groupId&gt;                 &lt;artifactId&gt;wildfly-maven-plugin&lt;\/artifactId&gt;                 &lt;version&gt;${version.wildfly.maven.plugin}&lt;\/version&gt;             &lt;\/plugin&gt;         &lt;\/plugins&gt;     &lt;\/build&gt;      &lt;dependencies&gt;         &lt;dependency&gt;             &lt;groupId&gt;com.ebt.ressearch.keycloak&lt;\/groupId&gt;             &lt;artifactId&gt;common&lt;\/artifactId&gt;             &lt;version&gt;${project.version}&lt;\/version&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;javax.enterprise&lt;\/groupId&gt;             &lt;artifactId&gt;cdi-api&lt;\/artifactId&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.jboss.spec.javax.annotation&lt;\/groupId&gt;             &lt;artifactId&gt;jboss-annotations-api_1.2_spec&lt;\/artifactId&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.jboss.spec.javax.ws.rs&lt;\/groupId&gt;             &lt;artifactId&gt;jboss-jaxrs-api_2.0_spec&lt;\/artifactId&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;             &lt;artifactId&gt;keycloak-core&lt;\/artifactId&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.keycloak&lt;\/groupId&gt;             &lt;artifactId&gt;keycloak-adapter-core&lt;\/artifactId&gt;             &lt;scope&gt;provided&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.jboss.spec.javax.ejb&lt;\/groupId&gt;             &lt;artifactId&gt;jboss-ejb-api_3.1_spec&lt;\/artifactId&gt;             &lt;version&gt;1.0.2.Final&lt;\/version&gt;         &lt;\/dependency&gt;     &lt;\/dependencies&gt; &lt;\/project&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>4.7.2 \u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 VideoImpl.java<\/h4>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 video-app (\u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0434\u043e \u0438\u043c\u0435\u043d\u0438 \u043f\u0430\u043a\u0435\u0442\u0430).<\/p>\n<h4>4.7.3 \u0421\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0438\u0434\u0435\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u2014 VideoService.java<\/h4>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 video-app. <\/p>\n<h4>4.7.4 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 REST \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2013 VideoRest.java<\/h4>\n<p>  <\/p>\n<pre><code>package com.ebt.videorest.rest;  import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application;  \/**  * \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 JAX-RS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.  *  * @author EastBanc Technologies (http:\/\/eastbanctech.ru\/)  *\/ @ApplicationPath(&quot;\/&quot;) public class VideoRestApp extends Application { } <\/code><\/pre>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 JAX-RS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 WildFly \u043f\u043e\u0439\u043c\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c REST \u0441\u0435\u0440\u0432\u0438\u0441\u044b. <\/p>\n<h4>4.7.5 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 REST \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u2013 VideoRest.java<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">list.jsp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>package com.ebt.videorest.rest;  import com.ebt.common.Video; import com.ebt.videorest.service.VideoService;  import javax.annotation.security.RolesAllowed; import javax.ejb.Stateless; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import java.util.List;  \/**  * REST \u0441\u0435\u0440\u0432\u0438\u0441.  *  * @author EastBanc Technologies (http:\/\/eastbanctech.ru\/)  *\/ @Path(&quot;\/&quot;) @Produces(&quot;application\/json&quot;) public class VideoRest {      @Inject     private VideoService videoService;      @GET     @Path(&quot;\/list&quot;)     public List&lt;Video&gt; get() {         return videoService.list();     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>4.7.6 \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 CDI \u2013 beans.xml<\/h4>\n<p>  \u0412 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0444\u0430\u0439\u043b \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f video-app. <\/p>\n<h4>4.7.7 \u0424\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 web.xml<\/h4>\n<p>  <\/p>\n<pre><code>&lt;web-app version=&quot;3.0&quot; xmlns=&quot;http:\/\/java.sun.com\/xml\/ns\/javaee&quot;          xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;          xsi:schemaLocation=&quot;http:\/\/java.sun.com\/xml\/ns\/javaee http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_3_0.xsd&quot;&gt; &lt;\/web-app&gt; <\/code><\/pre>\n<h4>4.7.8 \u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0434\u0435\u043f\u043b\u043e\u0439<\/h4>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 maven \u0438 \u0434\u0435\u043f\u043b\u043e\u0438\u043c \u0432 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 WildFly.<\/p>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <a href=\"http:\/\/localhost:8080\/video-rest\/list\">http:\/\/localhost:8080\/video-rest\/list<\/a>. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0432\u0435\u0440\u043d\u043e, \u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0438\u0434\u0435\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/fe8\/06f\/4bb\/fe806f4bb44d48f0b63695a60a923252.png\"\/><\/p>\n<h3> 4.8 \u0417\u0430\u0449\u0438\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f video-rest \u0447\u0435\u0440\u0435\u0437 KeyCloak<\/h3>\n<p>  <\/p>\n<h4>4.8.1 \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0440\u043e\u043b\u0438<\/h4>\n<p>  \u0412 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 KeyCloak \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0440\u043e\u043b\u044c video-rest-user.<\/p>\n<h4>4.8.2 \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e<\/h4>\n<p>  \u0412 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u043e\u043b\u044c video-rest-user \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e appuser.<\/p>\n<h4>4.8.3 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 video-rest \u0432 KeyCloak<\/h4>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c video-rest \u0432 KeyCloak \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0443\u043d\u043a\u0442\u0443 \u00ab\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 video-app \u0432 KeyCloak\u00bb \u0441 \u043e\u0434\u043d\u0438\u043c \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435\u043c. <b>\u0412 AccessType \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 bearer-only.<\/b> <br \/>  \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 KeyCloak \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u0437 JWT \u0442\u043e\u043a\u0435\u043d\u0430.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/9d7\/f64\/976\/9d7f64976c564397be6988c516c44b21.png\"\/><\/p>\n<h4>4.8.4 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 video-rest<\/h4>\n<p>  <i>4.8.4.1 \u0417\u0430\u0449\u0438\u0449\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0438\u0434\u0435\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u2013 VideoRest.java<\/i><br \/>  \u041f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439  @RolesAllowed. \u0421\u0430\u043c \u043a\u043b\u0430\u0441\u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439  @Stateless, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e EJB (\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 javax.annotation.security \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 EJB 3.0 \u0431\u0438\u043d\u0430\u0445). <\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441:   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0441\u0435\u0440\u0432\u0438\u0441<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>package com.ebt.videorest.rest;  import com.ebt.common.Video; import com.ebt.videorest.service.VideoService;  import javax.annotation.security.RolesAllowed; import javax.ejb.Stateless; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import java.util.List;  \/**  * REST \u0441\u0435\u0440\u0432\u0438\u0441.  *  * @author EastBanc Technologies (http:\/\/eastbanctech.ru\/)  *\/ @Path(&quot;\/&quot;) @Produces(&quot;application\/json&quot;) @Stateless public class VideoRest {      @Inject     private VideoService videoService;      @GET     @Path(&quot;\/list&quot;)     @RolesAllowed(&quot;video-rest-user&quot;)     public List&lt;Video&gt; get() {         return videoService.list();     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <i>4.8.4.2 \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/i><br \/>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f video-app.<\/p>\n<p>  <i>4.8.4.3 \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 KeyCloak<\/i><br \/>  \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0442\u0435 \u0436\u0435 \u0448\u0430\u0433\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f video-rest, \u0447\u0442\u043e \u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441 KeyCloak \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f video-app.<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u00abbearer-only\u00bb \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abtrue\u00bb. <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/35a\/6f9\/818\/35a6f98184ce4ccebcef421ac0353867.png\"\/><\/p>\n<h4>4.8.5 \u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0434\u0435\u043f\u043b\u043e\u0439<\/h4>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u0434\u0435\u043f\u043b\u043e\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/p>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:8080\/video-rest\/list\">http:\/\/localhost:8080\/video-rest\/list<\/a> <\/p>\n<p>  \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/788\/8d1\/d1a\/7888d1d1a898463fa48ef79e209264ff.png\"\/><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f REST \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a Authorization \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c Bearer ${\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 JWT \u0442\u043e\u043a\u0435\u043d\u0430}, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0438\u0434\u0435\u043e. <br \/>  \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 JWT \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f video-app, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0442\u043e\u0434 getTokenString() \u043e\u0431\u044a\u0435\u043a\u0442\u0430 KeycloakSecurityContext. \u041e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. <\/p>\n<pre><code>KeycloakSecurityContext ksc = (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName()); String token = ksc.getTokenString(); <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/11f\/ad2\/ead\/11fad2eada274b4bb7529f1f1dcf6b4a.png\"\/><br \/>  \u041d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0432\u044b\u0437\u043e\u0432 REST \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 JWT \u0442\u043e\u043a\u0435\u043d\u043e\u043c. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 Postman \u0434\u043b\u044f Chrome.<\/p>\n<h3>4.9 SSO \u2013 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f video-app \u0441 video-rest<\/h3>\n<p>  \u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0441\u0435\u0440\u0432\u043b\u0435\u0442\u0430 VideoListServlet \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 video-app \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 REST \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0411\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0438\u0434\u0435\u043e, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0432\u0443\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432.<\/p>\n<h4>4.9.1 \u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0440\u0432\u043b\u0435\u0442 VideoListServlet.java<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">VideoListServlet.java<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>     @Override     protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {         Client client = ClientBuilder.newBuilder().build();         WebTarget target = client.target(&quot;http:\/\/localhost:8080\/video-rest\/list&quot;);         GenericType&lt;List&lt;VideoImpl&gt;&gt; listGenericType = new GenericType&lt;List&lt;VideoImpl&gt;&gt;() {         };         KeycloakSecurityContext ksc = (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName());         List&lt;VideoImpl&gt; list = target.request().header(&quot;Authorization&quot;, &quot;Bearer &quot; + ksc.getTokenString()).get(listGenericType);          \/\/ merge lists         List&lt;Video&gt; mergeList = new ArrayList&lt;&gt;();         mergeList.addAll(list);         mergeList.addAll(videoService.list());          req.setAttribute(&quot;list&quot;, mergeList);         req.setAttribute(&quot;ksc&quot;, ksc);         getServletContext().getRequestDispatcher(&quot;\/WEB-INF\/jsp\/list.jsp&quot;).forward(req, resp);     }\t <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 KeyCloak.   <\/p>\n<pre><code>KeycloakSecurityContext ksc = (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName()); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f JWT \u0442\u043e\u043a\u0435\u043d:  <\/p>\n<pre><code>List&lt;VideoImpl&gt; list = target.request().header(&quot;Authorization&quot;, &quot;Bearer &quot; + ksc.getTokenString()).get(listGenericType); <\/code><\/pre>\n<h4>4.9.2 \u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0434\u0435\u043f\u043b\u043e\u0439<\/h4>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438 \u0434\u0435\u043f\u043b\u043e\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <br \/>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0438\u0434\u0435\u043e <a href=\"http:\/\/localhost:8080\/video-app\/video-list-servlet\">http:\/\/localhost:8080\/video-app\/video-list-servlet<\/a>. <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c74\/851\/215\/c7485121522e4cb7b2390c3fe399d27c.png\"\/><br \/>  \u041d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u0432\u0438\u0434\u0435\u043e \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0431\u044b\u043b\u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u043e\u0434\u0438\u043d \u0441\u043f\u0438\u0441\u043e\u043a. <\/p>\n<p>  \u0412\u043e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0432\u0441\u0435, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430. \u0411\u044b\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u0438 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b \u0434\u0432\u0430 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JWT \u0442\u043e\u043a\u0435\u043d\u043e\u0432.<\/p>\n<h2> 5. \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c KeyCloak \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u044b\u043b\u0430 \u043e\u0442\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432 \u0445\u043e\u0434\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u044d\u0442\u0430\u043f\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 KeyCloak. \u041d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0438 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u043c, \u043a\u0442\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c KeyCloak \u0432 \u0441\u0432\u043e\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430. <\/p>\n<p>  \u0412\u043e\u043e\u0431\u0449\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u044f. \u041f\u043e\u043c\u0438\u043c\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043c\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0440\u0442\u0430\u043b Liferay \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 KeyCloak \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 SAML 2.0 (\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d Microsoft ADFS). <\/p>\n<p>  \u041d\u0430\u0448\u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u0441\u044f \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043c\u044b \u0435\u0449\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 KeyCloak.               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/272149\/\"> http:\/\/habrahabr.ru\/post\/272149\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<blockquote><p>\u0418\u0437 \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432:<br \/>   \u2014 \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0443 \u043d\u0430\u0441 \u0434\u044b\u0440\u0430 \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438!<br \/>   \u2014 \u0421\u043b\u0430\u0432\u0430 \u0411\u043e\u0433\u0443, \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0443 \u043d\u0430\u0441 \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438\u2026  <\/p><\/blockquote>\n<p>  <\/p>\n<h2> 1. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <\/h2>\n<p>  \u041f\u0430\u0440\u0443 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u043c\u044b \u0443\u0436\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u043b\u0438 \u0442\u0435\u043c\u0443 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u0422\u043e\u0433\u0434\u0430 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0440\u0430\u0431\u043e\u0442 \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 Service Provider \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c Shibboleth \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 SAML 2.0. <\/p>\n<p>  \u0412 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u0437\u043e\u0440 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 KeyCloak (\u0434\u043e\u0441\u0435\u043b\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0431\u0435\u0437 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c Habr). <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/0ba\/c87\/955\/0bac879557424d68b9f3a62b7f2d4c9e.png\"\/><br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 JEE \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 KeyCloak, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-269553","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/269553","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=269553"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/269553\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=269553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=269553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=269553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}