Skip to content

Commit ad0083b

Browse files
committed
ADD DOMAIN
1 parent c6a3c52 commit ad0083b

File tree

6 files changed

+65
-0
lines changed

6 files changed

+65
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.example.security.jwt.account.application;
2+
3+
import org.springframework.security.core.userdetails.UserDetails;
4+
import org.springframework.security.core.userdetails.UserDetailsService;
5+
import org.springframework.security.core.userdetails.UsernameNotFoundException;
6+
7+
public class UserDetailServiceImpl implements UserDetailsService {
8+
9+
@Override
10+
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
11+
return null;
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.example.security.jwt.account.domain;
2+
3+
public interface AccountCustomRepository {
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.example.security.jwt.account.domain;
2+
3+
import com.example.security.jwt.global.exception.BaseErrorCode;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Getter;
6+
import org.springframework.http.HttpStatus;
7+
8+
@Getter
9+
@AllArgsConstructor
10+
public enum AccountErrorCode implements BaseErrorCode {
11+
INVALID_REFRESH_TOKEN(HttpStatus.FORBIDDEN, "ACCOUNT_001", "리프레시 토큰이 유효하지 않습니다"),
12+
;
13+
14+
private final HttpStatus httpStatus;
15+
private final String code;
16+
private final String message;
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example.security.jwt.account.domain;
2+
3+
import com.example.security.jwt.account.domain.entity.Account;
4+
import org.springframework.data.jpa.repository.EntityGraph;
5+
import org.springframework.data.jpa.repository.JpaRepository;
6+
7+
import java.util.Optional;
8+
9+
public interface AccountRepository extends JpaRepository<Account, Long>, AccountCustomRepository {
10+
@EntityGraph(attributePaths = "authorities") // 엔티티그래프 통해 EAGER로 가져온다.
11+
Optional<Account> findOneWithAuthoritiesByUsername(String username); // user를 기준으로 유저를 조회할 때 권한정보도 가져온다.
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.example.security.jwt.account.domain;
2+
3+
import com.example.security.jwt.account.domain.entity.Authority;
4+
import org.springframework.data.jpa.repository.JpaRepository;
5+
6+
public interface AuthorityRepository extends JpaRepository<Authority, String> {
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example.security.jwt.global.exception;
2+
3+
import org.springframework.http.HttpStatus;
4+
5+
public interface BaseErrorCode {
6+
7+
HttpStatus getHttpStatus();
8+
9+
String getCode();
10+
11+
String getMessage();
12+
}

0 commit comments

Comments
 (0)