This is a demo project showcasing how Basic Authentication works in Spring Security, with role-based and permission-based access control. The application leverages Spring Boot’s security mechanisms to manage user access based on roles and fine-grained permissions.
- Basic Auth Login – Users authenticate via the Authorization header using Basic Auth.
- Roles and Permissions – A system with roles (ROLE_ADMIN, ROLE_USER) and additional permissions (PERMISSION_READ, PERMISSION_WRITE).
- Spring Security Configuration – Uses modern security configuration
- Restricted API Access – Access to resources is controlled based on roles and permissions.
- User Database – Users and roles are stored in a database using JPA and Hibernate.
- Password Hashing – Uses BCryptPasswordEncoder for secure password storage.
| Username | Password | Role | Permissions |
|---|---|---|---|
| admin | admin | ROLE_ADMIN | READ_PERM, WRITE_PERM, CREATE_PERM, DELETE_PERM |
| user | user | ROLE_USER | READ_PERM, WRITE_PERM, CREATE_PERM |