인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

poohharry's profile image
poohharry

asked

Spring Boot Security & JWT Lecture

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

Written on

·

490

0

강사님 안녕하세요.

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

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

 

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

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

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

springspring-securityjwt

Answer 1

0

metacoding님의 프로필 이미지
metacoding
Instructor

그러려면

@Bean

public AuthenticationManager authenticationManager(

AuthenticationConfiguration authenticationConfiguration) throws Exception {

return authenticationConfiguration.getAuthenticationManager();

}

 

시큐리티에 빈등록해주고

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

poohharry님의 프로필 이미지
poohharry
Questioner

감사합니다!!!

poohharry's profile image
poohharry

asked

Ask a question