Skip to content

Commit 567114f

Browse files
Add. README.md
1 parent 19fa388 commit 567114f

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

.talismanrc

+2
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ fileignoreconfig:
55
checksum: 132aa3ec9e32300dd751924b5a097e210cc48972d3f1cfc64fdbd27e48287eae
66
- filename: src/main/java/com/springsecuritybasics/security/UserDetailsImpl.java
77
checksum: b2b602bc1b23b32620a8a296916479235cef857372718ddcf42d526d51c29e50
8+
- filename: README.md
9+
checksum: 0739d46f7dfbec36000392d5040f273c310b29d67e2aaa2653814ad8996fc759
810
version: ""

README.md

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Spring Security Basics application
2+
3+
## Gradle based spring boot application which provide below APIs of the users using test driven development.
4+
5+
## APIs of the Application
6+
7+
- Signup
8+
- Authenticated
9+
- Get all users
10+
- Get user by username
11+
12+
## APIs
13+
14+
### Signup - `/signup`
15+
16+
* `NOTE` - this API can be accessed by everyone.
17+
18+
* Request
19+
20+
```
21+
curl --location --request POST 'http://localhost:8080/signup' \
22+
--header 'Content-Type: application/json' \
23+
--data '{
24+
"username": "test_username",
25+
"password": "test_password",
26+
"role": "ROLE_user",
27+
"firstname": "test_firstname",
28+
"lastname": "test_lastname"
29+
}'
30+
```
31+
32+
* Response
33+
34+
```
35+
{
36+
"code": "CREATED",
37+
"status": "success",
38+
"data": {
39+
"message": "user successfully signed up"
40+
}
41+
}
42+
```
43+
44+
### Authenticated - `/authenticated`
45+
46+
* `NOTE` - this API can be accessed by only authenticated users
47+
48+
* Request
49+
50+
```
51+
curl --location --request GET 'http://localhost:8080/authenticated' \
52+
--header 'Authorization: Basic Y2FwdGFpbjpwYXNzd29yZA=='
53+
```
54+
55+
* Response
56+
57+
```
58+
{
59+
"code": "OK",
60+
"status": "success",
61+
"data": {
62+
"message": "This API is accessed by only authenticated users"
63+
}
64+
}
65+
```
66+
67+
### Get all users - `/users`
68+
69+
* `NOTE` - this API can be accessed by authenticated users who are having admin role.
70+
71+
* Request
72+
73+
```
74+
curl --location --request GET 'http://localhost:8080/users' \
75+
--header 'Authorization: Basic aXJvbm1hbjpwYXNzd29yZA=='
76+
```
77+
78+
* Response
79+
80+
```
81+
{
82+
"code": "OK",
83+
"status": "success",
84+
"data": [
85+
{
86+
"username": "test_username",
87+
"role": "ROLE_user",
88+
"firstname": "test_firstname",
89+
"lastname": "test_lastname"
90+
}
91+
]
92+
}
93+
```
94+
95+
### Get User by username - `/users/{username}`
96+
97+
* `NOTE` - this API can be accessed by authenticated users who are having admin and user roles.
98+
99+
* Request
100+
101+
```
102+
curl --location --request GET 'http://localhost:8080/users/test_username' \
103+
--header 'Authorization: Basic dGhvcjpwYXNzd29yZA=='
104+
```
105+
106+
* Response
107+
108+
```
109+
{
110+
"code": "OK",
111+
"status": "success",
112+
"data": {
113+
"username": "test_username",
114+
"role": "ROLE_user",
115+
"firstname": "test_firstname",
116+
"lastname": "test_lastname"
117+
}
118+
}
119+
```

0 commit comments

Comments
 (0)