temp authentication user
This commit is contained in:
@ -0,0 +1,35 @@
|
||||
package com.iconplus.smartproc.controller;
|
||||
|
||||
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.TokenManagementService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
|
||||
@RestController
|
||||
@RequestMapping("/api/authentication")
|
||||
public class AuthenticationController {
|
||||
|
||||
private LoginService loginService;
|
||||
private TokenManagementService tokenManagementService;
|
||||
|
||||
public AuthenticationController(LoginService loginService,
|
||||
TokenManagementService tokenManagementService) {
|
||||
this.loginService = loginService;
|
||||
this.tokenManagementService = tokenManagementService;
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public LoginResponse getLoginResponse(@RequestBody LoginRequest loginRequest) {
|
||||
return loginService.execute(loginRequest);
|
||||
}
|
||||
|
||||
@PostMapping("/refresh-token")
|
||||
public RefreshTokenResponse getRefreshToken(@RequestBody RefreshTokenRequest refreshTokenRequest) {
|
||||
return tokenManagementService.execute(refreshTokenRequest);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user