Chapter 4

Answer 1: Spring Security provides security services for Java-based web applications. 

Answer 2: You have to add Spring Security started package dependency to your pom.xml file. You can configure Spring Security by creating a security configuration class.

Answer 3: JWT (JSON Web Token) is a compact way to implement authentication in modern web applications. The size of the token is small and therefore it can be sent in the URL, in the POST parameter or inside the header.

Answer 4: You can use the Java JWT library that is the JSON web Token library for Java. The authentication service class adds and reads the token. The filter classes handles the login and authentication process.

Answer 5: You have to add Spring Boot test starter package to your pom.xml file. Spring Boot test starter package provides a lot of nice testing utilities, for example JUnit, AssertJ, and Mockito. When using the JUnit, the basic test classes are annotated with the @SpringBootTest annotation and the test methods should start with @Test annotation.

Answer 6The test cases can be easily executed with the Eclipse IDE by running the test classes (Run | JUnit test). The test results can be seen in the JUnit tab.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.232.11