7
7
import com .example .polls .model .RoleName ;
8
8
import com .example .polls .model .User ;
9
9
import com .example .polls .payload .*;
10
- import com .example .polls .repository .RefreshTokenRepository ;
10
+ import com .example .polls .repository .JwtRefreshTokenRepository ;
11
11
import com .example .polls .repository .RoleRepository ;
12
12
import com .example .polls .repository .UserRepository ;
13
13
import com .example .polls .security .JwtTokenProvider ;
@@ -56,7 +56,7 @@ public class AuthController {
56
56
JwtTokenProvider tokenProvider ;
57
57
58
58
@ Autowired
59
- RefreshTokenRepository refreshTokenRepository ;
59
+ JwtRefreshTokenRepository jwtRefreshTokenRepository ;
60
60
61
61
@ Value ("${app.jwtExpirationInMs}" )
62
62
private long jwtExpirationInMs ;
@@ -85,7 +85,7 @@ public ResponseEntity<?> authenticateUser(@Valid @RequestBody LoginRequest login
85
85
86
86
@ PostMapping ("/refreshToken" )
87
87
public ResponseEntity <?> refreshAccessToken (@ Valid @ RequestBody RefreshTokenRequest refreshTokenRequest ) {
88
- return refreshTokenRepository .findById (refreshTokenRequest .getRefreshToken ()).map (jwtRefreshToken -> {
88
+ return jwtRefreshTokenRepository .findById (refreshTokenRequest .getRefreshToken ()).map (jwtRefreshToken -> {
89
89
User user = jwtRefreshToken .getUser ();
90
90
String accessToken = tokenProvider .generateToken (UserPrincipal .create (user ));
91
91
return ResponseEntity .ok (new JwtAuthenticationResponse (accessToken , jwtRefreshToken .getToken (), jwtExpirationInMs ));
@@ -101,7 +101,7 @@ private void saveRefreshToken(UserPrincipal userPrincipal, String refreshToken)
101
101
Instant expirationDateTime = Instant .now ().plus (360 , ChronoUnit .DAYS ); // Todo Add this in application.properties
102
102
jwtRefreshToken .setExpirationDateTime (expirationDateTime );
103
103
104
- refreshTokenRepository .save (jwtRefreshToken );
104
+ jwtRefreshTokenRepository .save (jwtRefreshToken );
105
105
}
106
106
107
107
@ PostMapping ("/signup" )
0 commit comments