@eui/cli 21.0.0-alpha.4 → 21.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/.version.properties +1 -0
  2. package/bin/eui-cli.js +47 -0
  3. package/lib/build.js +155 -0
  4. package/lib/cli.js +123 -0
  5. package/lib/config.js +58 -0
  6. package/lib/generators.js +75 -0
  7. package/lib/install.js +45 -0
  8. package/lib/maven-build/build.xml +115 -0
  9. package/lib/maven-build/lib/ant-contrib-20061014.jar +0 -0
  10. package/lib/maven-build/pom.xml +64 -0
  11. package/lib/post-build.js +33 -0
  12. package/lib/skeletons/_angular/base/.browserslistrc +16 -0
  13. package/lib/skeletons/_angular/base/.editorconfig +16 -0
  14. package/lib/skeletons/_angular/base/.euirc.json +8 -0
  15. package/lib/skeletons/_angular/base/README.md +26 -0
  16. package/lib/skeletons/_angular/base/angular.json +158 -0
  17. package/lib/skeletons/_angular/base/gitignore_TO_REPLACE +51 -0
  18. package/lib/skeletons/_angular/base/mock/app/models/user.js +6 -0
  19. package/lib/skeletons/_angular/base/mock/app/routes/index.js +5 -0
  20. package/lib/skeletons/_angular/base/mock/app/routes/user_routes.js +44 -0
  21. package/lib/skeletons/_angular/base/mock/db/db.json +10 -0
  22. package/lib/skeletons/_angular/base/mock/server.js +23 -0
  23. package/lib/skeletons/_angular/base/package.json +38 -0
  24. package/lib/skeletons/_angular/base/proxy-mock.conf.json +6 -0
  25. package/lib/skeletons/_angular/base/proxy.conf.json +6 -0
  26. package/lib/skeletons/_angular/base/src/.eslintrc.json +121 -0
  27. package/lib/skeletons/_angular/base/src/app/app-starter.service.spec.ts +68 -0
  28. package/lib/skeletons/_angular/base/src/app/app-starter.service.ts +68 -0
  29. package/lib/skeletons/_angular/base/src/app/app.component.html +35 -0
  30. package/lib/skeletons/_angular/base/src/app/app.component.spec.ts +60 -0
  31. package/lib/skeletons/_angular/base/src/app/app.component.ts +35 -0
  32. package/lib/skeletons/_angular/base/src/app/app.config.ts +84 -0
  33. package/lib/skeletons/_angular/base/src/app/app.routes.ts +9 -0
  34. package/lib/skeletons/_angular/base/src/app/features/home/home.component.html +41 -0
  35. package/lib/skeletons/_angular/base/src/app/features/home/home.component.ts +17 -0
  36. package/lib/skeletons/_angular/base/src/app/features/home/home.routes.ts +6 -0
  37. package/lib/skeletons/_angular/base/src/app/features/module1/components/page1/page1.component.html +7 -0
  38. package/lib/skeletons/_angular/base/src/app/features/module1/components/page1/page1.component.ts +10 -0
  39. package/lib/skeletons/_angular/base/src/app/features/module1/components/page2/page2.component.html +7 -0
  40. package/lib/skeletons/_angular/base/src/app/features/module1/components/page2/page2.component.ts +10 -0
  41. package/lib/skeletons/_angular/base/src/app/features/module1/module1.component.html +7 -0
  42. package/lib/skeletons/_angular/base/src/app/features/module1/module1.component.ts +10 -0
  43. package/lib/skeletons/_angular/base/src/app/features/module1/module1.routes.ts +10 -0
  44. package/lib/skeletons/_angular/base/src/app/features/module2/module2.component.html +7 -0
  45. package/lib/skeletons/_angular/base/src/app/features/module2/module2.component.ts +10 -0
  46. package/lib/skeletons/_angular/base/src/app/features/module2/module2.routes.ts +6 -0
  47. package/lib/skeletons/_angular/base/src/app/shared/testing/router.mock.ts +18 -0
  48. package/lib/skeletons/_angular/base/src/assets/config/env-json-config-dev.json +8 -0
  49. package/lib/skeletons/_angular/base/src/assets/config/env-json-config-prod.json +8 -0
  50. package/lib/skeletons/_angular/base/src/assets/config/env-json-config.json +7 -0
  51. package/lib/skeletons/_angular/base/src/assets/i18n/en.json +7 -0
  52. package/lib/skeletons/_angular/base/src/assets/i18n/fr.json +7 -0
  53. package/lib/skeletons/_angular/base/src/config/global.ts +33 -0
  54. package/lib/skeletons/_angular/base/src/config/index.ts +8 -0
  55. package/lib/skeletons/_angular/base/src/config/modules.ts +7 -0
  56. package/lib/skeletons/_angular/base/src/dummy.spec.ts +6 -0
  57. package/lib/skeletons/_angular/base/src/environments/environment.prod.ts +11 -0
  58. package/lib/skeletons/_angular/base/src/environments/environment.ts +15 -0
  59. package/lib/skeletons/_angular/base/src/favicon.ico +0 -0
  60. package/lib/skeletons/_angular/base/src/index.html +20 -0
  61. package/lib/skeletons/_angular/base/src/karma.conf.js +7 -0
  62. package/lib/skeletons/_angular/base/src/main.ts +20 -0
  63. package/lib/skeletons/_angular/base/src/styles.scss +1 -0
  64. package/lib/skeletons/_angular/base/src/tsconfig.app.json +18 -0
  65. package/lib/skeletons/_angular/base/src/tsconfig.spec.json +14 -0
  66. package/lib/skeletons/_angular/base/tsconfig.json +27 -0
  67. package/lib/skeletons/_angular/base-mobile/angular.json +156 -0
  68. package/lib/skeletons/_angular/base-mobile/ionic.config.json +5 -0
  69. package/lib/skeletons/_angular/base-mobile/ngsw-config.json +33 -0
  70. package/lib/skeletons/_angular/base-mobile/package.json +27 -0
  71. package/lib/skeletons/_angular/base-mobile/src/app/app-routing.module.ts +18 -0
  72. package/lib/skeletons/_angular/base-mobile/src/app/app-starter.service.ts +73 -0
  73. package/lib/skeletons/_angular/base-mobile/src/app/app.component.html +47 -0
  74. package/lib/skeletons/_angular/base-mobile/src/app/app.component.ts +81 -0
  75. package/lib/skeletons/_angular/base-mobile/src/app/app.config.ts +81 -0
  76. package/lib/skeletons/_angular/base-mobile/src/app/app.module.ts +44 -0
  77. package/lib/skeletons/_angular/base-mobile/src/app/core/components/.gitkeep +0 -0
  78. package/lib/skeletons/_angular/base-mobile/src/app/core/core.module.ts +89 -0
  79. package/lib/skeletons/_angular/base-mobile/src/app/core/reducers/index.ts +32 -0
  80. package/lib/skeletons/_angular/base-mobile/src/app/features/about/about-routing.module.ts +45 -0
  81. package/lib/skeletons/_angular/base-mobile/src/app/features/about/about.component.html +70 -0
  82. package/lib/skeletons/_angular/base-mobile/src/app/features/about/about.component.ts +19 -0
  83. package/lib/skeletons/_angular/base-mobile/src/app/features/about/about.module.ts +30 -0
  84. package/lib/skeletons/_angular/base-mobile/src/app/features/about/change-log/changelog.component.html +11 -0
  85. package/lib/skeletons/_angular/base-mobile/src/app/features/about/change-log/changelog.component.ts +102 -0
  86. package/lib/skeletons/_angular/base-mobile/src/app/features/about/help-support/help-support.component.html +20 -0
  87. package/lib/skeletons/_angular/base-mobile/src/app/features/about/help-support/help-support.component.ts +75 -0
  88. package/lib/skeletons/_angular/base-mobile/src/app/features/about/legal-notice/legal-notice.component.html +12 -0
  89. package/lib/skeletons/_angular/base-mobile/src/app/features/about/legal-notice/legal-notice.component.ts +8 -0
  90. package/lib/skeletons/_angular/base-mobile/src/app/features/about/licence-details/licence-details.component.html +48 -0
  91. package/lib/skeletons/_angular/base-mobile/src/app/features/about/licence-details/licence-details.component.ts +7 -0
  92. package/lib/skeletons/_angular/base-mobile/src/app/features/about/opensource-licences/opensource-licences.component.html +11 -0
  93. package/lib/skeletons/_angular/base-mobile/src/app/features/about/opensource-licences/opensource-licences.component.ts +31 -0
  94. package/lib/skeletons/_angular/base-mobile/src/app/features/about/privacy-statement/privacy-statement.component.html +11 -0
  95. package/lib/skeletons/_angular/base-mobile/src/app/features/about/privacy-statement/privacy-statement.component.ts +103 -0
  96. package/lib/skeletons/_angular/base-mobile/src/app/features/home/home-routing.module.ts +15 -0
  97. package/lib/skeletons/_angular/base-mobile/src/app/features/home/home.component.html +11 -0
  98. package/lib/skeletons/_angular/base-mobile/src/app/features/home/home.component.ts +9 -0
  99. package/lib/skeletons/_angular/base-mobile/src/app/features/home/home.module.ts +18 -0
  100. package/lib/skeletons/_angular/base-mobile/src/app/features/module1/components/page1/page1.component.html +11 -0
  101. package/lib/skeletons/_angular/base-mobile/src/app/features/module1/components/page1/page1.component.ts +8 -0
  102. package/lib/skeletons/_angular/base-mobile/src/app/features/module1/components/page2/page2.component.html +11 -0
  103. package/lib/skeletons/_angular/base-mobile/src/app/features/module1/components/page2/page2.component.ts +8 -0
  104. package/lib/skeletons/_angular/base-mobile/src/app/features/module1/module1-routing.module.ts +18 -0
  105. package/lib/skeletons/_angular/base-mobile/src/app/features/module1/module1.component.html +15 -0
  106. package/lib/skeletons/_angular/base-mobile/src/app/features/module1/module1.component.ts +17 -0
  107. package/lib/skeletons/_angular/base-mobile/src/app/features/module1/module1.module.ts +21 -0
  108. package/lib/skeletons/_angular/base-mobile/src/app/features/module2/module2-routing.module.ts +16 -0
  109. package/lib/skeletons/_angular/base-mobile/src/app/features/module2/module2.component.html +11 -0
  110. package/lib/skeletons/_angular/base-mobile/src/app/features/module2/module2.component.ts +7 -0
  111. package/lib/skeletons/_angular/base-mobile/src/app/features/module2/module2.module.ts +17 -0
  112. package/lib/skeletons/_angular/base-mobile/src/app/shared/shared.module.ts +16 -0
  113. package/lib/skeletons/_angular/base-mobile/src/app/shared/testing/router.mock.ts +18 -0
  114. package/lib/skeletons/_angular/base-mobile/src/assets/docs/pdf-test.pdf +0 -0
  115. package/lib/skeletons/_angular/base-mobile/src/assets/i18n/en.json +25 -0
  116. package/lib/skeletons/_angular/base-mobile/src/assets/i18n/es.json +24 -0
  117. package/lib/skeletons/_angular/base-mobile/src/assets/i18n/fr.json +25 -0
  118. package/lib/skeletons/_angular/base-mobile/src/assets/i18n/tr.json +25 -0
  119. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-1024.png +0 -0
  120. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-114.png +0 -0
  121. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-120.png +0 -0
  122. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-128.png +0 -0
  123. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-144.png +0 -0
  124. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-152.png +0 -0
  125. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-16.png +0 -0
  126. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-180.png +0 -0
  127. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-192.png +0 -0
  128. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-32.png +0 -0
  129. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-36.png +0 -0
  130. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-384.png +0 -0
  131. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-48.png +0 -0
  132. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-512.png +0 -0
  133. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-57.png +0 -0
  134. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-60.png +0 -0
  135. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-72.png +0 -0
  136. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-76.png +0 -0
  137. package/lib/skeletons/_angular/base-mobile/src/assets/icons/app-icon-96.png +0 -0
  138. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1125-2436.png +0 -0
  139. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1170-2532.png +0 -0
  140. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1179-2556.png +0 -0
  141. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1242-2208.png +0 -0
  142. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1242-2688.png +0 -0
  143. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1284-2778.png +0 -0
  144. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1290-2796.png +0 -0
  145. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1488-2266.png +0 -0
  146. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1536-2048.png +0 -0
  147. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1620-2160.png +0 -0
  148. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1640-2360.png +0 -0
  149. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1668-2224.png +0 -0
  150. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-1668-2388.png +0 -0
  151. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-2048-2732.png +0 -0
  152. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-640-1136.png +0 -0
  153. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-750-1334.png +0 -0
  154. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-landscape-828-1792.png +0 -0
  155. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1125-2436.png +0 -0
  156. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1170-2532.png +0 -0
  157. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1179-2556.png +0 -0
  158. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1242-2208.png +0 -0
  159. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1242-2688.png +0 -0
  160. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1284-2778.png +0 -0
  161. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1290-2796.png +0 -0
  162. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1488-2266.png +0 -0
  163. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1536-2048.png +0 -0
  164. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1620-2160.png +0 -0
  165. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1640-2360.png +0 -0
  166. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1668-2224.png +0 -0
  167. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-1668-2388.png +0 -0
  168. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-2048-2732.png +0 -0
  169. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-640-1136.png +0 -0
  170. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-750-1334.png +0 -0
  171. package/lib/skeletons/_angular/base-mobile/src/assets/icons/apple-splash-portrait-828-1792.png +0 -0
  172. package/lib/skeletons/_angular/base-mobile/src/assets/images/app-icon.svg +10 -0
  173. package/lib/skeletons/_angular/base-mobile/src/config/global.ts +39 -0
  174. package/lib/skeletons/_angular/base-mobile/src/config/index.ts +8 -0
  175. package/lib/skeletons/_angular/base-mobile/src/config/modules.ts +7 -0
  176. package/lib/skeletons/_angular/base-mobile/src/index.html +76 -0
  177. package/lib/skeletons/_angular/base-mobile/src/main.ts +23 -0
  178. package/lib/skeletons/_angular/base-mobile/src/manifest.webmanifest +66 -0
  179. package/lib/skeletons/_angular/base-mobile/src/tsconfig.app.json +20 -0
  180. package/lib/skeletons/_angular/options/ecl-ec/angular.json +181 -0
  181. package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.html +237 -0
  182. package/lib/skeletons/_angular/options/ecl-ec/src/app/app.component.ts +65 -0
  183. package/lib/skeletons/_angular/options/ecl-ec/src/app/app.config.ts +84 -0
  184. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/home/home.component.html +71 -0
  185. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/home/home.component.ts +20 -0
  186. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/module1/components/page1/page1.component.html +1 -0
  187. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/module1/components/page1/page1.component.ts +7 -0
  188. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/module1/components/page2/page2.component.html +1 -0
  189. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/module1/components/page2/page2.component.ts +7 -0
  190. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/module1/module1.component.html +1 -0
  191. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/module1/module1.component.ts +7 -0
  192. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/module2/module2.component.html +1 -0
  193. package/lib/skeletons/_angular/options/ecl-ec/src/app/features/module2/module2.component.ts +7 -0
  194. package/lib/skeletons/_angular/options/ecl-ec/src/config/global.ts +23 -0
  195. package/lib/skeletons/_angular/options/ecl-eu/angular.json +181 -0
  196. package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.html +203 -0
  197. package/lib/skeletons/_angular/options/ecl-eu/src/app/app.component.ts +65 -0
  198. package/lib/skeletons/_angular/options/ecl-eu/src/app/app.config.ts +84 -0
  199. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/home/home.component.html +71 -0
  200. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/home/home.component.ts +20 -0
  201. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/module1/components/page1/page1.component.html +1 -0
  202. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/module1/components/page1/page1.component.ts +7 -0
  203. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/module1/components/page2/page2.component.html +1 -0
  204. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/module1/components/page2/page2.component.ts +7 -0
  205. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/module1/module1.component.html +1 -0
  206. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/module1/module1.component.ts +7 -0
  207. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/module2/module2.component.html +1 -0
  208. package/lib/skeletons/_angular/options/ecl-eu/src/app/features/module2/module2.component.ts +7 -0
  209. package/lib/skeletons/_angular/options/ecl-eu/src/app/shared/shared.module.ts +19 -0
  210. package/lib/skeletons/_angular/options/ecl-eu/src/config/global.ts +23 -0
  211. package/lib/skeletons/web-maven/package.json +17 -0
  212. package/lib/skeletons/web-maven/pom.xml +55 -0
  213. package/lib/skeletons/web-maven/src/main/java/eu/europa/ec/digit/eui/angular2clistarter/servlet/SpringWebApplicationInitializer.java +22 -0
  214. package/lib/skeletons/web-maven/src/main/java/eu/europa/ec/digit/eui/angular2clistarter/spring/SpringRestConfiguration.java +24 -0
  215. package/lib/skeletons/web-maven/src/main/java/eu/europa/ec/digit/eui/angular2clistarter/spring/rest/UserDetailsResource.java +23 -0
  216. package/lib/skeletons/web-maven/src/main/resources/ecas-config-application-name.xml +7 -0
  217. package/lib/skeletons/web-maven/src/main/webapp/WEB-INF/dispatcher-servlet.xml +11 -0
  218. package/lib/skeletons/web-maven/src/main/webapp/WEB-INF/web.xml +38 -0
  219. package/lib/skeletons/web-maven/src/main/webapp/WEB-INF/weblogic.xml +16 -0
  220. package/lib/skeletons/web-maven/src/main/webapp/index.jsp +30 -0
  221. package/lib/skeletons/web-spring-boot/myapp-web/pom.xml +83 -0
  222. package/lib/skeletons/web-spring-boot/myapp-web-rest/pom.xml +83 -0
  223. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/MyappApplication.java +46 -0
  224. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/domain/Address.java +65 -0
  225. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/domain/Building.java +44 -0
  226. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/repositories/BuildingRepository.java +11 -0
  227. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/BuildingResource.java +26 -0
  228. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/SwaggerConfig.java +16 -0
  229. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/support/HateoasPageableHandlerMethodArgumentResolver.java +45 -0
  230. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/support/HypermediaSupport.java +25 -0
  231. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/resources/support/PageJsonSerializer.java +17 -0
  232. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/CachingPreventionFilter.java +29 -0
  233. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/CsrfPreventionFilter.java +35 -0
  234. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/FakeAuthenticationFilter.java +372 -0
  235. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/security/SecurityConfig.java +47 -0
  236. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/services/BuildingSearchCriteria.java +26 -0
  237. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/services/BuildingService.java +10 -0
  238. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/java/myapp/services/BuildingServiceImpl.java +26 -0
  239. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/resources/application.properties +0 -0
  240. package/lib/skeletons/web-spring-boot/myapp-web-rest/src/main/resources/data.sql +11 -0
  241. package/lib/skeletons/web-spring-boot/pom.xml +30 -0
  242. package/lib/skeletons/web-symfony/myapp-web/angular.json +169 -0
  243. package/lib/skeletons/web-symfony/myapp-web/package.json +23 -0
  244. package/lib/skeletons/web-symfony/myapp-web/src/app/app-routing.module.ts +18 -0
  245. package/lib/skeletons/web-symfony/myapp-web/src/app/app.component.ts +77 -0
  246. package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/components/products.component.html +160 -0
  247. package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/components/products.component.scss +0 -0
  248. package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/components/products.component.ts +104 -0
  249. package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/models/product.model.ts +6 -0
  250. package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/products-routing.module.ts +16 -0
  251. package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/products.module.ts +16 -0
  252. package/lib/skeletons/web-symfony/myapp-web/src/app/features/products/services/products.service.ts +29 -0
  253. package/lib/skeletons/web-symfony/myapp-web/src/environments/environment.ts +17 -0
  254. package/lib/skeletons/web-symfony/myapp-web-rest/.env +28 -0
  255. package/lib/skeletons/web-symfony/myapp-web-rest/bin/console +42 -0
  256. package/lib/skeletons/web-symfony/myapp-web-rest/composer.json +67 -0
  257. package/lib/skeletons/web-symfony/myapp-web-rest/composer.lock +3572 -0
  258. package/lib/skeletons/web-symfony/myapp-web-rest/config/bootstrap.php +21 -0
  259. package/lib/skeletons/web-symfony/myapp-web-rest/config/bundles.php +12 -0
  260. package/lib/skeletons/web-symfony/myapp-web-rest/config/config.yml +0 -0
  261. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/cache.yaml +19 -0
  262. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/dev/routing.yaml +3 -0
  263. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/doctrine.yaml +29 -0
  264. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/doctrine_migrations.yaml +5 -0
  265. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/framework.yaml +17 -0
  266. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/prod/doctrine.yaml +32 -0
  267. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/routing.yaml +4 -0
  268. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/sensio_framework_extra.yaml +3 -0
  269. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/test/framework.yaml +4 -0
  270. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/test/routing.yaml +3 -0
  271. package/lib/skeletons/web-symfony/myapp-web-rest/config/packages/twig.yaml +4 -0
  272. package/lib/skeletons/web-symfony/myapp-web-rest/config/routes/annotations.yaml +3 -0
  273. package/lib/skeletons/web-symfony/myapp-web-rest/config/routes/dev/twig.yaml +3 -0
  274. package/lib/skeletons/web-symfony/myapp-web-rest/config/routes.yaml +3 -0
  275. package/lib/skeletons/web-symfony/myapp-web-rest/config/services.yaml +27 -0
  276. package/lib/skeletons/web-symfony/myapp-web-rest/public/index.php +27 -0
  277. package/lib/skeletons/web-symfony/myapp-web-rest/src/Controller/ProductController.php +196 -0
  278. package/lib/skeletons/web-symfony/myapp-web-rest/src/Entity/Product.php +99 -0
  279. package/lib/skeletons/web-symfony/myapp-web-rest/src/Kernel.php +53 -0
  280. package/lib/skeletons/web-symfony/myapp-web-rest/src/Migrations/Version20190604101623.php +31 -0
  281. package/lib/skeletons/web-symfony/myapp-web-rest/src/Migrations/Version20190604101638.php +35 -0
  282. package/lib/skeletons/web-symfony/myapp-web-rest/src/Repository/ProductRepository.php +51 -0
  283. package/lib/skeletons/web-symfony/myapp-web-rest/symfony.lock +274 -0
  284. package/lib/skeletons/web-symfony/myapp-web-rest/templates/base.html.twig +12 -0
  285. package/lib/skeletons/web-symfony/myapp-web-rest/templates/lucky/number.html.twig +1 -0
  286. package/lib/skeletons/web-symfony/myapp-web-rest/templates/product/index.html.twig +20 -0
  287. package/lib/utils.js +13 -0
  288. package/package.json +1 -1
  289. package/sonar-project.properties +14 -0
