inflearn logo
강의

Course

Instructor

Developing Spring and JPA based web applications

Member Sign-up View

지원중단

Resolved

2224

nbc058298756

3 asked

1

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
- 먼저 유사한 질문이 있었는지 검색해보세요.
- 서로 예의를 지키며 존중하는 문화를 만들어가요.
- 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.
public class SecurityConfig extends WebSecurityConfigurerAdapter
에서
WebSecurityConfigurerAdapter
 
이게 지원중단이라떠서 더이상 진행이 불가능한데 어떻게 해결할 수 있나요?
 
 
 
 
 

spring spring-boot java JPA thymeleaf

Answer 2

3

ssodo

스프링 시큐리티 5.7.x 부터 WebSecurityConfigurerAdapter 는 Deprecated 되었습니다.

찾아보니 상황에 따라 SecurityFilterChain 과 WebSecurityCustomizer 를 빈으로 등록해 사용하는 방식을 권장하는 것 같아 저는 아래 코드처럼 사용하고 있습니다.

 

https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter

@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class SecurityConfig {

private final AccountService accountService;
private final DataSource dataSource;

/**
* Spring Security 5.7.x 부터 WebSecurityConfigurerAdapter Deprecated.
* -> SecurityFilterChain, WebSecurityCustomizer 를 상황에 따라 빈으로 등록해 사용한다.
*/
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
return http.authorizeRequests()
.mvcMatchers("/", "/login", "/sign-up", "/check-email", "/check-email-token",
"/email-login", "/check-email-login", "login-link", "/profile/*").permitAll()
.mvcMatchers(HttpMethod.GET, "/profile/*").permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage("/login").permitAll()
.and()
.logout().logoutSuccessUrl("/")
.and()
.rememberMe().userDetailsService(accountService).tokenRepository(tokenRepository())
.and().build();
}

@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
return (web) -> web.ignoring()
.mvcMatchers("/node_modules/**")
.requestMatchers(PathRequest.toStaticResources().atCommonLocations());
}
}

0

whiteship

감사합니다. WebSecurityConfigurerAdapter 문서에서도 이 방법을 권장하고 있습니다.

https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.html

0

springrebuildgo0297

저도 궁금합니다!

Study 개설하는 로직에 대해서 궁금점이 있습니다.

0

72

1

앱 재시작 후 회원가입

0

121

1

app.host 관련 질문이 있습니다

0

106

1

강의 버전 정보

0

136

1

event, study 참조

0

238

2

비밀번호 변경 로직 질문있습니다.

0

145

1

프로필 수정 처리 merge 질문입니다.

0

117

1

회원가입 성공 후 redirect이동시 권한 질문

0

516

3

HtmlEmailService 개발하다 생긴 의문입니다

0

260

2

postgreSql 연결하여 JPA 를 통해 테이블 생성시 ZONE 테이블 생성에서 에러가 납니다

0

440

2

수업질문 [긴급] 로그인안되는 문제 말씀해주시는 부분 반영해서 최종 질문드립니다

0

272

2

[긴급-재업로드]수업질문 로그인 안 되는 문제

0

246

1

[긴급] 로그인해도 네비게이션 바가 안 바뀌고 있습니다!! 로그인이 안 됩니다 도와주세요

0

285

1

cropper 오류 문제로 질문드립니다..

0

295

2

authentication관련 질문...

0

504

2

모임참가 취소 할때 로직 질문

0

363

3

안녕하세요 기선님 질문이있습니다..

0

237

1

HTML코드 및 강의 중간자료들

0

689

3

springSecurity

0

532

2

버전 질문입니다.

0

311

1

부트스트랩, css

0

362

2

영속성 컨텍스트 질문

0

257

2

다시 강의를 보니 드는생각..

0

359

2

5:50에 나오는 HTML코드는 어디서 찾을 수 있나여?

0

320

1