{"id":373909,"date":"2024-05-21T05:47:29","date_gmt":"2024-05-21T05:47:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=373909"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=373909","title":{"rendered":"<span>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 OpenAM \u0438 \u0448\u043b\u044e\u0437\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 OpenIG \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0442\u043e \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441\u043e \u0448\u043b\u044e\u0437\u043e\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 Open Access Manager (<a href=\"https:\/\/github.com\/OpenIdentityPlatform\/OpenAM\" rel=\"noopener noreferrer nofollow\">OpenAM)<\/a> \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u0448\u043b\u044e\u0437 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 Open Identity Gateway (<a href=\"https:\/\/github.com\/OpenIdentityPlatform\/OpenIG\" rel=\"noopener noreferrer nofollow\">OpenIG<\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0441\u0441\u0438\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 OpenAM. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Spring Boot \u0438 Spring Security. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/OpenIdentityPlatform\/spring-security-openam-example\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439 \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0432 Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445.<\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \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 \u043a \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/73a\/6c1\/cdb\/73a6c1cdbaa91dfd31e83967573d5e27.png\" width=\"2000\" height=\"1440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/73a\/6c1\/cdb\/73a6c1cdbaa91dfd31e83967573d5e27.png\"\/><\/figure>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <code>docker-compose.yaml<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0433\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041f\u0440\u043e\u0431\u0440\u043e\u0441\u044c\u0442\u0435 \u043f\u043e\u0440\u0442 8081 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438.<\/p>\n<pre><code class=\"yaml\">services:   spring-service:     container_name: spring-service     image: openidentityplatform\/spring-security-openam-example     restart: always     ports:       - \"8081:8081\"     environment:       JAVA_OPTS: -Dspring.profiles.active=jwt     networks:       openam_network:         aliases:           - spring-service networks: openam_network: driver: bridge <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043a \u0434\u043e\u0441\u0442\u0443\u043f \u043a API, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"bash\">curl http:\/\/localhost:8081\/api\/protected-jwt | json_pp   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                  Dload  Upload   Total   Spent    Left  Speed 100   105    0   105    0     0  12684      0 --:--:-- --:--:-- --:--:-- 13125 {    \"error\" : \"Unauthorized\",    \"path\" : \"\/protected-jwt\",    \"status\" : 401,    \"timestamp\" : \"2024-04-16T06:01:25.331+00:00\" } <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0432 API \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 JWT \u0432 HTTP \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 Authorization. \u0417\u0430 \u044d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u043a\u0430 OpenAM + OpenIG. \u041f\u043e\u0442\u0443\u0448\u0438\u0442\u0435 \u043f\u043e\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 <code>docker compose down<\/code><\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 OpenAM<\/h2>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430  \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 OpenAM. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e \u0442\u043e\u043a\u0435\u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 JWT (\u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0436\u0435).<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0438\u043c\u0435\u043d\u0430 \u0445\u043e\u0441\u0442\u043e\u0432 OpenAM \u0438 OpenIG \u0432 \u0444\u0430\u0439\u043b\u00a0<code>hosts<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440\u00a0<code>127.0.0.1 openam.example.org openig.example.org<\/code>\u00a0.<\/p>\n<p>\u0412 Windows \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0444\u0430\u0439\u043b\u00a0<code>hosts<\/code>\u00a0\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443\u00a0<code>C:\\\\Windows\\\\System32\\\\drivers\\\\etc\\\\hosts<\/code>\u00a0, \u0432 Linux \u0438 Mac \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443\u00a0<code>\/etc\/hosts<\/code>\u00a0.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u0444\u0430\u0439\u043b <code>docker-compose.yaml<\/code> \u0441\u0435\u0440\u0432\u0438\u0441 OpenAM:<\/p>\n<pre><code class=\"yaml\">...   openam:     image: openidentityplatform\/openam:latest     container_name: openam     ports:       - \"8080:8080\"     networks:       openam_network:         aliases:           - openam.example.org ... <\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 OpenAM \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>docker compose up openam<\/code>. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a OpenAM \u0437\u0430\u043f\u0443\u0449\u0435\u043d, \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0433\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">docker exec -w '\/usr\/openam\/ssoconfiguratortools' openam bash -c \\ 'echo \"ACCEPT_LICENSES=true SERVER_URL=http:\/\/openam.example.org:8080 DEPLOYMENT_URI=\/$OPENAM_PATH BASE_DIR=$OPENAM_DATA_DIR locale=en_US PLATFORM_LOCALE=en_US AM_ENC_KEY= ADMIN_PWD=passw0rd AMLDAPUSERPASSWD=p@passw0rd COOKIE_DOMAIN=example.org ACCEPT_LICENSES=true DATA_STORE=embedded DIRECTORY_SSL=SIMPLE DIRECTORY_SERVER=openam.example.org DIRECTORY_PORT=50389 DIRECTORY_ADMIN_PORT=4444 DIRECTORY_JMX_PORT=1689 ROOT_SUFFIX=dc=openam,dc=example,dc=org DS_DIRMGRDN=cn=Directory Manager DS_DIRMGRPASSWD=passw0rd\" > conf.file &amp;&amp; java -jar openam-configurator-tool*.jar --file conf.file' <\/code><\/pre>\n<p>\u0418 \u0434\u043e\u0436\u0434\u0438\u0442\u0435\u0441\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 STS<\/h3>\n<p>STS (Security Token Service) &#8212; \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0442\u043e\u043a\u0435\u043d\u0430 OpenAM \u0432 JWT. \u041f\u043e\u0441\u043b\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 OpenAM \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u043e\u043a\u0435\u043d \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0421\u0435\u0440\u0432\u0438\u0441 STS \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e  \u0442\u043e\u043a\u0435\u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 JWT, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435. \u042d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c OpenIG.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 STS \u0437\u0430\u0439\u0434\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/p>\n<p><a href=\"http:\/\/openam.example.org:8080\/openam\/XUI\/#login\/\" rel=\"noopener noreferrer nofollow\">http:\/\/openam.example.org:8080\/openam\/XUI\/#login\/<\/a><\/p>\n<p>\u0412 \u043f\u043e\u043b\u0435 \u043b\u043e\u0433\u0438\u043d \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>amadmin<\/code>,  \u0432 \u043f\u043e\u043b\u0435 \u043f\u0430\u0440\u043e\u043b\u044c \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u00a0<code>ADMIN_PWD<\/code>\u00a0\u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u00a0<code>passw0rd<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/44a\/f09\/023\/44af09023cfdf57da9f783ce37892536.png\" width=\"2000\" height=\"934\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/44a\/f09\/023\/44af09023cfdf57da9f783ce37892536.png\"\/><\/figure>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 realm, \u0432 \u043b\u0435\u0432\u043e\u043c \u043c\u0435\u043d\u044e \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u043f\u0443\u043d\u043a\u0442 STS \u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>Setting<\/p>\n<\/th>\n<th>\n<p>Value<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Supported Token Transforms<\/p>\n<\/td>\n<td>\n<p align=\"left\">OPENAM->OPENIDCONNECT;don&#8217;t invalidate interim OpenAM session<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Deployment Url Element<\/p>\n<\/td>\n<td>\n<p align=\"left\">jwt<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">The id of the OpenID Connect Token Provider<\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/openam.example.org\/openam\" rel=\"noopener noreferrer nofollow\">https:\/\/openam.example.org\/openam<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Client secret<\/p>\n<\/td>\n<td>\n<p align=\"left\">changeme<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Confirm client secret<\/p>\n<\/td>\n<td>\n<p align=\"left\">changeme<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">The audience for issued tokens<\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/openam.example.org\/openam\" rel=\"noopener noreferrer nofollow\">https:\/\/openam.example.org\/openam<\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h3>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 OpenAM \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 realm, \u0432 \u043c\u0435\u043d\u044e \u0441\u043b\u0435\u0432\u0430 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0443\u043d\u043a\u0442 Subjects. \u0417\u0430\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u00a0<code>demo<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0435\u0433\u043e \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0438 \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 Edit \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 Password. \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c. \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u044b\u0439\u0434\u0438\u0442\u0435 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 OpenIG<\/h2>\n<p>OpenIG \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c. \u041e\u043d \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043a\u0435\u043d \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 JWT \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 OpenAM \u0438, \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 Authorization.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 <code>openig-config<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0435 2 \u0444\u0430\u0439\u043b\u0430: <code>admin.json<\/code><\/p>\n<pre><code class=\"json\">{     \"prefix\": \"openig\",     \"mode\": \"PRODUCTION\" }<\/code><\/pre>\n<p>\u0438 <code>config.json<\/code><\/p>\n<pre><code class=\"json\">{     \"heap\": [],     \"handler\": {         \"type\": \"Chain\",         \"config\": {             \"filters\": [],             \"handler\": {                 \"type\": \"Router\",                 \"name\": \"_router\",                 \"capture\": \"all\"             }         }     } } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043e\u0431\u043e\u0433\u0430\u0449\u0430\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c Authorization \u0441 JWT \u0442\u043e\u043a\u0435\u043d\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0438\u0437 OpenAM.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 <code>openig-config\/routes\/<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b <code>10-protected.json<\/code>.<\/p>\n<pre><code class=\"json\">{     \"name\": \"${matches(request.uri.path, '^\/api\/protected-jwt') || matches(request.uri.path, '^\/protected-jwt')}\",     \"condition\": \"${matches(request.uri.path, '^\/api\/protected-jwt') || matches(request.uri.path, '^\/protected-jwt')}\",     \"monitor\": true,     \"timer\": true,     \"handler\": {         \"type\": \"Chain\",         \"config\": {             \"filters\": [                 {                     \"type\": \"ConditionalFilter\",                     \"config\": {                         \"condition\": \"${empty contexts.sts.issuedToken and not empty request.cookies['iPlanetDirectoryPro'][0].value}\",                         \"delegate\": {                             \"type\": \"TokenTransformationFilter\",                             \"config\": {                                 \"openamUri\": \"${system['openam']}\",                                 \"realm\": \"\/\",                                 \"instance\": \"jwt\",                                 \"from\": \"OPENAM\",                                 \"to\": \"OPENIDCONNECT\",                                 \"idToken\": \"${request.cookies['iPlanetDirectoryPro'][0].value}\"                             }                         }                     }                 },                 {                     \"type\": \"ConditionalFilter\",                     \"config\": {                         \"condition\": \"${not empty contexts.sts.issuedToken}\",                         \"delegate\": {                             \"type\": \"HeaderFilter\",                             \"config\": {                                 \"messageType\": \"REQUEST\",                                 \"remove\": [                                     \"Authorization\",                                     \"JWT\"                                 ],                                 \"add\": {                                     \"Authorization\": [                                         \"Bearer ${contexts.sts.issuedToken}\"                                     ]                                 }                             }                         }                     }                 },                 {                     \"type\": \"ConditionEnforcementFilter\",                     \"config\": {                         \"condition\": \"${not empty contexts.sts.issuedToken}\",                         \"failureHandler\": {                             \"type\": \"StaticResponseHandler\",                             \"config\": {                                 \"status\": 302,                                 \"reason\": \"Found\",                                 \"headers\": {                                     \"Content-Type\": [                                         \"application\/json\"                                     ],                                     \"Location\": [                                         \"${system['openam']}\/UI\/Login?org=\/&amp;goto=${urlEncode(contexts.router.originalUri)}\"                                     ]                                 },                                 \"entity\": \"{ \\\\\"Redirect\\\\\": \\\\\"${system['openam']}\/UI\/Login?org=\/&amp;goto=${urlEncode(contexts.router.originalUri)}\\\\\"}\"                             }                         }                     }                 }             ],             \"handler\": \"EndpointHandler\"         }     },     \"heap\": [         {             \"name\": \"EndpointHandler\",             \"type\": \"DispatchHandler\",             \"config\": {                 \"bindings\": [                     {                         \"handler\": \"ClientHandler\",                         \"capture\": \"all\",                         \"baseURI\": \"${matchingGroups(system['spring-service'],\\\\\"((http|https):\\\\\/\\\\\/(.[^\\\\\/]*))\\\\\")[1]}\"                     }                 ]             }         }     ] } <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u0442 \u0434\u0432\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438: API &#8212; <code>\/api\/protected-jwt<\/code> \u0438 UI &#8212; <code>\/protected-jwt<\/code>.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 OpenIG \u0432 <code>docker-compose.yaml<\/code> \u0444\u0430\u0439\u043b \u0438 \u0443\u0431\u0435\u0440\u0438\u0442\u0435 \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u043f\u043e\u0440\u0442\u043e\u0432 \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <code>spring-service<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 OpenIG.<\/p>\n<pre><code class=\"yaml\">services:   openam:     image: openidentityplatform\/openam:latest     container_name: openam     ports:       - \"8080:8080\"     networks:       openam_network:         aliases:           - openam.example.org openig: image: openidentityplatform\/openig:latest container_name: openig volumes: - .\/openig-config:\/usr\/local\/openig-config:ro environment: CATALINA_OPTS: -Dopenig.base=\/usr\/local\/openig-config -Dspring-service=http:\/\/spring-service:8081 -Dopenam=http:\/\/openam.example.org:8080\/openam ports: - \"8081:8080\" networks: openam_network: aliases: - openig.example.org spring-service: container_name: spring-service image: openidentityplatform\/spring-security-openam-example restart: always # ports: #   - \"8081:8081\" environment: JAVA_OPTS: -Dspring.profiles.active=jwt networks: openam_network: aliases: - spring-service networks: openam_network: driver: bridge <\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 OpenIG \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>docker compose up openig spring-service<\/code><\/p>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h2>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 API<\/h3>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u043e\u043a\u0435\u043d \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 OpenAM \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>demo<\/code>:<\/p>\n<pre><code class=\"bash\">curl -X POST -H \"X-OpenAM-Username: demo\" -H \"X-OpenAM-Password: passw0rd\" \\\\  -H \"Content-Type: application\/json\" -H \"Accept-API-Version: resource=2.1\" \\\\ &lt;http:\/\/openam.example.org:8080\/openam\/json\/realms\/root\/authenticate> | json_pp   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                  Dload  Upload   Total   Spent    Left  Speed 100   159  100   159    0     0   4197      0 --:--:-- --:--:-- --:--:--  4297 {    \"realm\" : \"\/\",    \"successUrl\" : \"\/openam\/console\",    \"tokenId\" : \"AQIC5wM2LY4Sfcze3DbBXVSXggTyZNpGfwOoFPLnHwmqLG0.*AAJTSQACMDEAAlNLABM2MTY1Mjg2MzI5Mzc4ODM0MzQ5AAJTMQAA*\" } <\/code><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432\u0435\u043c \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0442\u043e\u043a\u0435\u043d\u043e\u043c endpoint <code>\/api\/protected-jwt<\/code><\/p>\n<pre><code class=\"bash\">curl  --cookie \"iPlanetDirectoryPro=AQIC5wM2LY4Sfcze3DbBXVSXggTyZNpGfwOoFPLnHwmqLG0.*AAJTSQACMDEAAlNLABM2MTY1Mjg2MzI5Mzc4ODM0MzQ5AAJTMQAA*\" \\\\  \"&lt;http:\/\/openig.example.org:8081\/api\/protected-jwt>\" | json_pp   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                  Dload  Upload   Total   Spent    Left  Speed 100    30    0    30    0     0   1071      0 --:--:-- --:--:-- --:--:--  1111 {    \"method\" : \"JWT\",    \"user\" : \"demo\" } <\/code><\/pre>\n<p>OpenIG \u0447\u0435\u0440\u0435\u0437 OpenAM \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 cookie <code>iPlanetDirectoryPro<\/code> \u0442\u043e\u043a\u0435\u043d \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 JWT \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043b \u044d\u0442\u043e\u0442 JWT \u0432 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <code>spring-service<\/code>. \u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e \u0438\u0437 JWT \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0438 \u0432\u0435\u0440\u043d\u0443\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442.<\/p>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 UI<\/h3>\n<p>\u0412\u044b\u0439\u0434\u0438\u0442\u0435 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u043b\u0438 \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u201c\u0418\u043d\u043a\u043e\u0433\u043d\u0438\u0442\u043e\u201d<\/p>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 URL <a href=\"http:\/\/openig.example.org:8081\/protected-jwt\" rel=\"noopener noreferrer nofollow\">http:\/\/openig.example.org:8081\/protected-jwt<\/a> . OpenIG \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442 cookie \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e OpenAM. \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043b\u043e\u0433\u0438\u043d <code>demo<\/code> , \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 <code>Log In<\/code>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0b7\/53c\/9bf\/0b753c9bf031958f3d450c3b86b599b8.png\" width=\"1950\" height=\"1409\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0b7\/53c\/9bf\/0b753c9bf031958f3d450c3b86b599b8.png\"\/><\/figure>\n<p>\u041f\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 \u0448\u043b\u044e\u0437 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041f\u043e\u043b\u0443\u0447\u0438\u0442 \u0438\u0437 http \u0437\u0430\u043f\u0440\u043e\u0441\u0430 cookie \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043a\u0435\u043d \u0432 OpenAM \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 STS \u0432 JWT \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0441\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 JWT \u0432 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 JWT \u0438 \u0432\u0435\u0440\u043d\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442.<\/p>\n<figure class=\"float bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/add\/ca1\/594\/addca1594d11a2232a69828432cc6766.png\" width=\"550\" height=\"221\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/add\/ca1\/594\/addca1594d11a2232a69828432cc6766.png\"\/><\/figure>\n<\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u043e <a href=\"https:\/\/github.com\/OpenIdentityPlatform\/spring-security-openam-example\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a><\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 docker conpose \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 OpenIG \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u043e <a href=\"https:\/\/github.com\/OpenIdentityPlatform\/openam-openig-springboot-example\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/808431\/\"> https:\/\/habr.com\/ru\/articles\/808431\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0442\u043e \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441\u043e \u0448\u043b\u044e\u0437\u043e\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 Open Access Manager (<a href=\"https:\/\/github.com\/OpenIdentityPlatform\/OpenAM\" rel=\"noopener noreferrer nofollow\">OpenAM)<\/a> \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u0448\u043b\u044e\u0437 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 Open Identity Gateway (<a href=\"https:\/\/github.com\/OpenIdentityPlatform\/OpenIG\" rel=\"noopener noreferrer nofollow\">OpenIG<\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0441\u0441\u0438\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 OpenAM. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Spring Boot \u0438 Spring Security. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/OpenIdentityPlatform\/spring-security-openam-example\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439 \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0432 Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445.<\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \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 \u043a \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435:<\/p>\n<figure class=\"full-width\"><\/figure>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <code>docker-compose.yaml<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0433\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041f\u0440\u043e\u0431\u0440\u043e\u0441\u044c\u0442\u0435 \u043f\u043e\u0440\u0442 8081 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438.<\/p>\n<pre><code class=\"yaml\">services:   spring-service:     container_name: spring-service     image: openidentityplatform\/spring-security-openam-example     restart: always     ports:       - \"8081:8081\"     environment:       JAVA_OPTS: -Dspring.profiles.active=jwt     networks:       openam_network:         aliases:           - spring-service networks: openam_network: driver: bridge <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043a \u0434\u043e\u0441\u0442\u0443\u043f \u043a API, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"bash\">curl http:\/\/localhost:8081\/api\/protected-jwt | json_pp   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                  Dload  Upload   Total   Spent    Left  Speed 100   105    0   105    0     0  12684      0 --:--:-- --:--:-- --:--:-- 13125 {    \"error\" : \"Unauthorized\",    \"path\" : \"\/protected-jwt\",    \"status\" : 401,    \"timestamp\" : \"2024-04-16T06:01:25.331+00:00\" } <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0432 API \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 JWT \u0432 HTTP \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 Authorization. \u0417\u0430 \u044d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u043a\u0430 OpenAM + OpenIG. \u041f\u043e\u0442\u0443\u0448\u0438\u0442\u0435 \u043f\u043e\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 <code>docker compose down<\/code><\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 OpenAM<\/h2>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430  \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 OpenAM. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e \u0442\u043e\u043a\u0435\u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 JWT (\u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0436\u0435).<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0438\u043c\u0435\u043d\u0430 \u0445\u043e\u0441\u0442\u043e\u0432 OpenAM \u0438 OpenIG \u0432 \u0444\u0430\u0439\u043b\u00a0<code>hosts<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440\u00a0<code>127.0.0.1 openam.example.org openig.example.org<\/code>\u00a0.<\/p>\n<p>\u0412 Windows \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0444\u0430\u0439\u043b\u00a0<code>hosts<\/code>\u00a0\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443\u00a0<code>C:\\\\Windows\\\\System32\\\\drivers\\\\etc\\\\hosts<\/code>\u00a0, \u0432 Linux \u0438 Mac \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443\u00a0<code>\/etc\/hosts<\/code>\u00a0.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u0444\u0430\u0439\u043b <code>docker-compose.yaml<\/code> \u0441\u0435\u0440\u0432\u0438\u0441 OpenAM:<\/p>\n<pre><code class=\"yaml\">...   openam:     image: openidentityplatform\/openam:latest     container_name: openam     ports:       - \"8080:8080\"     networks:       openam_network:         aliases:           - openam.example.org ... <\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 OpenAM \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>docker compose up openam<\/code>. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a OpenAM \u0437\u0430\u043f\u0443\u0449\u0435\u043d, \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0433\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">docker exec -w '\/usr\/openam\/ssoconfiguratortools' openam bash -c \\ 'echo \"ACCEPT_LICENSES=true SERVER_URL=http:\/\/openam.example.org:8080 DEPLOYMENT_URI=\/$OPENAM_PATH BASE_DIR=$OPENAM_DATA_DIR locale=en_US PLATFORM_LOCALE=en_US AM_ENC_KEY= ADMIN_PWD=passw0rd AMLDAPUSERPASSWD=p@passw0rd COOKIE_DOMAIN=example.org ACCEPT_LICENSES=true DATA_STORE=embedded DIRECTORY_SSL=SIMPLE DIRECTORY_SERVER=openam.example.org DIRECTORY_PORT=50389 DIRECTORY_ADMIN_PORT=4444 DIRECTORY_JMX_PORT=1689 ROOT_SUFFIX=dc=openam,dc=example,dc=org DS_DIRMGRDN=cn=Directory Manager DS_DIRMGRPASSWD=passw0rd\" > conf.file &amp;&amp; java -jar openam-configurator-tool*.jar --file conf.file' <\/code><\/pre>\n<p>\u0418 \u0434\u043e\u0436\u0434\u0438\u0442\u0435\u0441\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 STS<\/h3>\n<p>STS (Security Token Service) &#8212; \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0442\u043e\u043a\u0435\u043d\u0430 OpenAM \u0432 JWT. \u041f\u043e\u0441\u043b\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 OpenAM \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u043e\u043a\u0435\u043d \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0421\u0435\u0440\u0432\u0438\u0441 STS \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e  \u0442\u043e\u043a\u0435\u043d\u0430 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 JWT, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435. \u042d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c OpenIG.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 STS \u0437\u0430\u0439\u0434\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/p>\n<p><a href=\"http:\/\/openam.example.org:8080\/openam\/XUI\/#login\/\" rel=\"noopener noreferrer nofollow\">http:\/\/openam.example.org:8080\/openam\/XUI\/#login\/<\/a><\/p>\n<p>\u0412 \u043f\u043e\u043b\u0435 \u043b\u043e\u0433\u0438\u043d \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>amadmin<\/code>,  \u0432 \u043f\u043e\u043b\u0435 \u043f\u0430\u0440\u043e\u043b\u044c \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u00a0<code>ADMIN_PWD<\/code>\u00a0\u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u00a0<code>passw0rd<\/code><\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 realm, \u0432 \u043b\u0435\u0432\u043e\u043c \u043c\u0435\u043d\u044e \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u043f\u0443\u043d\u043a\u0442 STS \u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>Setting<\/p>\n<\/th>\n<th>\n<p>Value<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Supported Token Transforms<\/p>\n<\/td>\n<td>\n<p align=\"left\">OPENAM->OPENIDCONNECT;don&#8217;t invalidate interim OpenAM session<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Deployment Url Element<\/p>\n<\/td>\n<td>\n<p align=\"left\">jwt<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">The id of the OpenID Connect Token Provider<\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/openam.example.org\/openam\" rel=\"noopener noreferrer nofollow\">https:\/\/openam.example.org\/openam<\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Client secret<\/p>\n<\/td>\n<td>\n<p align=\"left\">changeme<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Confirm client secret<\/p>\n<\/td>\n<td>\n<p align=\"left\">changeme<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">The audience for issued tokens<\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/openam.example.org\/openam\" rel=\"noopener noreferrer nofollow\">https:\/\/openam.example.org\/openam<\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h3>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 OpenAM \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 realm, \u0432 \u043c\u0435\u043d\u044e \u0441\u043b\u0435\u0432\u0430 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0443\u043d\u043a\u0442 Subjects. \u0417\u0430\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u00a0<code>demo<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0435\u0433\u043e \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0438 \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u0441\u0441\u044b\u043b\u043a\u0443 Edit \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 Password. \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c. \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u044b\u0439\u0434\u0438\u0442\u0435 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 OpenIG<\/h2>\n<p>OpenIG \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c. \u041e\u043d \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043a\u0435\u043d \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 JWT \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 OpenAM \u0438, \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 Authorization.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 <code>openig-config<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0435 2 \u0444\u0430\u0439\u043b\u0430: <code>admin.json<\/code><\/p>\n<pre><code class=\"json\">{     \"prefix\": \"openig\",     \"mode\": \"PRODUCTION\" }<\/code><\/pre>\n<p>\u0438 <code>config.json<\/code><\/p>\n<pre><code class=\"json\">{     \"heap\": [],     \"handler\": {         \"type\": \"Chain\",         \"config\": {             \"filters\": [],             \"handler\": {                 \"type\": \"Router\",                 \"name\": \"_router\",                 \"capture\": \"all\"             }         }     } } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043e\u0431\u043e\u0433\u0430\u0449\u0430\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c Authorization \u0441 JWT \u0442\u043e\u043a\u0435\u043d\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0438\u0437 OpenAM.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043f\u043a\u0443 <code>openig-config\/routes\/<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b <code>10-protected.json<\/code>.<\/p>\n<pre><code class=\"json\">{     \"name\": \"${matches(request.uri.path, '^\/api\/protected-jwt') || matches(request.uri.path, '^\/protected-jwt')}\",     \"condition\": \"${matches(request.uri.path, '^\/api\/protected-jwt') || matches(request.uri.path, '^\/protected-jwt')}\",     \"monitor\": true,     \"timer\": true,     \"handler\": {         \"type\": \"Chain\",         \"config\": {             \"filters\": [                 {                     \"type\": \"ConditionalFilter\",                     \"config\": {                         \"condition\": \"${empty contexts.sts.issuedToken and not empty request.cookies['iPlanetDirectoryPro'][0].value}\",                         \"delegate\": {                             \"type\": \"TokenTransformationFilter\",                             \"config\": {                                 \"openamUri\": \"${system['openam']}\",                                 \"realm\": \"\/\",                                 \"instance\": \"jwt\",                                 \"from\": \"OPENAM\",                                 \"to\": \"OPENIDCONNECT\",                                 \"idToken\": \"${request.cookies['iPlanetDirectoryPro'][0].value}\"                             }                         }                     }                 },                 {                     \"type\": \"ConditionalFilter\",                     \"config\": {                         \"condition\": \"${not empty contexts.sts.issuedToken}\",                         \"delegate\": {                             \"type\": \"HeaderFilter\",                             \"config\": {                                 \"messageType\": \"REQUEST\",                                 \"remove\": [                                     \"Authorization\",                                     \"JWT\"                                 ],                                 \"add\": {                                     \"Authorization\": [                                         \"Bearer ${contexts.sts.issuedToken}\"                                     ]                                 }                             }                         }                     }                 },                 {                     \"type\": \"ConditionEnforcementFilter\",                     \"config\": {                         \"condition\": \"${not empty contexts.sts.issuedToken}\",                         \"failureHandler\": {                             \"type\": \"StaticResponseHandler\",                             \"config\": {                                 \"status\": 302,                                 \"reason\": \"Found\",                                 \"headers\": {                                     \"Content-Type\": [                                         \"application\/json\"                                     ],                                     \"Location\": [                                         \"${system['openam']}\/UI\/Login?org=\/&amp;goto=${urlEncode(contexts.router.originalUri)}\"                                     ]                                 },                                 \"entity\": \"{ \\\\\"Redirect\\\\\": \\\\\"${system['openam']}\/UI\/Login?org=\/&amp;goto=${urlEncode(contexts.router.originalUri)}\\\\\"}\"                             }                         }                     }                 }             ],             \"handler\": \"EndpointHandler\"         }     },     \"heap\": [         {             \"name\": \"EndpointHandler\",             \"type\": \"DispatchHandler\",             \"config\": {                 \"bindings\": [                     {                         \"handler\": \"ClientHandler\",                         \"capture\": \"all\",                         \"baseURI\": \"${matchingGroups(system['spring-service'],\\\\\"((http|https):\\\\\/\\\\\/(.[^\\\\\/]*))\\\\\")[1]}\"                     }                 ]             }         }     ] } <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u0442 \u0434\u0432\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438: API &#8212; <code>\/api\/protected-jwt<\/code> \u0438 UI &#8212; <code>\/protected-jwt<\/code>.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 OpenIG \u0432 <code>docker-compose.yaml<\/code> \u0444\u0430\u0439\u043b \u0438 \u0443\u0431\u0435\u0440\u0438\u0442\u0435 \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u043f\u043e\u0440\u0442\u043e\u0432 \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <code>spring-service<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 OpenIG.<\/p>\n<pre><code class=\"yaml\">services:   openam:     image: openidentityplatform\/openam:latest     container_name: <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-373909","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/373909","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=373909"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/373909\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=373909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=373909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=373909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}