Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/efficientgoose/video-rental-springboot
https://github.com/efficientgoose/video-rental-springboot
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/efficientgoose/video-rental-springboot
- Owner: efficientgoose
- Created: 2024-10-22T17:49:32.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-10-22T17:52:12.000Z (4 months ago)
- Last Synced: 2024-10-29T19:57:59.324Z (3 months ago)
- Language: Java
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring Security Demo
This project demonstrates a simple authentication and authorization system using Spring Security in a Spring Boot application.
## Running the Project
To run the project, you can use the Gradle Wrapper provided in the repository. Follow these steps:
1. Open a terminal.
2. Navigate to the root directory of the project where the `build.gradle` file is located.
3. Run the following command:
`./gradlew bootrun`
## AuthControllerThe `AuthController` class defines endpoints for user authentication and registration.
- `/register`: Endpoint for user registration.
- `/login`: Endpoint for user login.## Request Objects
### AuthRequest
- `email`: User's email address.
- `password`: User's password.### RegisterRequest
- `name`: User's name.
- `email`: User's email address.
- `password`: User's password.
- `role`: User's role. Default role is USER if not specified.## Response Objects
### AuthResponse
- `message`: Success message.
## SpringsecuritydemoApplication
This class is the main entry point of the application.
- `/`: Endpoint for welcoming authenticated users.
- `/admins`: Endpoint for welcoming authenticated users with ADMIN role.## PreAuthorize Annotation
- `@PreAuthorize("hasAuthority('ADMIN')")`: Restricts access to the `/admins` endpoint to users with the ADMIN role.