Note
- Java
- Spring Framework
- Spring Boot
- Spring Data JPA
- lombok
- Jwt
- Spring Security
- MySQL
- Postman
- Swagger UI
- Admin Modules
- User Modules
- Open Url Modules
Swagger UI Documentation - http://localhost:8080/swagger-ui/
Before running the API server, you should update the database config inside the application.properties file. Update the port number, username and password as per your local database config.
spring.datasource.url=jdbc:mysql://localhost:3306/mydb; spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.username=root spring.datasource.password=root https://localhost:8080/ http://localhost:8080/swagger-ui/ user this data for checking purpose.
- Create Rest Api will return to user authentication with database custom user details. Project Documentation
- Entity - AppUser (class)
- Payload - AppUserDto, ApiResponceDto, ErrorDto, LoginDto, TokenDto (class)
- Repository - AppUserRepository (interface)
- Service - AppUserService (interface), AppUserServiceImpl, JwtService (class)
- Controller - AuthUserController, UserAccessController, OpenUrlController (Class)
- Global Exception - GlobalException, JwtException (class)
- Config - SecurityConfig, JwtFilter, SwaggerConfig (Class)
- Secure the Rest API by adding security dependecy.
- Use the properties file to create custom username and password for authentication
- Create the SpringSecurityConfig class to define the bean like PasswordEncoder, UserDetailsService and AuthenticationManager
- Create JwtAuthenticationEntryPoint Class Which implements AuthenticationEntryPoint interface and override method commence
- Create JwtHelper Class which is used to perform action like validateToken and generateToken etc
- Create JWTAuthenticationFilter class which is used for the filter purpose
- Create SecurityFilterConfig class to define request processing logic
- Create JwtRequest and JwtResponse class
- Create JwtAuthenticationController to return the JwtResponse if everything works fine