Skip to content

Commit

Permalink
Merge pull request #20 from PetQ-A/develop
Browse files Browse the repository at this point in the history
develop 변동사항 반영
  • Loading branch information
kojesung authored Aug 8, 2024
2 parents 0249a1e + 0ef059c commit 3907907
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/petqa/base/Util.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.petqa.base;

import com.petqa.domain.User;
import com.petqa.dto.user.CustomUserDetails;
import jakarta.servlet.http.Cookie;
import org.springframework.security.core.context.SecurityContextHolder;

public class Util {

Expand All @@ -15,5 +18,10 @@ public static Cookie createCookie(String key, String value) {
return cookie;
}

public static User getCurrentUser() {
CustomUserDetails user = (CustomUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return user.getUser();
}

}

0 comments on commit 3907907

Please sign in to comment.