@@ -0,0 +1,26 @@
1
+ package @app.group.id@.@app.name@.resources;
2
+
3
+ import @app.group.id@.@app.name@.resources.support.HypermediaSupport;
4
+ import @app.group.id@.@app.name@.services.BuildingService;
5
+ import org.springframework.data.domain.Pageable;
6
+ import org.springframework.http.ResponseEntity;
7
+ import org.springframework.web.bind.annotation.GetMapping;
8
+ import org.springframework.web.bind.annotation.RequestMapping;
9
+ import org.springframework.web.bind.annotation.RestController;
10
+
11
+ @RestController
12
+ @RequestMapping("api/buildings")
13
+ public class BuildingResource {
14
+ private BuildingService buildingService;
15
+ private HypermediaSupport hateoasPageSupport;
16
+
17
+ public BuildingResource(BuildingService buildingService, HypermediaSupport hateoasPageSupport) {
18
+ this.buildingService = buildingService;
19
+ this.hateoasPageSupport = hateoasPageSupport;
20
+ }
21
+
22
+ @GetMapping()
23
+ public ResponseEntity getAllBuildings(Pageable pageable) {
24
+ return hateoasPageSupport.wrap(buildingService.findAll(pageable), pageable);
25
+ }
26
+ }
@@ -0,0 +1,16 @@
1
+ package @app.group.id@.@app.name@.resources;
2
+
3
+ import org.springdoc.core.models.GroupedOpenApi;
4
+ import org.springframework.context.annotation.Bean;
5
+ import org.springframework.context.annotation.Configuration;
6
+
7
+ @Configuration
8
+ public class SwaggerConfig {
9
+ @Bean
10
+ public GroupedOpenApi publicApi() {
11
+ return GroupedOpenApi.builder()
12
+ .group("springshop-public")
13
+ .pathsToMatch("/api/**")
14
+ .build();
15
+ }
16
+ }
@@ -0,0 +1,45 @@
1
+ package @app.group.id@.@app.name@.resources.support;
2
+
3
+ import org.springframework.core.MethodParameter;
4
+ import org.springframework.data.domain.PageRequest;
5
+ import org.springframework.data.domain.Pageable;
6
+ import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
7
+ import org.springframework.web.bind.support.WebDataBinderFactory;
8
+ import org.springframework.web.context.request.NativeWebRequest;
9
+ import org.springframework.web.method.support.ModelAndViewContainer;
10
+
11
+ public class HateoasPageableHandlerMethodArgumentResolver extends PageableHandlerMethodArgumentResolver {
12
+ protected int defaultPageSize = 10;
13
+
14
+ @Override
15
+ public Pageable resolveArgument(MethodParameter methodParameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
16
+ String contentRange = webRequest.getHeader("Content-Range");
17
+ if (contentRange != null && contentRange.length() > 0) {
18
+ contentRange = contentRange.trim();
19
+ if (contentRange.startsWith("item ")) {
20
+ int index = contentRange.indexOf("/");
21
+ String [] range = null;
22
+ if (index > 0) {
23
+ range = contentRange.substring("item ".length(), index).split("-");
24
+ } else {
25
+ range = contentRange.substring("item ".length()).split("-");
26
+ }
27
+
28
+ int from = Integer.parseInt(range [0]);
29
+ int to = defaultPageSize;
30
+ if (range.length > 1) {
31
+ to = Integer.parseInt(range [1]);
32
+ }
33
+
34
+ // Page size is never <= 0:
35
+ int pageSize = Math.max(to - from + 1, 1);
36
+ // Page is zero-based:
37
+ int page = from / pageSize;
38
+
39
+ return PageRequest.of(page, pageSize);
40
+ }
41
+ }
42
+
43
+ return super.resolveArgument(methodParameter, mavContainer, webRequest, binderFactory);
44
+ }
45
+ }
@@ -0,0 +1,25 @@
1
+ package @app.group.id@.@app.name@.resources.support;
2
+
3
+ import org.springframework.data.domain.Page;
4
+ import org.springframework.data.domain.Pageable;
5
+ import org.springframework.http.HttpHeaders;
6
+ import org.springframework.http.HttpStatus;
7
+ import org.springframework.http.ResponseEntity;
8
+ import org.springframework.stereotype.Component;
9
+
10
+ @Component
11
+ public class HypermediaSupport {
12
+ public ResponseEntity<Page> wrap(Page page, Pageable pageable) {
13
+ HttpHeaders headers = new HttpHeaders();
14
+
15
+ long total = page.getTotalElements();
16
+ // Page and range are zero-based:
17
+ long from = page.getNumber() * page.getSize();
18
+ long to = from + pageable.getPageSize() - 1;
19
+
20
+ headers.add("Accept-Ranges", "item");
21
+ headers.add("Content-Range", "item " + from + "-" + to + "/" + total);
22
+
23
+ return new ResponseEntity<Page>(page, headers, HttpStatus.PARTIAL_CONTENT);
24
+ }
25
+ }
@@ -0,0 +1,17 @@
1
+ package @app.group.id@.@app.name@.resources.support;
2
+
3
+ import com.fasterxml.jackson.core.JsonGenerator;
4
+ import com.fasterxml.jackson.databind.JsonSerializer;
5
+ import com.fasterxml.jackson.databind.SerializerProvider;
6
+ import org.springframework.data.domain.Page;
7
+
8
+ import java.io.IOException;
9
+
10
+ public class PageJsonSerializer extends JsonSerializer {
11
+ @Override
12
+ public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
13
+ // Remove the page information that will be serialized to the HTTP headers instead:
14
+ Page page = (Page) o;
15
+ jsonGenerator.writeObject(page.getContent());
16
+ }
17
+ }
@@ -0,0 +1,29 @@
1
+ package @app.group.id@.@app.name@.security;
2
+
3
+ import jakarta.servlet.*;
4
+ import jakarta.servlet.http.HttpServletResponse;
5
+ import java.io.IOException;
6
+
7
+ // Prevents caching of REST service responses.
8
+ public class CachingPreventionFilter implements Filter {
9
+ public void init(FilterConfig filterConfig) throws ServletException {
10
+ // do nothing
11
+ }
12
+
13
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
14
+ HttpServletResponse response = (HttpServletResponse) servletResponse;
15
+ response.addIntHeader("Age", 0);
16
+ response.addHeader("Cache-Control", "no-cache,no-store,no-transform,must-revalidate");
17
+ response.addHeader("Expires", "Wed, 31 Dec 1969 23:59:59 GMT");
18
+ response.addHeader("Pragma", "no-cache");
19
+ response.addHeader("X-Robots-Tag", "noindex, nofollow");
20
+
21
+ if (filterChain != null) {
22
+ filterChain.doFilter(servletRequest, servletResponse);
23
+ }
24
+ }
25
+
26
+ public void destroy() {
27
+ // do nothing
28
+ }
29
+ }
@@ -0,0 +1,35 @@
1
+ package @app.group.id@.@app.name@.security;
2
+
3
+ import jakarta.servlet.*;
4
+ import jakarta.servlet.http.HttpServletRequest;
5
+ import jakarta.servlet.http.HttpServletResponse;
6
+ import java.io.IOException;
7
+
8
+ // Prevents non-ajax requests for REST services. This is to prevent Cross-Site Request Forgery (CSRF) attacks.
9
+ public class CsrfPreventionFilter implements Filter {
10
+ public void init(FilterConfig filterConfig) throws ServletException {
11
+ // do nothing
12
+ }
13
+
14
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
15
+ HttpServletRequest request = (HttpServletRequest) servletRequest;
16
+ HttpServletResponse response = (HttpServletResponse) servletResponse;
17
+
18
+ String origin = request.getHeader("Origin");
19
+ if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With")) || "OPTIONS".equalsIgnoreCase(request.getMethod()) || (origin != null && origin.trim().length() > 0)) {
20
+ response.addHeader("Content-Security-Policy", "default-src 'self'; connect-src 'self'; font-src 'none'; img-src 'self'; media-src 'self'; object-src 'self'; plugin-types application/pdf audio/x-wav; referrer no-referrer; reflected-xss block; script-src 'self'; style-src 'self'");
21
+ response.addHeader("X-Content-Security-Policy", "default-src 'self'; connect-src 'self'; font-src 'none'; img-src 'self'; media-src 'self'; object-src 'self'; plugin-types application/pdf audio/x-wav; referrer no-referrer; reflected-xss block; script-src 'self'; style-src 'self'");
22
+ response.addHeader("X-Content-Type-Options", "nosniff");
23
+ if (filterChain != null) {
24
+ filterChain.doFilter(servletRequest, servletResponse);
25
+ }
26
+ } else {
27
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
28
+ response.getWriter().write("The REST service can only be accessed programmatically.");
29
+ }
30
+ }
31
+
32
+ public void destroy() {
33
+ // do nothing
34
+ }
35
+ }
@@ -0,0 +1,372 @@
1
+ package @app.group.id@.@app.name@.security;
2
+
3
+ import com.sun.security.auth.UserPrincipal;
4
+ import org.springframework.security.core.Authentication;
5
+ import org.springframework.security.core.GrantedAuthority;
6
+ import org.springframework.security.core.authority.SimpleGrantedAuthority;
7
+ import org.springframework.security.core.context.SecurityContextHolder;
8
+ import org.springframework.stereotype.Component;
9
+
10
+ import jakarta.servlet.*;
11
+ import jakarta.servlet.http.*;
12
+ import java.io.BufferedReader;
13
+ import java.io.IOException;
14
+ import java.io.UnsupportedEncodingException;
15
+ import java.security.AuthProvider;
16
+ import java.security.Principal;
17
+ import java.util.*;
18
+
19
+ // Filter used to fake user login. This allows for testing different user roles in the same application.
20
+ // WARNING: do NOT use this in production; security will be compromised! For now, it will only be activated from requests coming from localhost.
21
+ @Component
22
+ public class FakeAuthenticationFilter implements Filter {
23
+ @Override
24
+ public void init(FilterConfig filterConfig) throws ServletException {
25
+ // do nothing
26
+ }
27
+
28
+ @Override
29
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
30
+ final HttpServletRequest request = (HttpServletRequest) servletRequest;
31
+ HttpServletResponse response = (HttpServletResponse) servletResponse;
32
+
33
+ if (!"localhost".equals(request.getServerName())) {
34
+ filterChain.doFilter(request, response);
35
+ } else {
36
+ final String fakeUsername = request.getHeader("x-fake-authentication");
37
+ if (fakeUsername == null) {
38
+ filterChain.doFilter(request, response);
39
+ } else {
40
+ /*
41
+ System.out.println("---------- got fake userid: " + fakeUsername);
42
+ HttpServletRequest fakeRequest = new HttpServletRequest() {
43
+ public Principal getUserPrincipal() {
44
+ return new UserPrincipal(fakeUsername);
45
+ }
46
+
47
+ // Delegate all the other methods:
48
+ public String getAuthType() {
49
+ return request.getAuthType();
50
+ }
51
+
52
+ public Cookie[] getCookies() {
53
+ return request.getCookies();
54
+ }
55
+
56
+ public long getDateHeader(String s) {
57
+ return request.getDateHeader(s);
58
+ }
59
+
60
+ public String getHeader(String s) {
61
+ return request.getHeader(s);
62
+ }
63
+
64
+ public Enumeration<String> getHeaders(String s) {
65
+ return request.getHeaders(s);
66
+ }
67
+
68
+ public Enumeration<String> getHeaderNames() {
69
+ return request.getHeaderNames();
70
+ }
71
+
72
+ public int getIntHeader(String s) {
73
+ return request.getIntHeader(s);
74
+ }
75
+
76
+ public String getMethod() {
77
+ return request.getMethod();
78
+ }
79
+
80
+ public String getPathInfo() {
81
+ return request.getPathInfo();
82
+ }
83
+
84
+ public String getPathTranslated() {
85
+ return request.getPathTranslated();
86
+ }
87
+
88
+ public String getContextPath() {
89
+ return request.getContextPath();
90
+ }
91
+
92
+ public String getQueryString() {
93
+ return request.getQueryString();
94
+ }
95
+
96
+ public String getRemoteUser() {
97
+ return request.getRemoteUser();
98
+ }
99
+
100
+ public boolean isUserInRole(String s) {
101
+ return request.isUserInRole(s);
102
+ }
103
+
104
+ public String getRequestedSessionId() {
105
+ return request.getRequestedSessionId();
106
+ }
107
+
108
+ public String getRequestURI() {
109
+ return request.getRequestURI();
110
+ }
111
+
112
+ public StringBuffer getRequestURL() {
113
+ return request.getRequestURL();
114
+ }
115
+
116
+ public String getServletPath() {
117
+ return request.getServletPath();
118
+ }
119
+
120
+ public HttpSession getSession(boolean b) {
121
+ return request.getSession(b);
122
+ }
123
+
124
+ public HttpSession getSession() {
125
+ return request.getSession();
126
+ }
127
+
128
+ public String changeSessionId() {
129
+ return request.changeSessionId();
130
+ }
131
+
132
+ public boolean isRequestedSessionIdValid() {
133
+ return request.isRequestedSessionIdValid();
134
+ }
135
+
136
+ public boolean isRequestedSessionIdFromCookie() {
137
+ return request.isRequestedSessionIdFromCookie();
138
+ }
139
+
140
+ public boolean isRequestedSessionIdFromURL() {
141
+ return request.isRequestedSessionIdFromURL();
142
+ }
143
+
144
+ public boolean isRequestedSessionIdFromUrl() {
145
+ return request.isRequestedSessionIdFromUrl();
146
+ }
147
+
148
+ public boolean authenticate(HttpServletResponse httpServletResponse) throws IOException, ServletException {
149
+ return request.authenticate(httpServletResponse);
150
+ }
151
+
152
+ public void login(String s, String s1) throws ServletException {
153
+ request.login(s, s1);
154
+ }
155
+
156
+ public void logout() throws ServletException {
157
+ request.logout();
158
+ }
159
+
160
+ public Collection<Part> getParts() throws IOException, ServletException {
161
+ return request.getParts();
162
+ }
163
+
164
+ public Part getPart(String s) throws IOException, ServletException {
165
+ return request.getPart(s);
166
+ }
167
+
168
+ public <T extends HttpUpgradeHandler> T upgrade(Class<T> aClass) throws IOException, ServletException {
169
+ return request.upgrade(aClass);
170
+ }
171
+
172
+ public Object getAttribute(String s) {
173
+ return request.getAttribute(s);
174
+ }
175
+
176
+ public Enumeration<String> getAttributeNames() {
177
+ return request.getAttributeNames();
178
+ }
179
+
180
+ public String getCharacterEncoding() {
181
+ return request.getCharacterEncoding();
182
+ }
183
+
184
+ public void setCharacterEncoding(String s) throws UnsupportedEncodingException {
185
+ request.setCharacterEncoding(s);
186
+ }
187
+
188
+ public int getContentLength() {
189
+ return request.getContentLength();
190
+ }
191
+
192
+ public long getContentLengthLong() {
193
+ return request.getContentLengthLong();
194
+ }
195
+
196
+ public String getContentType() {
197
+ return request.getContentType();
198
+ }
199
+
200
+ public ServletInputStream getInputStream() throws IOException {
201
+ return request.getInputStream();
202
+ }
203
+
204
+ public String getParameter(String s) {
205
+ return request.getParameter(s);
206
+ }
207
+
208
+ public Enumeration<String> getParameterNames() {
209
+ return request.getParameterNames();
210
+ }
211
+
212
+ public String[] getParameterValues(String s) {
213
+ return request.getParameterValues(s);
214
+ }
215
+
216
+ public Map<String, String[]> getParameterMap() {
217
+ return request.getParameterMap();
218
+ }
219
+
220
+ public String getProtocol() {
221
+ return request.getProtocol();
222
+ }
223
+
224
+ public String getScheme() {
225
+ return request.getScheme();
226
+ }
227
+
228
+ public String getServerName() {
229
+ return request.getServerName();
230
+ }
231
+
232
+ public int getServerPort() {
233
+ return request.getServerPort();
234
+ }
235
+
236
+ public BufferedReader getReader() throws IOException {
237
+ return request.getReader();
238
+ }
239
+
240
+ public String getRemoteAddr() {
241
+ return request.getRemoteAddr();
242
+ }
243
+
244
+ public String getRemoteHost() {
245
+ return request.getRemoteHost();
246
+ }
247
+
248
+ public void setAttribute(String s, Object o) {
249
+ request.setAttribute(s, o);
250
+ }
251
+
252
+ public void removeAttribute(String s) {
253
+ request.removeAttribute(s);
254
+ }
255
+
256
+ public Locale getLocale() {
257
+ return request.getLocale();
258
+ }
259
+
260
+ public Enumeration<Locale> getLocales() {
261
+ return request.getLocales();
262
+ }
263
+
264
+ public boolean isSecure() {
265
+ return request.isSecure();
266
+ }
267
+
268
+ public RequestDispatcher getRequestDispatcher(String s) {
269
+ return request.getRequestDispatcher(s);
270
+ }
271
+
272
+ public String getRealPath(String s) {
273
+ return request.getRealPath(s);
274
+ }
275
+
276
+ public int getRemotePort() {
277
+ return request.getRemotePort();
278
+ }
279
+
280
+ public String getLocalName() {
281
+ return request.getLocalName();
282
+ }
283
+
284
+ public String getLocalAddr() {
285
+ return request.getLocalAddr();
286
+ }
287
+
288
+ public int getLocalPort() {
289
+ return request.getLocalPort();
290
+ }
291
+
292
+ public ServletContext getServletContext() {
293
+ return request.getServletContext();
294
+ }
295
+
296
+ public AsyncContext startAsync() throws IllegalStateException {
297
+ return request.startAsync();
298
+ }
299
+
300
+ public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException {
301
+ return request.startAsync(servletRequest, servletResponse);
302
+ }
303
+
304
+ public boolean isAsyncStarted() {
305
+ return request.isAsyncStarted();
306
+ }
307
+
308
+ public boolean isAsyncSupported() {
309
+ return request.isAsyncSupported();
310
+ }
311
+
312
+ public AsyncContext getAsyncContext() {
313
+ return request.getAsyncContext();
314
+ }
315
+
316
+ public DispatcherType getDispatcherType() {
317
+ return request.getDispatcherType();
318
+ }
319
+ };
320
+ */
321
+
322
+ final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
323
+ Authentication fakeAuthentication = new Authentication() {
324
+ @Override
325
+ public Collection<? extends GrantedAuthority> getAuthorities() {
326
+ Collection<GrantedAuthority> authorities = new LinkedList<GrantedAuthority>();
327
+
328
+ if ("admin".equalsIgnoreCase(fakeUsername)) {
329
+ GrantedAuthority grantedAuthority = new SimpleGrantedAuthority("ADMIN");
330
+ authorities.add(grantedAuthority);
331
+ }
332
+
333
+ return authorities;
334
+ }
335
+
336
+ // delegate the rest of the methods:
337
+ public Object getCredentials() {
338
+ return authentication.getCredentials();
339
+ }
340
+
341
+ public Object getDetails() {
342
+ return authentication.getDetails();
343
+ }
344
+
345
+ public Object getPrincipal() {
346
+ return authentication.getPrincipal();
347
+ }
348
+
349
+ public boolean isAuthenticated() {
350
+ return authentication.isAuthenticated();
351
+ }
352
+
353
+ public void setAuthenticated(boolean b) throws IllegalArgumentException {
354
+ authentication.setAuthenticated(b);
355
+ }
356
+
357
+ public String getName() {
358
+ return authentication.getName();
359
+ }
360
+ };
361
+ SecurityContextHolder.getContext().setAuthentication(fakeAuthentication);
362
+
363
+ filterChain.doFilter(request, response);
364
+ }
365
+ }
366
+ }
367
+
368
+ @Override
369
+ public void destroy() {
370
+ // do nothing
371
+ }
372
+ }
@@ -0,0 +1,47 @@
1
+ package @app.group.id@.@app.name@.security;
2
+
3
+ import org.springframework.boot.web.servlet.FilterRegistrationBean;
4
+ import org.springframework.context.annotation.Bean;
5
+ import org.springframework.http.HttpMethod;
6
+ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
7
+ import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
8
+ import org.springframework.security.web.SecurityFilterChain;
9
+
10
+ import jakarta.servlet.DispatcherType;
11
+ import jakarta.servlet.Filter;
12
+ import java.util.Collections;
13
+
14
+ @EnableWebSecurity
15
+ public class SecurityConfig {
16
+
17
+ @Bean
18
+ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
19
+ http.authorizeHttpRequests((authz) -> authz
20
+ .requestMatchers(HttpMethod.DELETE, "/api/buildings")
21
+ .hasRole("ADMIN")
22
+ .anyRequest()
23
+ .permitAll()
24
+ );
25
+ return http.build();
26
+ }
27
+
28
+ @Bean
29
+ public FilterRegistrationBean csrfPreventionFilter() {
30
+ FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>();
31
+ registration.setFilter(new CsrfPreventionFilter());
32
+ registration.setUrlPatterns(Collections.singleton("/api/*"));
33
+ registration.setDispatcherTypes(DispatcherType.REQUEST);
34
+
35
+ return registration;
36
+ }
37
+
38
+ @Bean
39
+ public FilterRegistrationBean cachingPreventionFilter() {
40
+ FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>();
41
+ registration.setFilter(new CachingPreventionFilter());
42
+ registration.setUrlPatterns(Collections.singleton("/api/*"));
43
+ registration.setDispatcherTypes(DispatcherType.REQUEST);
44
+
45
+ return registration;
46
+ }
47
+ }
@@ -0,0 +1,26 @@
1
+ package @app.group.id@.@app.name@.services;
2
+
3
+ import org.springframework.util.Assert;
4
+
5
+ import java.io.Serializable;
6
+
7
+ public class BuildingSearchCriteria implements Serializable {
8
+ private static final long serialVersionUID = 1L;
9
+ private String name;
10
+
11
+ public BuildingSearchCriteria() {
12
+ }
13
+
14
+ public BuildingSearchCriteria(String name) {
15
+ Assert.notNull(name, "The name of the building should not be null.");
16
+ this.name = name;
17
+ }
18
+
19
+ public String getName() {
20
+ return this.name;
21
+ }
22
+
23
+ public void setName(String name) {
24
+ this.name = name;
25
+ }
26
+ }
@@ -0,0 +1,10 @@
1
+ package @app.group.id@.@app.name@.services;
2
+
3
+ import @app.group.id@.@app.name@.domain.Building;
4
+ import org.springframework.data.domain.Page;
5
+ import org.springframework.data.domain.Pageable;
6
+
7
+ public interface BuildingService {
8
+ Page<Building> findAll(Pageable pageable);
9
+ Page<Building> find(BuildingSearchCriteria criteria, Pageable pageable);
10
+ }
@@ -0,0 +1,26 @@
1
+ package @app.group.id@.@app.name@.services;
2
+
3
+ import @app.group.id@.@app.name@.domain.Building;
4
+ import @app.group.id@.@app.name@.repositories.BuildingRepository;
5
+ import org.springframework.data.domain.Page;
6
+ import org.springframework.data.domain.Pageable;
7
+ import org.springframework.stereotype.Component;
8
+
9
+ @Component()
10
+ public class BuildingServiceImpl implements BuildingService {
11
+ private BuildingRepository buildingRepository;
12
+
13
+ public BuildingServiceImpl(BuildingRepository buildingRepository) {
14
+ this.buildingRepository = buildingRepository;
15
+ }
16
+
17
+ @Override
18
+ public Page<Building> findAll(Pageable pageable) {
19
+ return buildingRepository.findAll(pageable);
20
+ }
21
+
22
+ @Override
23
+ public Page<Building> find(BuildingSearchCriteria criteria, Pageable pageable) {
24
+ return buildingRepository.findByNameContainingAllIgnoringCase(criteria.getName(), pageable);
25
+ }
26
+ }