add api context and logout
This commit is contained in:
@ -1,10 +1,13 @@
|
||||
package com.iconplus.smartproc.controller;
|
||||
|
||||
import com.iconplus.smartproc.helper.model.EmptyRequest;
|
||||
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||
import com.iconplus.smartproc.model.request.LoginRequest;
|
||||
import com.iconplus.smartproc.model.request.RefreshTokenRequest;
|
||||
import com.iconplus.smartproc.model.response.LoginResponse;
|
||||
import com.iconplus.smartproc.model.response.RefreshTokenResponse;
|
||||
import com.iconplus.smartproc.service.authentication.LoginService;
|
||||
import com.iconplus.smartproc.service.authentication.LogoutService;
|
||||
import com.iconplus.smartproc.service.authentication.TokenManagementService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -15,11 +18,14 @@ public class AuthenticationController {
|
||||
|
||||
private LoginService loginService;
|
||||
private TokenManagementService tokenManagementService;
|
||||
private LogoutService logoutService;
|
||||
|
||||
public AuthenticationController(LoginService loginService,
|
||||
TokenManagementService tokenManagementService) {
|
||||
TokenManagementService tokenManagementService,
|
||||
LogoutService logoutService) {
|
||||
this.loginService = loginService;
|
||||
this.tokenManagementService = tokenManagementService;
|
||||
this.logoutService = logoutService;
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
@ -32,4 +38,10 @@ public class AuthenticationController {
|
||||
return tokenManagementService.execute(refreshTokenRequest);
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public EmptyResponse logoutUser(EmptyRequest request) {
|
||||
return logoutService.execute(request);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user