jaygajera17 / E-commerce-project-springBoot

This project serves as an easy-to-understand setup for beginners , providing a base foundation in Spring Boot , MVC & hibernate.
https://jaygajera17.github.io/E-commerce-project-springBoot/
587 stars 600 forks source link

Implement Spring Security for Admin and User Roles, Refactor Controllers, and Add Custom 403 Page #80

Closed Guhapriya01 closed 2 months ago

Guhapriya01 commented 2 months ago

This pull request includes the following changes:

  1. Spring Security Configuration:

    • Added a SecurityConfiguration class to manage security for admin and user roles.
    • Configured two separate security filter chains:
      • Admin routes (/admin/**) are restricted to users with the ADMIN role.
      • User routes (/**) are restricted to users with the USER role.
    • Integrated existing login and logout pages with Spring Security for authentication and authorization.
  2. Controller Updates:

    • Refactored Admin and User controllers to align with the new security configurations.
    • Replaced previous controller-specific logic for admin access with Spring Security configurations.
  3. View and Navigation Updates:

    • Modified JSP pages for admin and user interfaces to match the updated controllers and security settings.
    • Updated navigation links to reflect changes in security and routing.
  4. Error Handling:

    • Added a custom 403 error page for access denial scenarios.
    • Implemented an error controller to serve the 403 error page.

Related Issues:

Please review and let me know if any further changes are needed.