File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
src/main/java/com/gcms/v3 Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import com .gcms .v3 .domain .auth .presentation .data .request .SignInRequestDto ;
4
4
import com .gcms .v3 .domain .auth .presentation .data .response .TokenInfoResponseDto ;
5
+ import com .gcms .v3 .domain .auth .service .LogoutService ;
5
6
import com .gcms .v3 .domain .auth .service .ReissueTokenService ;
6
7
import com .gcms .v3 .domain .auth .service .SignInService ;
8
+ import jakarta .servlet .http .HttpServletRequest ;
7
9
import lombok .RequiredArgsConstructor ;
8
10
import org .springframework .http .ResponseEntity ;
9
11
import org .springframework .web .bind .annotation .*;
@@ -15,6 +17,7 @@ public class AuthController {
15
17
16
18
private final SignInService signInService ;
17
19
private final ReissueTokenService reissueTokenService ;
20
+ private final LogoutService logoutService ;
18
21
19
22
@ PostMapping
20
23
public ResponseEntity <TokenInfoResponseDto > signIn (@ RequestBody SignInRequestDto signInRequestDto ) {
@@ -27,4 +30,10 @@ public ResponseEntity<TokenInfoResponseDto> reissueToken (@RequestBody String re
27
30
TokenInfoResponseDto res = reissueTokenService .execute (refreshToken );
28
31
return ResponseEntity .ok (res );
29
32
}
33
+
34
+ @ DeleteMapping ("/logout" )
35
+ public ResponseEntity <Void > logout (HttpServletRequest request ) {
36
+ logoutService .execute (request );
37
+ return ResponseEntity .noContent ().build ();
38
+ }
30
39
}
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
44
44
authorizeRequests
45
45
.requestMatchers (HttpMethod .POST , "/v3/auth" ).permitAll ()
46
46
.requestMatchers (HttpMethod .POST , "/v3/auth/reissueToken" ).authenticated ()
47
+ .requestMatchers (HttpMethod .DELETE , "/v3/auth/logout" ).authenticated ()
47
48
)
48
49
49
50
.addFilterBefore (new ExceptionFilter (objectMapper ), UsernamePasswordAuthenticationFilter .class )
You can’t perform that action at this time.
0 commit comments