Skip to content

Commit e9c94ae

Browse files
committed
chore: refractor the code
1 parent dd60c27 commit e9c94ae

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

spring-boot-jwt/src/main/java/com/akash/springboot/jwt/UserController.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public class UserController {
1919
private JwtUtil jwtUtil;
2020

2121
@GetMapping("/")
22-
public String index() {
23-
return "Greetings from Spring Boot!";
24-
}
22+
public String index() {
23+
return "Greetings from Spring Boot!";
24+
}
2525

2626
@PostMapping("/login")
2727
public ResponseEntity<?> login(@RequestBody Map<String, String> user) {
@@ -30,7 +30,8 @@ public ResponseEntity<?> login(@RequestBody Map<String, String> user) {
3030
users.put(username, password);
3131

3232
try {
33-
String token = jwtUtil.generateToken(username); Map<String, String> response = new HashMap<>();
33+
String token = jwtUtil.generateToken(username);
34+
Map<String, String> response = new HashMap<>();
3435
response.put("token", token);
3536
System.err.println(token);
3637
return new ResponseEntity<>(response, HttpStatus.OK);
@@ -41,12 +42,10 @@ public ResponseEntity<?> login(@RequestBody Map<String, String> user) {
4142
return new ResponseEntity<>("Invalid user", HttpStatus.UNAUTHORIZED);
4243
}
4344

44-
45-
@PostMapping("/tokenAuthentication")
45+
@PostMapping("/tokenVerification")
4646
public ResponseEntity<?> tokenAuthentication(@RequestBody Map<String, String> request) {
4747
String token = request.get("token");
4848

49-
//TODO: Validate token
5049
boolean isValid = jwtUtil.validateToken(token);
5150

5251
Map<String, Boolean> response = new HashMap<>();

spring-boot-jwt/src/main/java/com/akash/springboot/jwt/tempCodeRunnerFile.java

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)