Ajax Custom DSLs - customConfigurerAjax(HttpSecurity http) 에서 loginProcessingUrl(/api/login) 처리할 때 null
customConfigurerAjax(HttpSecurity http) 에서 loginProcessingUrl("/api/login") 처리할 때
private void customConfigurerAjax(HttpSecurity http) throws Exception {
http
.apply(new AjaxLoginConfigurer<>())
.successHandlerAjax(ajaxAuthenticationSuccessHandler())
.failureHandlerAjax(ajaxAuthenticationFailureHandler())
.setAuthenticationManager(authenticationManager(authenticationConfiguration))
.loginProcessingUrl("/api/login")
;
}AbstractAuthenticationFilerConfigurer 클래스의 loginProcessingUrl을 호출하던데 여기서 authFilter 가 null 이어서 예외가 발생하는데
public T loginProcessingUrl(String loginProcessingUrl) {
this.loginProcessingUrl = loginProcessingUrl;
this.authFilter.setRequiresAuthenticationRequestMatcher(createLoginProcessingUrlMatcher(loginProcessingUrl));
return getSelf();
}어떻게 해결해야할지 모르겠습니다. ㅠㅠ
https://github.com/pdh9311/core-spring-security
추가로 ajax security 시작한 이후로 localhost:8080 으로 접속하니까 화면이 안나오고 401 에러가 발생하는데 어디가 문제인지 모르겠습니다. ㅠㅠ
답변 2
1
네
근데 AjaxLoginConfigurer 에서 getAuthenticationFilter() 를 참조하고 있는데 AjaxLoginProcessingFilter 은 어디에서 생성해 주고 있는가요?
0
AjaxSecurityConfig.java에서 강사님이 Custom DSLs 적용하면서 주석 처리하길래 그냥 주석 처리 해버렸습니다.
혹시 AjaxLoginProcessingFilter를 Bean으로 등록하면 AjaxLoginConfigurer에서 알아서 가져다 쓰려나 하고 이전에 주석처리했던 것을 다시 돌려놓고 @Bean 어노테이션을 붙였는데 안되긴 하더라고요.
지금 제대로 이해가 되지 않는 상태로 일단 한번 작성해보면서 들어보고 있어서 헷갈리는 부분이 많습니다.
아 밑에 화면이 나오긴 한다고 한거는 지금 보니 Custom DSLs을 적용하기 전으로 돌아가서 해보니 저렇게 해야했다 인데, 다른 질문들 찾아보니 AjaxSecurityConfig에서도 "/" 를 permitAll 로 설정해주지 않아서 그랬던 같긴합니다.
deprecated 안된 방식으로 수정하면서 강의를 들으려다보니까 강의와 코드가 조금 다른 부분 있어서 어렵네요....
1
강의에서 제공하는 소스를 보면
public final class AjaxLoginConfigurer<H extends HttpSecurityBuilder<H>> extends
AbstractAuthenticationFilterConfigurer<H, AjaxLoginConfigurer<H>, AjaxLoginProcessingFilter> {
private AuthenticationSuccessHandler successHandler;
private AuthenticationFailureHandler failureHandler;
private AuthenticationManager authenticationManager;
public AjaxLoginConfigurer() {
super(new AjaxLoginProcessingFilter(), null);
}
AjaxLoginConfigurer 생성자에서 AjaxLoginProcessingFilter 를 생성하고 있습니다.
cozyrust 님께서 공유해 주신 소스를 보면 AjaxLoginProcessingFilter 를 생성하는 저 부분이 없는데 추가해 주시면 될 것 같습니다.
0
@Order(0) - formSecurityFilterChain
@Order(1) - ajaxSecurityFilterChain
으로 변경해주니 화면이 나오긴 하네요...
시큐리티 공부 버전 질문
0
175
1
[해결 방법] MethodSecurityConfig.customMethodSecurityMetadataSource() 호출하지 않는 이슈
0
186
1
AbstractSecurityInterceptor.class.beforeInvocation()를 2번 실행하는 경우
0
174
1
강의 코드가 왜이렇게 뒤죽박죽인가요...
0
249
1
메인 페이지로 접속해도 login url로 리다이렉트가 되지 않습니다..
0
236
1
파라미터값이 넘어가지 않습니다 ....
0
374
1
security filterChain 설정 질문이 있습니다.
0
332
1
소스 부분 질문 드립니다.
0
208
2
섹션4 7번 강의 문제가 있는거 같네요.
0
344
2
파일이 수시로 이름이 바껴있네요 ㄷㄷ
0
304
1
HttpSessionSecurityContextRepository를 사용안하는 문제
0
555
2
error , exception 이 잘 안됩니다.
0
282
2
thymeleaf tag 질문합니다.
0
196
2
버전업하면서 deprecated된 것들이 너무많아요
0
478
1
spring security 패치 관련
0
437
1
모바일을 사용할때 토큰말고 세션
0
846
2
DB 연동한 인가 부분에 대한 질문입니다!
0
264
1
Ajax방식도 똑같이 Session방식을 사용하는건가요?
0
307
1
Config 파일 생성 시 질문이 있습니다.
0
225
1
강사님 몇일동안 구글 검색만 100개 했는데도 이유를 모르겠습니다..
1
429
2
403 에러 뜹니다.
0
813
2
login_proc의 존재에 대한 간략한 설명입니다
0
276
1
top.html에 로그인 링크를 만들어서 로그인을 해봤습니다
0
283
2
안녕하세요. DB에 저장될 때 이해 안 가는 값이 있어서 질문드립니다!
0
189
1





