riyenas0925 / Sejong_Track_Management

:school: 세종대학교 트랙관리 프로그램
Apache License 2.0
6 stars 2 forks source link

[ENH] 유저 자신만 트랙로그 볼 수 있게 설정(트랙로그 컨트롤러 이용) #247

Open kimhanui opened 4 years ago

kimhanui commented 4 years ago

현재 :

@GetMapping("/log/find/user/{userId}")   //<-- 아무나 다른 사람 학번치면 조회가능
    public ResponseEntity<List<JudgeLogResponseDto>> find(@PathVariable String userId) throws Exception {
        List<JudgeLogResponseDto> resDtos = service.findByMember(userId);
        ResponseEntity<List<JudgeLogResponseDto>> entity = new ResponseEntity<>(resDtos, HttpStatus.OK);
        return entity;
    }

    @GetMapping("/log/find/track/{trackId}")  //<-- 트랙 치면 누구든 조회됨
    public ResponseEntity<List<JudgeLogResponseDto>> find(@PathVariable Long trackId) throws Exception {
        List<JudgeLogResponseDto> resDtos = service.findByTrack(trackId);
        ResponseEntity<List<JudgeLogResponseDto>> entity = new ResponseEntity<>(resDtos, HttpStatus.OK);
        return entity;
    }

방향:

회원가입할때 멤버에 고유 uuid값을 생성 &
Member 엔티티에 uuid 값을 넣을 필드 하나 만들고
(Uuid는 대충 고유한 랜덤값임 ㅇㅇ)
조회할때 세션에 멤버 있으니까
여기서 uuid값을 꺼내서 조회하는건 어떰? --> 세션값 uuid 이용

그럼 자신의 uuid로만 조회할수 있고
다른사람 uuid는 때려맞출수 없음.

더 생각할 수 있는 이슈:

세션에 있는 uuid 탈취의 가능성은?