• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

JwtProperties의 내용을 application.properteis로 옮기고 싶습니다.

23.04.18 17:29 작성 조회수 420

0

강사님 안녕하세요.

JwtProperties에 있는 내용을 application.properteis로 옮기고 @Value 어노테이션으로 받아와서 사용하고싶습니다.

@Value를 사용하기 위해 JwtAuthenticationFilter에 @Component를 붙여주었으나, authenticationManager의 빈 등록을 먼저 하라고 하더군요.

 

@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception {
	return authenticationConfiguration.getAuthenticationManager();
}

그래서 이러한 코드를 SecurityConfig에 추가했습니다. 하지만 계속 AuthenticationManager를 빈으로 등록시키라는 에러메세지만 뜨네요. 이거 어떻게 해야하죠?...

바쁘신 와중에 답변 달아주시면 감사하겠습니다.

답변 1

답변을 작성해보세요.

0

그러려면

@Bean

public AuthenticationManager authenticationManager(

AuthenticationConfiguration authenticationConfiguration) throws Exception {

return authenticationConfiguration.getAuthenticationManager();

}

 

시큐리티에 빈등록해주고

di로 받아서 jwt필터에 주입해주면 되요

poohharry님의 프로필

poohharry

질문자

2023.04.19

감사합니다!!!