|
|
|
@ -1,8 +1,6 @@
|
|
|
|
package kr.re.etri.autoflow.controllers;
|
|
|
|
package kr.re.etri.autoflow.controllers;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
@ -89,19 +87,27 @@ public class AuthController {
|
|
|
|
|
|
|
|
|
|
|
|
List<String> roles = userDetails.getAuthorities().stream()
|
|
|
|
List<String> roles = userDetails.getAuthorities().stream()
|
|
|
|
.map(GrantedAuthority::getAuthority)
|
|
|
|
.map(GrantedAuthority::getAuthority)
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseEntity.ok()
|
|
|
|
UserInfoResponse userInfo = new UserInfoResponse(
|
|
|
|
.header(HttpHeaders.SET_COOKIE, jwtCookie.toString())
|
|
|
|
|
|
|
|
.header(HttpHeaders.SET_COOKIE, jwtRefreshCookie.toString())
|
|
|
|
|
|
|
|
.body(new UserInfoResponse(
|
|
|
|
|
|
|
|
userDetails.getId(),
|
|
|
|
userDetails.getId(),
|
|
|
|
userDetails.getUsername(),
|
|
|
|
userDetails.getUsername(),
|
|
|
|
userDetails.getEmail(),
|
|
|
|
userDetails.getEmail(),
|
|
|
|
roles
|
|
|
|
userDetails.getAuthorities().stream()
|
|
|
|
));
|
|
|
|
.map(GrantedAuthority::getAuthority)
|
|
|
|
|
|
|
|
.collect(Collectors.toList())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 응답 바디에 userInfo와 쿠키 문자열 같이 넣기
|
|
|
|
|
|
|
|
Map<String, Object> responseBody = new HashMap<>();
|
|
|
|
|
|
|
|
responseBody.put("userInfo", userInfo);
|
|
|
|
|
|
|
|
responseBody.put("jwtCookie", jwtCookie.toString());
|
|
|
|
|
|
|
|
responseBody.put("jwtRefreshCookie", jwtRefreshCookie.toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseEntity.ok(responseBody);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "회원가입", description = "새로운 사용자를 등록합니다.")
|
|
|
|
@Operation(summary = "회원가입", description = "새로운 사용자를 등록합니다.")
|
|
|
|
@ApiResponses({
|
|
|
|
@ApiResponses({
|
|
|
|
@ApiResponse(responseCode = "200", description = "회원가입 성공"),
|
|
|
|
@ApiResponse(responseCode = "200", description = "회원가입 성공"),
|
|
|
|
|