Skip to content

Commit 8ee0e3d

Browse files
authored
docs: Update README.md
1 parent e619425 commit 8ee0e3d

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

README.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,65 @@
1-
# spring-security-jwt
1+
# spring-security-jwt
2+
3+
This repository contains an example Spring project implementing authentication and authorization using Spring Security with JWT. The project provides a set of APIs for user registration, login, and role-based access control.
4+
5+
## Features
6+
7+
- **User Registration**: Allows new users to sign up by providing necessary details.
8+
- **User Login**: Authenticates users and provides a JWT token for subsequent requests.
9+
- **Role-Based Access Control**: Access control for specific endpoints based on user roles (`MASTER` and `USER`).
10+
11+
## APIs
12+
13+
The following endpoints are available:
14+
15+
- **User Signup**
16+
- **Endpoint**: `/signup`
17+
- **Method**: `POST`
18+
- **Description**: Registers a new user.
19+
- **Request Body**: `SignupRequestDto` (required)
20+
21+
- **User Login**
22+
- **Endpoint**: `/sign`
23+
- **Method**: `POST`
24+
- **Description**: Authenticates a user and returns a JWT token.
25+
- **Request Body**: `LoginRequestDto` (required)
26+
27+
- **Admin Only Access**
28+
- **Endpoint**: `/admin`
29+
- **Method**: `GET`
30+
- **Description**: Grants access to users with the `MASTER` role.
31+
- **Authorization**: Requires `MASTER` role.
32+
33+
- **User Only Access**
34+
- **Endpoint**: `/user`
35+
- **Method**: `GET`
36+
- **Description**: Grants access to users with the `USER` role.
37+
- **Authorization**: Requires `USER` role.
38+
39+
## Setup Instructions
40+
41+
1. **Development Environment**
42+
To run the project in a development environment, execute the following:
43+
```bash
44+
docker-compose -f docker-compose.dev.yml up
45+
```
46+
47+
2. **Production Deployment**
48+
To deploy in production, update the `.env` file with appropriate production configurations, then run:
49+
```bash
50+
docker-compose -f docker-compose.prod.yml up
51+
```
52+
53+
## API Documentation
54+
55+
The project includes Swagger API documentation, accessible at:
56+
```
57+
/docs
58+
```
59+
60+
## Dependencies
61+
62+
- Spring Boot
63+
- Spring Security
64+
- JWT
65+
- Swagger (for API documentation)

0 commit comments

Comments
 (0)