├── .gitignore ├── README.md ├── chapter02 ├── ssia-ch2-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch2-ex2 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch2-ex3 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── MainTests.java │ │ └── config │ │ └── TestConfig.java ├── ssia-ch2-ex4 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── MainTests.java │ │ └── config │ │ └── TestConfig.java ├── ssia-ch2-ex5 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ └── security │ │ │ │ └── CustomAuthenticationProvider.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── AuthenticationTests.java │ │ ├── MainTests.java │ │ └── config │ │ ├── CustomSecurityContextFactory.java │ │ └── WithCustomUser.java └── ssia-ch2-ex6 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ ├── UserManagementConfig.java │ │ │ └── WebAuthorizationConfig.java │ │ │ └── controllers │ │ │ └── HelloController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter03 ├── ssia-ch3-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ ├── model │ │ │ │ └── User.java │ │ │ │ └── services │ │ │ │ └── InMemoryUserDetailsService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch3-ex2 │ ├── .gitignore │ ├── lsp │ │ ├── conf │ │ │ └── properties.json │ │ └── log │ │ │ ├── properties_err_20200411.log │ │ │ └── properties_out_20200411.log │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ ├── application.properties │ │ │ ├── data.sql │ │ │ └── schema.sql │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch3-ex3 │ ├── .gitignore │ ├── lsp │ ├── conf │ │ └── properties.json │ └── log │ │ ├── properties_err_20200411.log │ │ └── properties_out_20200411.log │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ └── controllers │ │ │ └── HelloController.java │ └── resources │ │ ├── application.properties │ │ └── server.ldif │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter05 ├── ssia-ch5-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ └── security │ │ │ │ └── CustomAuthenticationProvider.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch5-ex2 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ └── services │ │ │ │ └── HelloService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch5-ex3 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ ├── CustomEntryPoint.java │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch5-ex4 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ ├── controllers │ │ │ └── HelloController.java │ │ │ └── handlers │ │ │ ├── CustomAuthenticationFailureHandler.java │ │ │ └── CustomAuthenticationSuccessHandler.java │ └── resources │ │ ├── application.properties │ │ └── static │ │ └── home.html │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ ├── MainTests.java │ └── config │ └── TestConfig.java ├── chapter06 └── ssia-ch6-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ ├── controllers │ │ │ └── MainPageController.java │ │ │ ├── entities │ │ │ ├── Authority.java │ │ │ ├── Product.java │ │ │ ├── User.java │ │ │ └── enums │ │ │ │ ├── Currency.java │ │ │ │ └── EncryptionAlgorithm.java │ │ │ ├── model │ │ │ └── CustomUserDetails.java │ │ │ ├── repositories │ │ │ ├── ProductRepository.java │ │ │ └── UserRepository.java │ │ │ └── services │ │ │ ├── AuthenticationProviderService.java │ │ │ ├── JpaUserDetailsService.java │ │ │ └── ProductService.java │ └── resources │ │ ├── application.properties │ │ ├── data.sql │ │ ├── schema.sql │ │ └── templates │ │ └── main.html │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter07 ├── ssia-ch7-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch7-ex2 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── TestController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch7-ex3 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch7-ex4 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ └── controllers │ │ │ └── TestController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter08 ├── ssia-ch8-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controller │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── EndpointCiaoTests.java │ │ └── EndpointHelloTests.java ├── ssia-ch8-ex2 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── TestController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch8-ex3 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── TestController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch8-ex4 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── ProductController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch8-ex5 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch8-ex6 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── VideoController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch8-ex7 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ └── controllers │ │ │ └── TestController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter09 ├── ssia-ch9-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ └── filters │ │ │ │ ├── AuthenticationLoggingFilter.java │ │ │ │ └── RequestValidationFilter.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch9-ex2 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ └── filters │ │ │ │ └── StaticKeyAuthenticationFilter.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch9-ex3 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ ├── controllers │ │ │ └── HelloController.java │ │ │ └── filters │ │ │ ├── AuthenticationLoggingFilter.java │ │ │ └── RequestValidationFilter.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter10 ├── ssia-ch10-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ └── filters │ │ │ │ └── CsrfTokenLogger.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch10-ex2 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ ├── MainController.java │ │ │ │ └── ProductController.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── templates │ │ │ └── main.html │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch10-ex3 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ ├── csrf │ │ │ │ └── CustomCsrfTokenRepository.java │ │ │ │ ├── entities │ │ │ │ └── Token.java │ │ │ │ └── repositories │ │ │ │ └── JpaTokenRepository.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── schema.sql │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch10-ex4 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ └── controllers │ │ │ └── MainController.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ └── main.html │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter11 ├── ssia-ch11-ex1-s1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── AuthController.java │ │ │ │ ├── entities │ │ │ │ ├── Otp.java │ │ │ │ └── User.java │ │ │ │ ├── repositories │ │ │ │ ├── OtpRepository.java │ │ │ │ └── UserRepository.java │ │ │ │ ├── services │ │ │ │ └── UserService.java │ │ │ │ └── utils │ │ │ │ └── GenerateCodeUtil.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── schema.sql │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch11-ex1-s2 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── authentication │ │ │ ├── OtpAuthentication.java │ │ │ ├── UsernamePasswordAuthentication.java │ │ │ ├── filters │ │ │ │ ├── InitialAuthenticationFilter.java │ │ │ │ └── JwtAuthenticationFilter.java │ │ │ ├── model │ │ │ │ └── User.java │ │ │ ├── providers │ │ │ │ ├── OtpAuthenticationProvider.java │ │ │ │ └── UsernamePasswordAuthenticationProvider.java │ │ │ └── proxy │ │ │ │ └── AuthenticationServerProxy.java │ │ │ ├── config │ │ │ ├── ProjectConfig.java │ │ │ └── SecurityConfig.java │ │ │ └── controllers │ │ │ └── TestController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter12 ├── ssia-ch12-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── MainController.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── static │ │ │ └── main.html │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── MainTests.java │ │ └── config │ │ ├── MockCustomUser.java │ │ └── SecurityContextFactory.java ├── ssia-ch12-ex2 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── MainController.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── static │ │ │ └── main.html │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── MainTests.java │ │ └── config │ │ ├── MockCustomUser.java │ │ └── SecurityContextFactory.java └── ssia-ch12-ex3 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ └── controllers │ │ │ └── MainController.java │ └── resources │ │ ├── application.properties │ │ └── static │ │ └── main.html │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ ├── MainTests.java │ └── config │ ├── MockCustomUser.java │ └── SecurityContextFactory.java ├── chapter13 ├── README.md ├── ssia-ch13-ex1 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── config │ │ │ │ ├── AuthServerConfig.java │ │ │ │ └── WebSecurityConfig.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch13-ex2 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── config │ │ │ │ ├── AuthServerConfig.java │ │ │ │ └── WebSecurityConfig.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch13-ex3 │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── config │ │ │ │ ├── AuthServerConfig.java │ │ │ │ └── WebSecurityConfig.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch13-ex4 │ ├── .gitignore │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ └── config │ │ │ ├── AuthServerConfig.java │ │ │ └── WebSecurityConfig.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter14 ├── README.md ├── ssia-ch14-ex1-as │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── config │ │ │ │ ├── AuthServerConfig.java │ │ │ │ └── WebSecurityConfig.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch14-ex1-rs-migration │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ResourceServerConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch14-ex1-rs │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ResourceServerConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch14-ex2-as │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── config │ │ │ │ ├── AuthServerConfig.java │ │ │ │ └── WebSecurityConfig.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── schema.sql │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch14-ex2-rs │ ├── .gitignore │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── Main.java │ │ ├── config │ │ └── ResourceServerConfig.java │ │ └── controllers │ │ └── HelloController.java │ └── resources │ └── application.properties ├── chapter15 ├── .gitignore ├── README.md ├── ssia-ch15-ex1-as │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── config │ │ │ │ ├── AuthServerConfig.java │ │ │ │ └── WebSecurityConfig.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch15-ex1-rs-migration │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ResourceServerConfig.java │ │ │ └── controllers │ │ │ └── HelloController.java │ │ └── resources │ │ └── application.properties ├── ssia-ch15-ex1-rs │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ResourceServerConfig.java │ │ │ └── controllers │ │ │ └── HelloController.java │ │ └── resources │ │ └── application.properties ├── ssia-ch15-ex2-as │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── config │ │ │ │ ├── AuthServerConfig.java │ │ │ │ └── WebSecurityConfig.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── ssia.jks │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch15-ex2-rs-migration │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ResourceServerConfig.java │ │ │ └── controllers │ │ │ └── HelloController.java │ │ └── resources │ │ └── application.properties ├── ssia-ch15-ex2-rs │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ResourceServerConfig.java │ │ │ └── controllers │ │ │ └── HelloController.java │ │ └── resources │ │ └── application.properties ├── ssia-ch15-ex3-as │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── config │ │ │ │ ├── AuthServerConfig.java │ │ │ │ └── WebSecurityConfig.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── ssia.jks │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch15-ex3-rs │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ResourceServerConfig.java │ │ │ └── controllers │ │ │ └── HelloController.java │ │ └── resources │ │ └── application.properties ├── ssia-ch15-ex4-as │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ └── config │ │ │ │ ├── AuthServerConfig.java │ │ │ │ ├── CustomTokenEnhancer.java │ │ │ │ └── WebSecurityConfig.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── ssia.jks │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch15-ex4-rs │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── Main.java │ │ ├── config │ │ ├── AdditionalClaimsAccessTokenConverter.java │ │ └── ResourceServerConfig.java │ │ └── controllers │ │ └── HelloController.java │ └── resources │ └── application.properties ├── chapter16 ├── README.md ├── ssia-ch16-ex1 │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ └── services │ │ │ │ └── NameService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch16-ex2 │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── HelloController.java │ │ │ │ └── services │ │ │ │ └── NameService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch16-ex3 │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── BookController.java │ │ │ │ ├── model │ │ │ │ └── Employee.java │ │ │ │ └── services │ │ │ │ └── BookService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch16-ex4 │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── DocumentController.java │ │ │ │ ├── model │ │ │ │ └── Document.java │ │ │ │ ├── repositories │ │ │ │ └── DocumentRepository.java │ │ │ │ ├── security │ │ │ │ └── DocumentsPermissionEvaluator.java │ │ │ │ └── services │ │ │ │ └── DocumentService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch16-ex5 │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── DocumentController.java │ │ │ │ ├── model │ │ │ │ └── Document.java │ │ │ │ ├── repositories │ │ │ │ └── DocumentRepository.java │ │ │ │ ├── security │ │ │ │ └── DocumentsPermissionEvaluator.java │ │ │ │ └── services │ │ │ │ └── DocumentService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch16-ex6 │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ ├── controllers │ │ │ └── HelloController.java │ │ │ └── services │ │ │ └── NameService.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter17 ├── CH17_F01_Spilca.png ├── README.md ├── ssia-ch17-ex1 │ ├── .gitignore │ ├── CH17_F02_Spilca.png │ ├── CH17_F03_Spilca.png │ ├── CH17_F04_Spilca.png │ ├── CH17_F05_Spilca.png │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── ProductController.java │ │ │ │ ├── model │ │ │ │ └── Product.java │ │ │ │ └── service │ │ │ │ └── ProductService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch17-ex2 │ ├── .gitignore │ ├── CH17_F05_Spilca.png │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── ProductController.java │ │ │ │ ├── model │ │ │ │ └── Product.java │ │ │ │ └── service │ │ │ │ └── ProductService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch17-ex3 │ ├── .gitignore │ ├── CH17_F06_Spilca.png │ ├── CH17_F07_Spilca.png │ ├── CH17_F08_Spilca.png │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── ProductController.java │ │ │ │ ├── model │ │ │ │ └── Product.java │ │ │ │ └── service │ │ │ │ └── ProductService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch17-ex4 │ ├── .gitignore │ ├── CH17_F09_Spilca.png │ ├── CH17_F10_Spilca.png │ ├── README.md │ ├── Vagrantfile │ ├── docker-compose.yml │ ├── my55.cnf │ ├── pom.xml │ ├── scripts │ │ └── provision-dev-vm.sh │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ ├── controllers │ │ │ │ └── ProductController.java │ │ │ │ ├── entities │ │ │ │ └── Product.java │ │ │ │ └── repositories │ │ │ │ └── ProductRepository.java │ │ └── resources │ │ │ ├── application.properties │ │ │ ├── data.sql │ │ │ └── schema.sql │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java └── ssia-ch17-ex5 │ ├── .gitignore │ ├── README.md │ ├── Vagrantfile │ ├── docker-compose.yml │ ├── pom.xml │ ├── scripts │ └── provision-dev-vm.sh │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ ├── controllers │ │ │ └── ProductController.java │ │ │ ├── entities │ │ │ └── Product.java │ │ │ └── repositories │ │ │ └── ProductRepository.java │ └── resources │ │ ├── application.properties │ │ ├── data.sql │ │ └── schema.sql │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java ├── chapter18 ├── CH18_F01_Spilca.png ├── CH18_F02_Spilca.png ├── CH18_F03_Spilca.png ├── CH18_F04_Spilca.png ├── CH18_F05_Spilca.png ├── CH18_F06_Spilca.png ├── CH18_F07_Spilca.png ├── CH18_F08_Spilca.png ├── CH18_F09_Spilca.png ├── CH18_F10_Spilca.png ├── CH18_F11_Spilca.png ├── CH18_F12_Spilca.png ├── CH18_F13_Spilca.png ├── CH18_F14_Spilca.png ├── CH18_F15_Spilca.png ├── CH18_F16_Spilca.png ├── CH18_F17_Spilca.png ├── CH18_F18_Spilca.png ├── CH18_F19_Spilca.png ├── CH18_F20_Spilca.png ├── CH18_F21_Spilca.png ├── CH18_F22_Spilca.png ├── CH18_F23_Spilca.png ├── CH18_F24_Spilca.png ├── README.md ├── Vagrantfile ├── docker-compose.yml ├── keycloak-postgres.yml ├── scripts │ └── provision-dev-vm.sh ├── ssia-ch18-ex1 │ ├── .gitignore │ ├── CH18_F25_Spilca.png │ ├── CH18_F26_Spilca.png │ ├── CH18_F27_Spilca.png │ ├── CH18_F28_Spilca.png │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ResourceServerConfig.java │ │ │ │ ├── controller │ │ │ │ └── WorkoutController.java │ │ │ │ ├── entities │ │ │ │ └── Workout.java │ │ │ │ ├── repositories │ │ │ │ └── WorkoutRepository.java │ │ │ │ └── service │ │ │ │ └── WorkoutService.java │ │ └── resources │ │ │ ├── application.properties │ │ │ ├── data.sql │ │ │ └── schema.sql │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MethodTests.java └── ssia-ch18-ex2 │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── Main.java │ │ ├── config │ │ └── ResourceServerConfig.java │ │ ├── controller │ │ └── WorkoutController.java │ │ ├── entities │ │ └── Workout.java │ │ ├── repositories │ │ └── WorkoutRepository.java │ │ └── service │ │ └── WorkoutService.java │ └── resources │ ├── application.properties │ ├── data.sql │ └── schema.sql ├── chapter19 ├── CH19_F01_Spilca.png ├── README.md ├── ssia-ch19-ex1 │ ├── .gitignore │ ├── CH19_F01_Spilca.png │ ├── CH19_F02_Spilca.png │ ├── CH19_F03_Spilca.png │ ├── CH19_F04_Spilca.png │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch19-ex2 │ ├── .gitignore │ ├── CH19_F05_Spilca.png │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch19-ex3 │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ └── MainTests.java ├── ssia-ch19-ex4 │ ├── .gitignore │ ├── CH19_F06_Spilca.png │ ├── CH19_F07_Spilca.png │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ └── controllers │ │ │ └── HelloController.java │ │ └── resources │ │ └── application.properties ├── ssia-ch19-ex5 │ ├── .gitignore │ ├── CH19_F08_Spilca.png │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── laurentiuspilca │ │ │ │ └── ssia │ │ │ │ ├── Main.java │ │ │ │ ├── config │ │ │ │ └── ProjectConfig.java │ │ │ │ └── controllers │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── laurentiuspilca │ │ └── ssia │ │ ├── EndpointTests.java │ │ └── MethodTests.java └── ssia-ch19-ex6 │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── laurentiuspilca │ │ │ └── ssia │ │ │ ├── Main.java │ │ │ ├── config │ │ │ └── ProjectConfig.java │ │ │ └── controllers │ │ │ └── HelloController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── laurentiuspilca │ └── ssia │ └── MainTests.java └── cover.webp /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | 33 | **/.mvn 34 | **/mvnw 35 | **/mvnw.cmd 36 | **/.vagrant/ 37 | **/*.log -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex1/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex2/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex4/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex4/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex4/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex5/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex5/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex5/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex5/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex5/src/test/java/com/laurentiuspilca/ssia/config/WithCustomUser.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.security.test.context.support.WithSecurityContext; 4 | 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @WithSecurityContext(factory = CustomSecurityContextFactory.class) 10 | public @interface WithCustomUser { 11 | 12 | String username(); 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex6/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex6/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex6/src/main/java/com/laurentiuspilca/ssia/config/WebAuthorizationConfig.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 5 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 6 | 7 | @Configuration 8 | public class WebAuthorizationConfig extends WebSecurityConfigurerAdapter { 9 | 10 | @Override 11 | protected void configure(HttpSecurity http) throws Exception { 12 | http.httpBasic(); 13 | http.authorizeRequests().anyRequest().authenticated(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex6/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter02/ssia-ch2-ex6/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex1/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex2/lsp/conf/properties.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter03/ssia-ch3-ex2/lsp/conf/properties.json -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex2/lsp/log/properties_out_20200411.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter03/ssia-ch3-ex2/lsp/log/properties_out_20200411.log -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex2/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:h2:mem:ssia 2 | spring.datasource.username=sa 3 | spring.datasource.password= 4 | spring.datasource.initialization-mode=always 5 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex2/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `spring`.`authorities` VALUES (NULL, 'john', 'write'); 2 | INSERT INTO `spring`.`users` VALUES (NULL, 'john', '12345', '1'); 3 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex2/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | create schema spring; 2 | 3 | CREATE TABLE IF NOT EXISTS `spring`.`users` ( 4 | `id` INT NOT NULL AUTO_INCREMENT, 5 | `username` VARCHAR(45) NULL, 6 | `password` VARCHAR(45) NULL, 7 | `enabled` INT NOT NULL, 8 | PRIMARY KEY (`id`)); 9 | 10 | CREATE TABLE IF NOT EXISTS `spring`.`authorities` ( 11 | `id` INT NOT NULL AUTO_INCREMENT, 12 | `username` VARCHAR(45) NULL, 13 | `authority` VARCHAR(45) NULL, 14 | PRIMARY KEY (`id`)); 15 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex3/lsp/conf/properties.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter03/ssia-ch3-ex3/lsp/conf/properties.json -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex3/lsp/log/properties_out_20200411.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter03/ssia-ch3-ex3/lsp/log/properties_out_20200411.log -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.ldap.embedded.ldif=classpath:server.ldif 2 | spring.ldap.embedded.base-dn=dc=springframework,dc=org 3 | spring.ldap.embedded.port=33389 4 | -------------------------------------------------------------------------------- /chapter03/ssia-ch3-ex3/src/main/resources/server.ldif: -------------------------------------------------------------------------------- 1 | dn: dc=springframework,dc=org 2 | objectclass: top 3 | objectclass: domain 4 | objectclass: extensibleObject 5 | dc: springframework 6 | 7 | dn: ou=groups,dc=springframework,dc=org 8 | objectclass: top 9 | objectclass: organizationalUnit 10 | ou: groups 11 | 12 | dn: uid=john,ou=groups,dc=springframework,dc=org 13 | objectclass: top 14 | objectclass: person 15 | objectclass: organizationalPerson 16 | objectclass: inetOrgPerson 17 | cn: John 18 | sn: John 19 | uid: john 20 | userPassword: 12345 -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex1/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost/spring 2 | spring.datasource.username=root 3 | spring.datasource.password= 4 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex2/src/main/java/com/laurentiuspilca/ssia/config/ProjectConfig.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.beans.factory.InitializingBean; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.scheduling.annotation.EnableAsync; 7 | import org.springframework.security.core.context.SecurityContextHolder; 8 | 9 | @Configuration 10 | @EnableAsync 11 | public class ProjectConfig { 12 | 13 | @Bean 14 | public InitializingBean initializingBean() { 15 | return () -> SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex2/src/main/java/com/laurentiuspilca/ssia/services/HelloService.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.services; 2 | 3 | import org.springframework.scheduling.annotation.Async; 4 | import org.springframework.security.core.context.SecurityContext; 5 | import org.springframework.security.core.context.SecurityContextHolder; 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class HelloService { 10 | 11 | @Async 12 | public String getName() { 13 | SecurityContext context = SecurityContextHolder.getContext(); 14 | String username = context.getAuthentication().getName(); 15 | return username; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex3/src/main/java/com/laurentiuspilca/ssia/config/ProjectConfig.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 5 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 6 | 7 | @Configuration 8 | public class ProjectConfig extends WebSecurityConfigurerAdapter { 9 | 10 | @Override 11 | protected void configure(HttpSecurity http) throws Exception { 12 | http.httpBasic(c -> { 13 | c.realmName("OTHER"); 14 | c.authenticationEntryPoint(new CustomEntryPoint()); 15 | }); 16 | http.authorizeRequests().anyRequest().authenticated(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex4/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex4/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex4/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | @Controller 7 | public class HelloController { 8 | 9 | @GetMapping("/home") 10 | public String home() { 11 | return "home.html"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter05/ssia-ch5-ex4/src/main/resources/static/home.html: -------------------------------------------------------------------------------- 1 |

Welcome

2 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/src/main/java/com/laurentiuspilca/ssia/entities/enums/Currency.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.entities.enums; 2 | 3 | public enum Currency { 4 | USD, GBP, EUR 5 | } 6 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/src/main/java/com/laurentiuspilca/ssia/entities/enums/EncryptionAlgorithm.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.entities.enums; 2 | 3 | public enum EncryptionAlgorithm { 4 | BCRYPT, SCRYPT 5 | } 6 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/src/main/java/com/laurentiuspilca/ssia/repositories/ProductRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.entities.Product; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface ProductRepository extends JpaRepository { 7 | } 8 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/src/main/java/com/laurentiuspilca/ssia/repositories/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.entities.User; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.Optional; 7 | 8 | public interface UserRepository extends JpaRepository { 9 | 10 | Optional findUserByUsername(String username); 11 | } 12 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/src/main/java/com/laurentiuspilca/ssia/services/ProductService.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.services; 2 | 3 | import com.laurentiuspilca.ssia.entities.Product; 4 | import com.laurentiuspilca.ssia.repositories.ProductRepository; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.List; 9 | 10 | @Service 11 | public class ProductService { 12 | 13 | @Autowired 14 | private ProductRepository productRepository; 15 | 16 | public List findAll() { 17 | return productRepository.findAll(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost/spring?useLegacyDatetimeCode=false&serverTimezone=UTC 2 | spring.datasource.username=root 3 | spring.datasource.password= 4 | spring.datasource.initialization-mode=always 5 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO `spring`.`user` (`id`, `username`, `password`, `algorithm`) VALUES ('1', 'john', '$2a$10$xn3LI/AjqicFYZFruSwve.681477XaVNaUQbr1gioaWPn4t1KsnmG', 'BCRYPT'); 2 | 3 | INSERT IGNORE INTO `spring`.`authority` (`id`, `name`, `user`) VALUES ('1', 'READ', '1'); 4 | INSERT IGNORE INTO `spring`.`authority` (`id`, `name`, `user`) VALUES ('2', 'WRITE', '1'); 5 | 6 | INSERT IGNORE INTO `spring`.`product` (`id`, `name`, `price`, `currency`) VALUES ('1', 'Chocolate', '10', 'USD'); 7 | -------------------------------------------------------------------------------- /chapter06/ssia-ch6-ex1/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `spring`.`user` ( 2 | `id` INT NOT NULL AUTO_INCREMENT, 3 | `username` VARCHAR(45) NOT NULL, 4 | `password` TEXT NOT NULL, 5 | `algorithm` VARCHAR(45) NOT NULL, 6 | PRIMARY KEY (`id`)); 7 | 8 | CREATE TABLE IF NOT EXISTS `spring`.`authority` ( 9 | `id` INT NOT NULL AUTO_INCREMENT, 10 | `name` VARCHAR(45) NOT NULL, 11 | `user` INT NOT NULL, 12 | PRIMARY KEY (`id`)); 13 | 14 | CREATE TABLE IF NOT EXISTS `spring`.`product` ( 15 | `id` INT NOT NULL AUTO_INCREMENT, 16 | `name` VARCHAR(45) NOT NULL, 17 | `price` VARCHAR(45) NOT NULL, 18 | `currency` VARCHAR(45) NOT NULL, 19 | PRIMARY KEY (`id`)); 20 | 21 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex1/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex2/src/main/java/com/laurentiuspilca/ssia/controllers/TestController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class TestController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex4/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex4/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex4/src/main/java/com/laurentiuspilca/ssia/controllers/TestController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class TestController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter07/ssia-ch7-ex4/src/test/java/com/laurentiuspilca/ssia/MainTests.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class MainTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex1/src/main/java/com/laurentiuspilca/ssia/controller/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | 14 | @GetMapping("/ciao") 15 | public String ciao() { 16 | return "Ciao!"; 17 | } 18 | 19 | 20 | @GetMapping("/hola") 21 | public String hola() { 22 | return "Hola!"; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex4/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex4/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex4/src/main/java/com/laurentiuspilca/ssia/config/ProjectConfig.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 5 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 6 | 7 | @Configuration 8 | public class ProjectConfig extends WebSecurityConfigurerAdapter { 9 | 10 | @Override 11 | protected void configure(HttpSecurity http) throws Exception { 12 | http.httpBasic(); 13 | 14 | http.authorizeRequests() 15 | .mvcMatchers( "/product/{code:^[0-9]*$}").permitAll() 16 | .anyRequest().denyAll(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex4/src/main/java/com/laurentiuspilca/ssia/controllers/ProductController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.PathVariable; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | public class ProductController { 9 | 10 | @GetMapping("/product/{code}") 11 | public String productCode(@PathVariable String code) { 12 | return code; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex5/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex5/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex5/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex5/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex6/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex6/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex6/src/main/java/com/laurentiuspilca/ssia/controllers/VideoController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.PathVariable; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | public class VideoController { 9 | 10 | @GetMapping("/video/{country}/{language}") 11 | public String video(@PathVariable String country, 12 | @PathVariable String language) { 13 | return "Video allowed for " + country + " " + language; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex6/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex7/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex7/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex7/src/main/java/com/laurentiuspilca/ssia/config/ProjectConfig.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 5 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 6 | 7 | @Configuration 8 | public class ProjectConfig extends WebSecurityConfigurerAdapter { 9 | 10 | @Override 11 | protected void configure(HttpSecurity http) throws Exception { 12 | http.httpBasic(); 13 | 14 | http.authorizeRequests() 15 | .mvcMatchers("/email/{email:.*(.+@.+\\.com)}") 16 | .permitAll() 17 | .anyRequest() 18 | .denyAll(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex7/src/main/java/com/laurentiuspilca/ssia/controllers/TestController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.PathVariable; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | public class TestController { 9 | 10 | @GetMapping("/email/{email}") 11 | public String video(@PathVariable String email) { 12 | return "Allowed for email " + email; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /chapter08/ssia-ch8-ex7/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex1/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration; 6 | 7 | @SpringBootApplication(exclude = {UserDetailsServiceAutoConfiguration.class }) 8 | public class Main { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(Main.class, args); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex2/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | authorization.key=SD9cICjl1e 2 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter09/ssia-ch9-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex1/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.PostMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | public class HelloController { 9 | 10 | @GetMapping("/hello") 11 | public String getHello() { 12 | return "Get Hello!"; 13 | } 14 | 15 | @PostMapping("/hello") 16 | public String postHello() { 17 | return "Post Hello!"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex2/src/main/java/com/laurentiuspilca/ssia/controllers/MainController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | @Controller 7 | public class MainController { 8 | 9 | @GetMapping("/main") 10 | public String main() { 11 | return "main.html"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex2/src/main/java/com/laurentiuspilca/ssia/controllers/ProductController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.PostMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestParam; 7 | 8 | import java.util.logging.Logger; 9 | 10 | @Controller 11 | @RequestMapping("/product") 12 | public class ProductController { 13 | 14 | private Logger logger = 15 | Logger.getLogger(ProductController.class.getName()); 16 | 17 | @PostMapping("/add") 18 | public String add(@RequestParam String name) { 19 | logger.info("Adding product " + name); 20 | return "main.html"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex2/src/main/resources/templates/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | Name: 8 | 9 | 10 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.PostMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | public class HelloController { 9 | 10 | @GetMapping("/hello") 11 | public String getHello() { 12 | return "Get Hello!"; 13 | } 14 | 15 | @PostMapping("/hello") 16 | public String postHello() { 17 | return "Post Hello!"; 18 | } 19 | 20 | @PostMapping("/ciao") 21 | public String postCiao() { 22 | return "Post Ciao"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex3/src/main/java/com/laurentiuspilca/ssia/repositories/JpaTokenRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.entities.Token; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.Optional; 7 | 8 | public interface JpaTokenRepository extends JpaRepository { 9 | 10 | Optional findTokenByIdentifier(String identifier); 11 | } 12 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost/spring?useLegacyDatetimeCode=false&serverTimezone=UTC 2 | spring.datasource.username=root 3 | spring.datasource.password= 4 | spring.datasource.initialization-mode=always 5 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex3/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `spring`.`token` ( 2 | `id` INT NOT NULL AUTO_INCREMENT, 3 | `identifier` VARCHAR(45) NULL, 4 | `token` TEXT NULL, 5 | PRIMARY KEY (`id`)); 6 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex4/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex4/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex4/src/main/java/com/laurentiuspilca/ssia/controllers/MainController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.*; 5 | 6 | import java.util.logging.Logger; 7 | 8 | @Controller 9 | public class MainController { 10 | 11 | private Logger logger = 12 | Logger.getLogger(MainController.class.getName()); 13 | 14 | @GetMapping("/") 15 | public String main() { 16 | return "main.html"; 17 | } 18 | 19 | @PostMapping("/test") 20 | @ResponseBody 21 | // @CrossOrigin("http://localhost:8080") 22 | public String test() { 23 | logger.info("Test method called"); 24 | return "HELLO"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter10/ssia-ch10-ex4/src/main/resources/templates/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/src/main/java/com/laurentiuspilca/ssia/entities/Otp.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.entities; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.Id; 5 | 6 | @Entity 7 | public class Otp { 8 | 9 | @Id 10 | private String username; 11 | private String code; 12 | 13 | public String getUsername() { 14 | return username; 15 | } 16 | 17 | public void setUsername(String username) { 18 | this.username = username; 19 | } 20 | 21 | public String getCode() { 22 | return code; 23 | } 24 | 25 | public void setCode(String code) { 26 | this.code = code; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/src/main/java/com/laurentiuspilca/ssia/entities/User.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.entities; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.Id; 5 | 6 | @Entity 7 | public class User { 8 | 9 | @Id 10 | private String username; 11 | private String password; 12 | 13 | public String getUsername() { 14 | return username; 15 | } 16 | 17 | public void setUsername(String username) { 18 | this.username = username; 19 | } 20 | 21 | public String getPassword() { 22 | return password; 23 | } 24 | 25 | public void setPassword(String password) { 26 | this.password = password; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/src/main/java/com/laurentiuspilca/ssia/repositories/OtpRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.entities.Otp; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.Optional; 7 | 8 | public interface OtpRepository extends JpaRepository { 9 | 10 | Optional findOtpByUsername(String username); 11 | } 12 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/src/main/java/com/laurentiuspilca/ssia/repositories/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.entities.User; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.Optional; 7 | 8 | public interface UserRepository extends JpaRepository { 9 | 10 | Optional findUserByUsername(String username); 11 | } 12 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/src/main/java/com/laurentiuspilca/ssia/utils/GenerateCodeUtil.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.utils; 2 | 3 | import java.security.NoSuchAlgorithmException; 4 | import java.security.SecureRandom; 5 | 6 | public final class GenerateCodeUtil { 7 | 8 | private GenerateCodeUtil() {} 9 | 10 | public static String generateCode() { 11 | String code; 12 | 13 | try { 14 | SecureRandom random = SecureRandom.getInstanceStrong(); 15 | code = String.valueOf(random.nextInt(9000) + 1000); 16 | } catch (NoSuchAlgorithmException e) { 17 | throw new RuntimeException("Problem when generating the random code."); 18 | } 19 | 20 | return code; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost/spring?useLegacyDatetimeCode=false&serverTimezone=UTC 2 | spring.datasource.username=root 3 | spring.datasource.password= 4 | spring.datasource.initialization-mode=always 5 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `spring`.`user` ( 2 | `username` VARCHAR(45) NULL, 3 | `password` TEXT NULL, 4 | PRIMARY KEY (`username`)); 5 | 6 | CREATE TABLE IF NOT EXISTS `spring`.`otp` ( 7 | `username` VARCHAR(45) NOT NULL, 8 | `code` VARCHAR(45) NULL, 9 | PRIMARY KEY (`username`)); 10 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s1/src/test/java/com/laurentiuspilca/ssia/MainTests.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class MainTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration; 6 | 7 | @SpringBootApplication(exclude = UserDetailsServiceAutoConfiguration.class) 8 | public class Main { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(Main.class, args); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s2/src/main/java/com/laurentiuspilca/ssia/authentication/OtpAuthentication.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.authentication; 2 | 3 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 4 | 5 | public class OtpAuthentication extends UsernamePasswordAuthenticationToken { 6 | 7 | public OtpAuthentication(Object principal, Object credentials) { 8 | super(principal, credentials); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s2/src/main/java/com/laurentiuspilca/ssia/authentication/UsernamePasswordAuthentication.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.authentication; 2 | 3 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 4 | import org.springframework.security.core.GrantedAuthority; 5 | 6 | import java.util.Collection; 7 | 8 | public class UsernamePasswordAuthentication extends UsernamePasswordAuthenticationToken { 9 | 10 | public UsernamePasswordAuthentication(Object principal, Object credentials, Collection authorities) { 11 | super(principal, credentials, authorities); 12 | } 13 | 14 | public UsernamePasswordAuthentication(Object principal, Object credentials) { 15 | super(principal, credentials); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s2/src/main/java/com/laurentiuspilca/ssia/authentication/model/User.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.authentication.model; 2 | 3 | public class User { 4 | 5 | private String username; 6 | private String password; 7 | private String code; 8 | 9 | public String getUsername() { 10 | return username; 11 | } 12 | 13 | public void setUsername(String username) { 14 | this.username = username; 15 | } 16 | 17 | public String getPassword() { 18 | return password; 19 | } 20 | 21 | public void setPassword(String password) { 22 | this.password = password; 23 | } 24 | 25 | public String getCode() { 26 | return code; 27 | } 28 | 29 | public void setCode(String code) { 30 | this.code = code; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s2/src/main/java/com/laurentiuspilca/ssia/config/ProjectConfig.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.client.RestTemplate; 6 | 7 | @Configuration 8 | public class ProjectConfig { 9 | 10 | @Bean 11 | public RestTemplate restTemplate() { 12 | return new RestTemplate(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s2/src/main/java/com/laurentiuspilca/ssia/controllers/TestController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class TestController { 8 | 9 | @GetMapping("/test") 10 | public String test() { 11 | return "Test"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter11/ssia-ch11-ex1-s2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | auth.server.base.url=http://localhost:8080 4 | jwt.signing.key=ymLTU8rq83j4fmJZj60wh4OrMNuntIj4fmJ 5 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex1/src/main/java/com/laurentiuspilca/ssia/controllers/MainController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | 7 | import java.util.logging.Logger; 8 | 9 | @Controller 10 | public class MainController { 11 | 12 | private Logger logger = 13 | Logger.getLogger(MainController.class.getName()); 14 | 15 | @GetMapping("/") 16 | public String main(OAuth2AuthenticationToken token) { 17 | logger.info(String.valueOf(token)); 18 | return "main.html"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex1/src/main/resources/static/main.html: -------------------------------------------------------------------------------- 1 |

Hello there!

2 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex1/src/test/java/com/laurentiuspilca/ssia/config/MockCustomUser.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.security.test.context.support.WithSecurityContext; 4 | 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @WithSecurityContext(factory = SecurityContextFactory.class) 10 | public @interface MockCustomUser { 11 | } 12 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex2/src/main/java/com/laurentiuspilca/ssia/controllers/MainController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | 7 | @Controller 8 | public class MainController { 9 | 10 | @GetMapping("/") 11 | public String main(OAuth2AuthenticationToken token) { 12 | System.out.println(token.getPrincipal()); 13 | return "main.html"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex2/src/main/resources/static/main.html: -------------------------------------------------------------------------------- 1 |

Hello there!

2 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex2/src/test/java/com/laurentiuspilca/ssia/config/MockCustomUser.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.security.test.context.support.WithSecurityContext; 4 | 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @WithSecurityContext(factory = SecurityContextFactory.class) 10 | public @interface MockCustomUser { 11 | } 12 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex3/src/main/java/com/laurentiuspilca/ssia/config/ProjectConfig.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 5 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 6 | 7 | @Configuration 8 | public class ProjectConfig extends WebSecurityConfigurerAdapter { 9 | 10 | @Override 11 | protected void configure(HttpSecurity http) throws Exception { 12 | http.oauth2Login(); 13 | 14 | http.authorizeRequests() 15 | .anyRequest().authenticated(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/MainController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | 7 | @Controller 8 | public class MainController { 9 | 10 | @GetMapping("/") 11 | public String main(OAuth2AuthenticationToken token) { 12 | System.out.println(token.getPrincipal()); 13 | return "main.html"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.security.oauth2.client.registration.github.client-id=a7553955a0c534ec5e6b 2 | spring.security.oauth2.client.registration.github.client-secret=1795b30b425ebb79e424afa51913f1c724da0dbb 3 | 4 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex3/src/main/resources/static/main.html: -------------------------------------------------------------------------------- 1 |

Hello there!

2 | -------------------------------------------------------------------------------- /chapter12/ssia-ch12-ex3/src/test/java/com/laurentiuspilca/ssia/config/MockCustomUser.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.security.test.context.support.WithSecurityContext; 4 | 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @WithSecurityContext(factory = SecurityContextFactory.class) 10 | public @interface MockCustomUser { 11 | } 12 | -------------------------------------------------------------------------------- /chapter13/README.md: -------------------------------------------------------------------------------- 1 | ## Chapter 13 : OAUTH 2: IMPLEMENTING THE AUTHORIZATION SERVER 2 | ![cover](../cover.webp) 3 | 4 | [Amazon](https://www.amazon.com/Spring-Security-Action-Laurentiu-Spilca/dp/1617297739) | [Manning](https://www.manning.com/books/spring-security-in-action) | [YouTube](https://t.co/4Or4P12LH2?amp=1) | [Books](https://laurspilca.com/books/) | [livebook](https://livebook.manning.com/book/spring-security-in-action) 5 | 6 | 7 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex4/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex4/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter13/ssia-ch13-ex4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter14/README.md: -------------------------------------------------------------------------------- 1 | ## Chapter 14 : OAUTH 2: IMPLEMENTING THE RESOURCE SERVER 2 | ![cover](../cover.webp) 3 | 4 | [Amazon](https://www.amazon.com/Spring-Security-Action-Laurentiu-Spilca/dp/1617297739) | [Manning](https://www.manning.com/books/spring-security-in-action) | [YouTube](https://t.co/4Or4P12LH2?amp=1) | [Books](https://laurspilca.com/books/) | [livebook](https://livebook.manning.com/book/spring-security-in-action) 5 | 6 | 7 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-as/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-as/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-as/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-rs-migration/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-rs-migration/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-rs-migration/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-rs-migration/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-rs/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-rs/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-rs/src/main/java/com/laurentiuspilca/ssia/config/ResourceServerConfig.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 5 | 6 | @Configuration 7 | @EnableResourceServer 8 | public class ResourceServerConfig { 9 | } 10 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-rs/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex1-rs/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | security.oauth2.resource.token-info-uri=http://localhost:8080/oauth/check_token 4 | 5 | security.oauth2.client.client-id=resourceserver 6 | security.oauth2.client.client-secret=resourceserversecret 7 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex2-as/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex2-as/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex2-as/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost/spring?useLegacyDatetimeCode=false&serverTimezone=UTC 2 | spring.datasource.username=root 3 | spring.datasource.password= 4 | spring.datasource.initialization-mode=always 5 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex2-as/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `oauth_access_token` ( 2 | `token_id` varchar(255) NOT NULL, 3 | `token` blob, 4 | `authentication_id` varchar(255) DEFAULT NULL, 5 | `user_name` varchar(255) DEFAULT NULL, 6 | `client_id` varchar(255) DEFAULT NULL, 7 | `authentication` blob, 8 | `refresh_token` varchar(255) DEFAULT NULL, 9 | PRIMARY KEY (`token_id`)); 10 | 11 | CREATE TABLE IF NOT EXISTS `oauth_refresh_token` ( 12 | `token_id` varchar(255) NOT NULL, 13 | `token` blob, 14 | `authentication` blob, 15 | PRIMARY KEY (`token_id`)); 16 | 17 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex2-rs/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex2-rs/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex2-rs/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/ssia-ch14-ex2-rs/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | spring.datasource.url=jdbc:mysql://localhost/spring?useLegacyDatetimeCode=false&serverTimezone=UTC 4 | spring.datasource.username=root 5 | spring.datasource.password= 6 | -------------------------------------------------------------------------------- /chapter15/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/README.md: -------------------------------------------------------------------------------- 1 | ## Chapter 15: OAuth 2: Using JWT and cryptographic signatures 2 | ![cover](../cover.webp) 3 | 4 | [Amazon](https://www.amazon.com/Spring-Security-Action-Laurentiu-Spilca/dp/1617297739) | [Manning](https://www.manning.com/books/spring-security-in-action) | [YouTube](https://t.co/4Or4P12LH2?amp=1) | [Books](https://laurspilca.com/books/) | [livebook](https://livebook.manning.com/book/spring-security-in-action) 5 | 6 | 7 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-as/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-as/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex1-as/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-as/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-as/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-as/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | jwt.key=ymLTU8rq83j4fmJZj60wh4OrMNuntIj4fmJ 2 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs-migration/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs-migration/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex1-rs-migration/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs-migration/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs-migration/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | import javax.crypto.KeyGenerator; 7 | import javax.crypto.SecretKey; 8 | import java.util.Base64; 9 | 10 | @SpringBootApplication 11 | public class Main { 12 | 13 | public static void main(String[] args) throws Exception { 14 | SpringApplication.run(Main.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs-migration/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs-migration/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | jwt.key=ymLTU8rq83j4fmJZj60wh4OrMNuntIj4fmJ 4 | 5 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex1-rs/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex1-rs/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | jwt.key=ymLTU8rq83j4fmJZj60wh4OrMNuntIj4fmJ 4 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-as/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-as/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex2-as/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-as/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-as/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-as/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | password=ssia123 2 | privateKey=ssia.jks 3 | alias=ssia 4 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-as/src/main/resources/ssia.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex2-as/src/main/resources/ssia.jks -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs-migration/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs-migration/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex2-rs-migration/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs-migration/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs-migration/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs-migration/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs-migration/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | publicKey=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhORXDLLrdozoNFsIyaY48NwZaSP2f94JobhEV1CYw4ImqOH7My+odLyI063aDu0HLOeV0yGUj+oZVRNM/8Y5Qhl/fIRZeCtCDVybT7yJdBz/WvzAulfI4aGWSdjGUCwS88z5Af2BJUKGv7bkwRtaF+btTq8OEC/ke0GKOkWh2nGDKeHK645OOv59qLEoa8v6Ns/SveQCfB93Zx7V+utuV6Xjp8jqUN2X5MtM9+AQ2eihhTuLGCfZm0c51QXUihXYx4GH4kLMOULOXvI3uCSdrgkF6heTFRhN6sPCex1TEWB1mbGpCDGkRZ6Q0IeSKb5fcuW+LhUqfTwCKz6cvXT6kwIDAQAB -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex2-rs/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello!"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex2-rs/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | publicKey=-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhORXDLLrdozoNFsIyaY48NwZaSP2f94JobhEV1CYw4ImqOH7My+odLyI063aDu0HLOeV0yGUj+oZVRNM/8Y5Qhl/fIRZeCtCDVybT7yJdBz/WvzAulfI4aGWSdjGUCwS88z5Af2BJUKGv7bkwRtaF+btTq8OEC/ke0GKOkWh2nGDKeHK645OOv59qLEoa8v6Ns/SveQCfB93Zx7V+utuV6Xjp8jqUN2X5MtM9+AQ2eihhTuLGCfZm0c51QXUihXYx4GH4kLMOULOXvI3uCSdrgkF6heTFRhN6sPCex1TEWB1mbGpCDGkRZ6Q0IeSKb5fcuW+LhUqfTwCKz6cvXT6kwIDAQAB-----END PUBLIC KEY----- 4 | 5 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-as/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-as/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex3-as/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-as/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-as/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-as/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | password=ssia123 2 | privateKey=ssia.jks 3 | alias=ssia 4 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-as/src/main/resources/ssia.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex3-as/src/main/resources/ssia.jks -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-rs/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-rs/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex3-rs/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-rs/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-rs/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-rs/src/main/java/com/laurentiuspilca/ssia/config/ResourceServerConfig.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 5 | import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; 6 | 7 | @Configuration 8 | @EnableResourceServer 9 | public class ResourceServerConfig extends ResourceServerConfigurerAdapter { 10 | } 11 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-rs/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @GetMapping("/hello") 10 | public String hello() { 11 | return "Hello! "; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex3-rs/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | security.oauth2.resource.jwt.key-uri=http://localhost:8080/oauth/token_key 4 | 5 | security.oauth2.client.client-id=resourceserver 6 | security.oauth2.client.client-secret=resourceserversecret 7 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-as/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-as/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex4-as/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-as/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-as/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-as/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | password=ssia123 2 | privateKey=ssia.jks 3 | alias=ssia 4 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-as/src/main/resources/ssia.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex4-as/src/main/resources/ssia.jks -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-rs/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-rs/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter15/ssia-ch15-ex4-rs/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-rs/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-rs/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-rs/src/main/java/com/laurentiuspilca/ssia/config/AdditionalClaimsAccessTokenConverter.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.config; 2 | 3 | import org.springframework.security.oauth2.provider.OAuth2Authentication; 4 | import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; 5 | 6 | import java.util.Map; 7 | 8 | public class AdditionalClaimsAccessTokenConverter 9 | extends JwtAccessTokenConverter { 10 | 11 | @Override 12 | public OAuth2Authentication extractAuthentication(Map map) { 13 | var authentication = super.extractAuthentication(map); 14 | authentication.setDetails(map); 15 | return authentication; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-rs/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.security.oauth2.provider.OAuth2Authentication; 4 | import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | public class HelloController { 10 | 11 | @GetMapping("/hello") 12 | public String hello(OAuth2Authentication authentication) { 13 | OAuth2AuthenticationDetails details = 14 | (OAuth2AuthenticationDetails) authentication.getDetails(); 15 | 16 | return "Hello! " + details.getDecodedDetails(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter15/ssia-ch15-ex4-rs/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | publicKey=-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhORXDLLrdozoNFsIyaY48NwZaSP2f94JobhEV1CYw4ImqOH7My+odLyI063aDu0HLOeV0yGUj+oZVRNM/8Y5Qhl/fIRZeCtCDVybT7yJdBz/WvzAulfI4aGWSdjGUCwS88z5Af2BJUKGv7bkwRtaF+btTq8OEC/ke0GKOkWh2nGDKeHK645OOv59qLEoa8v6Ns/SveQCfB93Zx7V+utuV6Xjp8jqUN2X5MtM9+AQ2eihhTuLGCfZm0c51QXUihXYx4GH4kLMOULOXvI3uCSdrgkF6heTFRhN6sPCex1TEWB1mbGpCDGkRZ6Q0IeSKb5fcuW+LhUqfTwCKz6cvXT6kwIDAQAB-----END PUBLIC KEY----- 4 | 5 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex1/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import com.laurentiuspilca.ssia.services.NameService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | public class HelloController { 10 | 11 | @Autowired 12 | private NameService nameService; 13 | 14 | @GetMapping("/hello") 15 | public String hello() { 16 | return "Hello, " + nameService.getName(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex1/src/main/java/com/laurentiuspilca/ssia/services/NameService.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.services; 2 | 3 | import org.springframework.security.access.prepost.PreAuthorize; 4 | import org.springframework.stereotype.Service; 5 | 6 | @Service 7 | public class NameService { 8 | 9 | @PreAuthorize("hasAuthority('write')") 10 | public String getName() { 11 | return "Fantastico"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex2/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import com.laurentiuspilca.ssia.services.NameService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | import java.util.List; 10 | 11 | @RestController 12 | public class HelloController { 13 | 14 | @Autowired 15 | private NameService nameService; 16 | 17 | @GetMapping("/secret/names/{name}") 18 | public List names(@PathVariable String name) { 19 | return nameService.getSecretNames(name); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex2/src/main/java/com/laurentiuspilca/ssia/services/NameService.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.services; 2 | 3 | import org.springframework.security.access.prepost.PreAuthorize; 4 | import org.springframework.stereotype.Service; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | @Service 10 | public class NameService { 11 | 12 | private Map> secretNames = Map.of( 13 | "natalie", List.of("Energico", "Perfecto"), 14 | "emma", List.of("Fantastico")); 15 | 16 | @PreAuthorize("#name == authentication.principal.username") 17 | public List getSecretNames(String name) { 18 | return secretNames.get(name); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/BookController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import com.laurentiuspilca.ssia.model.Employee; 4 | import com.laurentiuspilca.ssia.services.BookService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @RestController 11 | public class BookController { 12 | 13 | @Autowired 14 | private BookService bookService; 15 | 16 | @GetMapping("/book/details/{name}") 17 | public Employee getDetails(@PathVariable String name) { 18 | return bookService.getBookDetails(name); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex4/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex4/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex4/src/main/java/com/laurentiuspilca/ssia/controllers/DocumentController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import com.laurentiuspilca.ssia.model.Document; 4 | import com.laurentiuspilca.ssia.services.DocumentService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | 11 | @RestController 12 | public class DocumentController { 13 | 14 | @Autowired 15 | private DocumentService documentService; 16 | 17 | @GetMapping("/documents/{code}") 18 | public Document getDetails(@PathVariable String code) { 19 | return documentService.getDocument(code); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex4/src/main/java/com/laurentiuspilca/ssia/repositories/DocumentRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.model.Document; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.Map; 7 | 8 | @Repository 9 | public class DocumentRepository { 10 | 11 | private Map documents = 12 | Map.of("abc123", new Document("natalie"), 13 | "qwe123", new Document("natalie"), 14 | "asd555", new Document("emma")); 15 | 16 | 17 | public Document findDocument(String code) { 18 | return documents.get(code); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex4/src/main/java/com/laurentiuspilca/ssia/services/DocumentService.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.services; 2 | 3 | import com.laurentiuspilca.ssia.model.Document; 4 | import com.laurentiuspilca.ssia.repositories.DocumentRepository; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.access.prepost.PostAuthorize; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class DocumentService { 11 | 12 | @Autowired 13 | private DocumentRepository documentRepository; 14 | 15 | @PostAuthorize("hasPermission(returnObject, 'ROLE_admin')") 16 | public Document getDocument(String code) { 17 | return documentRepository.findDocument(code); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex5/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex5/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex5/src/main/java/com/laurentiuspilca/ssia/controllers/DocumentController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import com.laurentiuspilca.ssia.model.Document; 4 | import com.laurentiuspilca.ssia.services.DocumentService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @RestController 11 | public class DocumentController { 12 | 13 | @Autowired 14 | private DocumentService documentService; 15 | 16 | @GetMapping("/documents/{code}") 17 | public Document getDetails(@PathVariable String code) { 18 | return documentService.getDocument(code); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex5/src/main/java/com/laurentiuspilca/ssia/repositories/DocumentRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.model.Document; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.Map; 7 | 8 | @Repository 9 | public class DocumentRepository { 10 | 11 | private Map documents = 12 | Map.of("abc123", new Document("natalie"), 13 | "qwe123", new Document("natalie"), 14 | "asd555", new Document("emma")); 15 | 16 | 17 | public Document findDocument(String code) { 18 | return documents.get(code); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex5/src/main/java/com/laurentiuspilca/ssia/services/DocumentService.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.services; 2 | 3 | import com.laurentiuspilca.ssia.model.Document; 4 | import com.laurentiuspilca.ssia.repositories.DocumentRepository; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.access.prepost.PreAuthorize; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class DocumentService { 11 | 12 | @Autowired 13 | private DocumentRepository documentRepository; 14 | 15 | @PreAuthorize("hasPermission(#code, 'document', 'ROLE_admin')") 16 | public Document getDocument(String code) { 17 | return documentRepository.findDocument(code); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex5/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex6/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex6/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex6/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import com.laurentiuspilca.ssia.services.NameService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | public class HelloController { 10 | 11 | @Autowired 12 | private NameService nameService; 13 | 14 | @GetMapping("/hello") 15 | public String hello() { 16 | return "Hello, " + nameService.getName(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex6/src/main/java/com/laurentiuspilca/ssia/services/NameService.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.services; 2 | 3 | import org.springframework.security.access.annotation.Secured; 4 | import org.springframework.stereotype.Service; 5 | 6 | @Service 7 | public class NameService { 8 | 9 | // @RolesAllowed("ROLE_ADMIN") 10 | @Secured("ROLE_ADMIN") 11 | public String getName() { 12 | return "Fantastico"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter16/ssia-ch16-ex6/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter17/CH17_F01_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/CH17_F01_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex1/CH17_F02_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex1/CH17_F02_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex1/CH17_F03_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex1/CH17_F03_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex1/CH17_F04_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex1/CH17_F04_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex1/CH17_F05_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex1/CH17_F05_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex1/src/main/java/com/laurentiuspilca/ssia/service/ProductService.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.service; 2 | 3 | import com.laurentiuspilca.ssia.model.Product; 4 | import org.springframework.security.access.prepost.PreFilter; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.List; 8 | 9 | @Service 10 | public class ProductService { 11 | 12 | @PreFilter("filterObject.owner == authentication.name") 13 | public List sellProducts(List products) { 14 | // sell products and return the sold products list 15 | return products; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex2/CH17_F05_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex2/CH17_F05_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex2/src/main/java/com/laurentiuspilca/ssia/service/ProductService.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.service; 2 | 3 | import com.laurentiuspilca.ssia.model.Product; 4 | import org.springframework.security.access.prepost.PreFilter; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.List; 8 | 9 | @Service 10 | public class ProductService { 11 | 12 | @PreFilter("filterObject.owner == authentication.name") 13 | public List sellProducts(List products) { 14 | // order products and return the ordered products list 15 | return products; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex3/CH17_F06_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex3/CH17_F06_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex3/CH17_F07_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex3/CH17_F07_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex3/CH17_F08_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex3/CH17_F08_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/ProductController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import com.laurentiuspilca.ssia.model.Product; 4 | import com.laurentiuspilca.ssia.service.ProductService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | import java.util.List; 10 | 11 | @RestController 12 | public class ProductController { 13 | 14 | @Autowired 15 | private ProductService productService; 16 | 17 | @GetMapping("/find") 18 | public List findProducts() { 19 | return productService.findProducts(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex3/src/main/java/com/laurentiuspilca/ssia/model/Product.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.model; 2 | 3 | public class Product { 4 | 5 | private String name; 6 | private String owner; 7 | 8 | public Product(String name, String owner) { 9 | this.name = name; 10 | this.owner = owner; 11 | } 12 | 13 | public String getName() { 14 | return name; 15 | } 16 | 17 | public void setName(String name) { 18 | this.name = name; 19 | } 20 | 21 | public String getOwner() { 22 | return owner; 23 | } 24 | 25 | public void setOwner(String owner) { 26 | this.owner = owner; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/CH17_F09_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex4/CH17_F09_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/CH17_F10_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter17/ssia-ch17-ex4/CH17_F10_Spilca.png -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | userpath = "#{ENV['HOMEPATH']}" 4 | 5 | Vagrant.configure("2") do |config| 6 | # if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil 7 | # config.vm.synced_folder "~/.m2", "/home/vagrant/.m2", mount_options: ["dmode=700,fmode=600"] 8 | # else 9 | # config.vm.synced_folder "#{userpath}/.m2", "/home/vagrant/.m2" 10 | # end 11 | config.vm.define "cd" do |d| 12 | d.vm.box = "ubuntu/focal64" 13 | d.vm.network "private_network", ip: "10.100.98.200" 14 | d.vm.provider "virtualbox" do |v| 15 | v.memory = 3096 16 | v.cpus = 2 17 | end 18 | d.vm.provision "shell", path: "./scripts/provision-dev-vm.sh" 19 | end 20 | end -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | services: 3 | mysqldb: 4 | container_name: mysql 5 | image: mysql:8.0.25 6 | command: --default-authentication-plugin=mysql_native_password 7 | volumes: 8 | - /var/run/docker.sock:/var/run/docker.sock 9 | # - $PWD/data/mysql:/var/lib/mysql 10 | - $PWD/my55.cnf:/etc/my.cnf 11 | environment: 12 | MYSQL_ALLOW_EMPTY_PASSWORD: "yes" 13 | MYSQL_ROOT_PASSWORD: "" 14 | MYSQL_DATABASE: "spring" 15 | MYSQL_USER: "ecuser" 16 | MYSQL_PASSWORD: "qazwsx" 17 | EXTRA_OPTS: "--lower_case_table_names=1" 18 | TZ: "Asia/Taipei" 19 | network_mode: "host" 20 | # ports: 21 | # - "3306:3306" 22 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/src/main/java/com/laurentiuspilca/ssia/repositories/ProductRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.entities.Product; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.security.access.prepost.PostFilter; 6 | 7 | import java.util.List; 8 | 9 | public interface ProductRepository 10 | extends JpaRepository { 11 | 12 | @PostFilter("filterObject.owner == authentication.principal.username") 13 | List findProductByNameContains(String text); 14 | } 15 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost/spring?useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&useSSL=false 2 | spring.datasource.username=root 3 | spring.datasource.password= 4 | spring.datasource.initialization-mode=always -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO `spring`.`product` (`id`, `name`, `owner`) VALUES ('1', 'beer', 'nikolai'); 2 | INSERT IGNORE INTO `spring`.`product` (`id`, `name`, `owner`) VALUES ('2', 'candy', 'nikolai'); 3 | INSERT IGNORE INTO `spring`.`product` (`id`, `name`, `owner`) VALUES ('3', 'chocolate', 'julien'); 4 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex4/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `spring`.`product` ( 2 | `id` INT NOT NULL AUTO_INCREMENT, 3 | `name` VARCHAR(45) NULL, 4 | `owner` VARCHAR(45) NULL, 5 | PRIMARY KEY (`id`)); -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex5/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex5/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | userpath = "#{ENV['HOMEPATH']}" 4 | 5 | Vagrant.configure("2") do |config| 6 | # if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil 7 | # config.vm.synced_folder "~/.m2", "/home/vagrant/.m2", mount_options: ["dmode=700,fmode=600"] 8 | # else 9 | # config.vm.synced_folder "#{userpath}/.m2", "/home/vagrant/.m2" 10 | # end 11 | config.vm.define "cd" do |d| 12 | d.vm.box = "ubuntu/focal64" 13 | d.vm.network "private_network", ip: "10.100.98.200" 14 | d.vm.provider "virtualbox" do |v| 15 | v.memory = 3096 16 | v.cpus = 2 17 | end 18 | d.vm.provision "shell", path: "./scripts/provision-dev-vm.sh" 19 | end 20 | end -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex5/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | services: 3 | mysqldb: 4 | container_name: mysql 5 | image: mysql:8.0.25 6 | command: --default-authentication-plugin=mysql_native_password 7 | volumes: 8 | - /var/run/docker.sock:/var/run/docker.sock 9 | # - $PWD/data/mysql:/var/lib/mysql 10 | - $PWD/my55.cnf:/etc/my.cnf 11 | environment: 12 | MYSQL_ALLOW_EMPTY_PASSWORD: "yes" 13 | MYSQL_ROOT_PASSWORD: "" 14 | MYSQL_DATABASE: "spring" 15 | MYSQL_USER: "ecuser" 16 | MYSQL_PASSWORD: "qazwsx" 17 | EXTRA_OPTS: "--lower_case_table_names=1" 18 | TZ: "Asia/Taipei" 19 | network_mode: "host" 20 | # ports: 21 | # - "3306:3306" 22 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex5/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex5/src/main/java/com/laurentiuspilca/ssia/repositories/ProductRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.entities.Product; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.Query; 6 | 7 | import java.util.List; 8 | 9 | public interface ProductRepository 10 | extends JpaRepository { 11 | 12 | @Query("SELECT p FROM Product p WHERE p.name LIKE %:text% AND p.owner=?#{authentication.principal.username}") 13 | List findProductByNameContains(String text); 14 | } 15 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex5/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost/spring?useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&useSSL=false 2 | spring.datasource.username=root 3 | spring.datasource.password= 4 | spring.datasource.initialization-mode=always -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex5/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO `spring`.`product` (`id`, `name`, `owner`) VALUES ('1', 'beer', 'nikolai'); 2 | INSERT IGNORE INTO `spring`.`product` (`id`, `name`, `owner`) VALUES ('2', 'candy', 'nikolai'); 3 | INSERT IGNORE INTO `spring`.`product` (`id`, `name`, `owner`) VALUES ('3', 'chocolate', 'julien'); 4 | -------------------------------------------------------------------------------- /chapter17/ssia-ch17-ex5/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `spring`.`product` ( 2 | `id` INT NOT NULL AUTO_INCREMENT, 3 | `name` VARCHAR(45) NULL, 4 | `owner` VARCHAR(45) NULL, 5 | PRIMARY KEY (`id`)); -------------------------------------------------------------------------------- /chapter18/CH18_F01_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F01_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F02_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F02_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F03_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F03_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F04_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F04_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F05_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F05_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F06_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F06_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F07_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F07_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F08_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F08_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F09_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F09_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F10_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F10_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F11_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F11_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F12_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F12_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F13_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F13_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F14_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F14_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F15_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F15_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F16_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F16_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F17_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F17_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F18_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F18_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F19_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F19_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F20_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F20_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F21_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F21_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F22_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F22_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F23_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F23_Spilca.png -------------------------------------------------------------------------------- /chapter18/CH18_F24_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/CH18_F24_Spilca.png -------------------------------------------------------------------------------- /chapter18/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | config.vm.define "cd" do |d| 6 | d.vm.box = "ubuntu/xenial64" 7 | d.vm.network "private_network", ip: "10.100.98.200" 8 | #d.vm.network "forwarded_port", guest: 9000, host: 9000 9 | #d.vm.network "forwarded_port", guest: 9092, host: 9092 10 | d.vm.provider "virtualbox" do |v| 11 | v.memory = 3096 12 | v.cpus = 2 13 | end 14 | d.vm.provision "shell", path: "./scripts/provision-dev-vm.sh" 15 | end 16 | end -------------------------------------------------------------------------------- /chapter18/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | services: 3 | mysqldb: 4 | container_name: mysql 5 | image: mysql:8.0.25 6 | command: --default-authentication-plugin=mysql_native_password 7 | volumes: 8 | - /var/run/docker.sock:/var/run/docker.sock 9 | # - $PWD/data/mysql:/var/lib/mysql 10 | - $PWD/my55.cnf:/etc/my.cnf 11 | environment: 12 | MYSQL_ALLOW_EMPTY_PASSWORD: "yes" 13 | MYSQL_ROOT_PASSWORD: "" 14 | MYSQL_DATABASE: "spring" 15 | MYSQL_USER: "ecuser" 16 | MYSQL_PASSWORD: "qazwsx" 17 | EXTRA_OPTS: "--lower_case_table_names=1" 18 | TZ: "Asia/Taipei" 19 | network_mode: "host" 20 | # ports: 21 | # - "3306:3306" 22 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/CH18_F25_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/ssia-ch18-ex1/CH18_F25_Spilca.png -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/CH18_F26_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/ssia-ch18-ex1/CH18_F26_Spilca.png -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/CH18_F27_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/ssia-ch18-ex1/CH18_F27_Spilca.png -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/CH18_F28_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter18/ssia-ch18-ex1/CH18_F28_Spilca.png -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/src/main/java/com/laurentiuspilca/ssia/repositories/WorkoutRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.entities.Workout; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.Query; 6 | 7 | import java.util.List; 8 | 9 | public interface WorkoutRepository extends JpaRepository { 10 | 11 | @Query("SELECT w FROM Workout w WHERE w.user = ?#{authentication.name}") 12 | List findAllByUser(); 13 | } 14 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | spring.datasource.url=jdbc:mysql://localhost/spring?useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&useSSL=false 4 | spring.datasource.username=root 5 | spring.datasource.password= 6 | spring.datasource.initialization-mode=always 7 | 8 | claim.aud=fitnessapp 9 | jwkSetUri=http://localhost:8080/auth/realms/master/protocol/openid-connect/certs 10 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO `spring`.`workout` (`id`, `user`, `start`, `end`, `difficulty`) VALUES (1, 'bill', '2020-06-10 15:05:05', '2020-06-10 16:10:07', '3'); 2 | INSERT IGNORE INTO `spring`.`workout` (`id`, `user`, `start`, `end`, `difficulty`) VALUES (2, 'rachel', '2020-06-10 15:05:10', '2020-06-10 16:10:20', '3'); 3 | INSERT IGNORE INTO `spring`.`workout` (`id`, `user`, `start`, `end`, `difficulty`) VALUES (3, 'bill', '2020-06-12 12:00:10', '2020-06-12 13:01:10', '4'); 4 | INSERT IGNORE INTO `spring`.`workout` (`id`, `user`, `start`, `end`, `difficulty`) VALUES (4, 'rachel', '2020-06-12 12:00:05', '2020-06-12 12:00:11', '4'); 5 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex1/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `spring`.`workout` ( 2 | `id` INT NOT NULL AUTO_INCREMENT, 3 | `user` VARCHAR(45) NULL, 4 | `start` DATETIME NULL, 5 | `end` DATETIME NULL, 6 | `difficulty` INT NULL, 7 | PRIMARY KEY (`id`)); 8 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex2/src/main/java/com/laurentiuspilca/ssia/repositories/WorkoutRepository.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.repositories; 2 | 3 | import com.laurentiuspilca.ssia.entities.Workout; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.Query; 6 | 7 | import java.util.List; 8 | 9 | public interface WorkoutRepository extends JpaRepository { 10 | 11 | @Query("SELECT w FROM Workout w WHERE w.user = ?#{authentication.name}") 12 | List findAllByUser(); 13 | } 14 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | spring.datasource.url=jdbc:mysql://localhost/spring?useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&useSSL=false 4 | spring.datasource.username=root 5 | spring.datasource.password= 6 | spring.datasource.initialization-mode=always 7 | 8 | 9 | 10 | claim.aud=fitnessapp 11 | jwkSetUri=http://localhost:8080/auth/realms/master/protocol/openid-connect/certs 12 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex2/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT IGNORE INTO `spring`.`workout` (`id`, `user`, `start`, `end`, `difficulty`) VALUES (1, 'bill', '2020-06-10 15:05:05', '2020-06-10 16:10:07', '3'); 2 | INSERT IGNORE INTO `spring`.`workout` (`id`, `user`, `start`, `end`, `difficulty`) VALUES (2, 'rachel', '2020-06-10 15:05:10', '2020-06-10 16:10:20', '3'); 3 | INSERT IGNORE INTO `spring`.`workout` (`id`, `user`, `start`, `end`, `difficulty`) VALUES (3, 'bill', '2020-06-12 12:00:10', '2020-06-12 13:01:10', '4'); 4 | INSERT IGNORE INTO `spring`.`workout` (`id`, `user`, `start`, `end`, `difficulty`) VALUES (4, 'rachel', '2020-06-12 12:00:05', '2020-06-12 12:00:11', '4'); 5 | -------------------------------------------------------------------------------- /chapter18/ssia-ch18-ex2/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `spring`.`workout` ( 2 | `id` INT NOT NULL AUTO_INCREMENT, 3 | `user` VARCHAR(45) NULL, 4 | `start` DATETIME NULL, 5 | `end` DATETIME NULL, 6 | `difficulty` INT NULL, 7 | PRIMARY KEY (`id`)); 8 | -------------------------------------------------------------------------------- /chapter19/CH19_F01_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter19/CH19_F01_Spilca.png -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex1/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex1/CH19_F01_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter19/ssia-ch19-ex1/CH19_F01_Spilca.png -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex1/CH19_F02_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter19/ssia-ch19-ex1/CH19_F02_Spilca.png -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex1/CH19_F03_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter19/ssia-ch19-ex1/CH19_F03_Spilca.png -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex1/CH19_F04_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter19/ssia-ch19-ex1/CH19_F04_Spilca.png -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex1/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex1/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import reactor.core.publisher.Mono; 7 | 8 | @RestController 9 | public class HelloController { 10 | 11 | @GetMapping("/hello") 12 | public Mono hello(Mono auth) { 13 | Mono message = auth.map(a -> "Hello " + a.getName()); 14 | return message; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex2/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex2/CH19_F05_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter19/ssia-ch19-ex2/CH19_F05_Spilca.png -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex2/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex2/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.security.core.context.ReactiveSecurityContextHolder; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import reactor.core.publisher.Mono; 7 | 8 | @RestController 9 | public class HelloController { 10 | 11 | @GetMapping("/hello") 12 | public Mono hello() { 13 | Mono message = 14 | ReactiveSecurityContextHolder.getContext() 15 | .map(context -> context.getAuthentication()) 16 | .map(auth -> "Hello " + auth.getName()); 17 | return message; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex3/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex3/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex3/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import reactor.core.publisher.Mono; 7 | 8 | @RestController 9 | public class HelloController { 10 | 11 | @GetMapping("/hello") 12 | public Mono hello(Mono auth) { 13 | Mono message = auth.map(a -> "Hello " + a.getName()); 14 | return message; 15 | } 16 | 17 | @GetMapping("/ciao") 18 | public Mono ciao() { 19 | return Mono.just("Ciao!"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex4/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex4/CH19_F06_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter19/ssia-ch19-ex4/CH19_F06_Spilca.png -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex4/CH19_F07_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter19/ssia-ch19-ex4/CH19_F07_Spilca.png -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex4/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex4/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import reactor.core.publisher.Mono; 7 | 8 | @RestController 9 | public class HelloController { 10 | 11 | @GetMapping("/hello") 12 | public Mono hello(Mono auth) { 13 | Mono message = auth.map(a -> "Hello " + a.getName()); 14 | return message; 15 | } 16 | 17 | @GetMapping("/ciao") 18 | public Mono ciao() { 19 | return Mono.just("Ciao!"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex5/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex5/CH19_F08_Spilca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/chapter19/ssia-ch19-ex5/CH19_F08_Spilca.png -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex5/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex5/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.security.access.prepost.PreAuthorize; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import reactor.core.publisher.Mono; 7 | 8 | @RestController 9 | public class HelloController { 10 | 11 | @GetMapping("/hello") 12 | @PreAuthorize("hasRole('ADMIN')") 13 | public Mono hello() { 14 | return Mono.just("Hello!"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex5/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex6/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex6/src/main/java/com/laurentiuspilca/ssia/Main.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Main.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex6/src/main/java/com/laurentiuspilca/ssia/controllers/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.laurentiuspilca.ssia.controllers; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import reactor.core.publisher.Mono; 6 | 7 | @RestController 8 | public class HelloController { 9 | 10 | @GetMapping("/hello") 11 | public Mono hello() { 12 | return Mono.just("Hello!"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /chapter19/ssia-ch19-ex6/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9090 2 | 3 | jwk.endpoint=http://localhost:8080/auth/realms/master/protocol/openid-connect/certs 4 | -------------------------------------------------------------------------------- /cover.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert0714/manning-spring_security_in_action_2020/8c9d4366af1a05fa9c50d6fcd529f72877e5f732/cover.webp --------------------------------------------------------------------------------