-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#109] Refactor: HttpSessionUtils 클래스 정의 및 기타
- 로그인 세션과 관련된 기능을 모아둔 HttpSessionUtils 클래스 정의 - User 클래스에서만 사용하는 Gender enum을 중첩 enum 으로 선언 - ApiUserController에서 InvalidParameterException에 대한 에러 응답 객체를 반환하도록 변경
- Loading branch information
Showing
3 changed files
with
43 additions
and
23 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
BE/src/main/java/com/codesquad/team1/signup/common/utils/HttpSessionUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.codesquad.team1.signup.common.utils; | ||
|
||
import com.codesquad.team1.signup.domain.user.User; | ||
|
||
import javax.servlet.http.HttpSession; | ||
import java.util.Optional; | ||
|
||
public class HttpSessionUtils { | ||
|
||
public static final String SESSION_LOGINED_USER = "loginedUser"; | ||
|
||
private HttpSessionUtils() {} | ||
|
||
public static Optional<User> getLoginedUserFromSession(HttpSession session) { | ||
return Optional.ofNullable((User)session.getAttribute(SESSION_LOGINED_USER)); | ||
} | ||
|
||
public static void logout(HttpSession session) { | ||
session.removeAttribute(SESSION_LOGINED_USER); | ||
session.invalidate(); | ||
} | ||
} |
6 changes: 0 additions & 6 deletions
6
BE/src/main/java/com/codesquad/team1/signup/repository/Gender.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters