수강이 제한됩니다.
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결스프링 시큐리티
CSRF 토큰 질문
안녕하세요. 강사님아래 CSRF 질문과 비슷한 내용인데 잘 이해가 가지 않아서 질문드립니다.이미 사용자가 로그인되어 있는 인증된 상태라고 한다는 가정하에사용자는 이미 로그인이 되어 있기 때문에 세션 쿠키가 만들어진 상태이고 공격자가 심어 놓은 URL 의 액션을 실행한다고 해도 사용자의 서비스 시스템은 정상적인 사용자의 액션이라고 판단한다고 하는 부분은 이해가 됩니다.질문입니다.여기서도 사용자가 이미 로그인 되어 있을 때 csrf 토큰 값도 만들어져 있어서 가져올 수 있는 것 아닌가요..?여기 답변이 잘 이해가 안갑니다.사용자의 서비스 시스템이 해당 액션에 대해 csrf 토큰값을 요구할 경우 공격자의 사이트에는 사용자 서비스에서 사용자에게 발행한 csrf 토큰값을 알수가 없기 때문에 접근이 거부 됩니다.
- 미해결스프링 시큐리티
강의 오탈자 제보
강의를 듣던 중 편집으로 인해 설명에 없던 경로가 나타났습니다.20:30 ~ 21:00 구간을 보다가 갑자기 user/login/** 가 나타납니다.변경 전.antMatchers("/", "/users").permitAll()변경 후.antMatchers("/", "user/login/**", "/users").permitAll() user/login/** 은 [실전프로젝트1] 뒷 강의까지 남아 있는데요.이 부분은 thymleaf html경로라서 없어도 되지 않을까 의견드려봅니다.
- 미해결스프링 시큐리티
RedirectStrategy 질문
앞선 강의에서 securityConfig의 formLogin api를 설정할 때 익명클래스로 successHandler를 구현한 적이 있습니다. 이때, response.sendRedirect(redirectUrl); 로 리다이렉트를 하신 반면성공핸들러를 커스터마이징하는 이번 강의에서는 private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy(); 을 통해 리다이렉트를 하셨는데요. 후자를 사용했을 때 좋은점이 있는지 궁금합니다.
- 미해결스프링 시큐리티
WebSecurityConfigurerAdapter 클래스 사용 불가
2~3강의중 WebSecurityConfigurerAdapter 클래스를가 사용하는 버전이 업데이트 되면서 더이상 사용할 수 없는데 혹시 다른 클래스를 상속받아 설정하여 사용하는 방법 알려주실 수 있나요?
- 미해결스프링 시큐리티
WebIgnore설정 오류 질문
@Override public void configure(WebSecurity web) throws Exception { //정적 리소스가 보안설정검사 없이 web .ignoring() .requestMatchers(PathRequest.toStaticResources().atCommonLocations()) ; }위 코드는 강의에서 설정한 webIgnore 설정입니다. 이 설정 후 로그인을 성공시킨 후 보여지는 화면은 아래와 같습니다.해상도가 좋지 않아 아래에 표기했습니다.{"timestamp":"2022-11-15T08:08:46.990+0000","status":999,"error":"None","message":"No message available"}검색을 해보니 webIgnore설정에 .antMatchers("/favicon.ico", "/resources/**", "/error") 를 추가하라고 하여 조치를 했더니 @Override public void configure(WebSecurity web) throws Exception { //정적 리소스가 보안설정검사 없이 web .ignoring() .requestMatchers(PathRequest.toStaticResources().atCommonLocations()) .antMatchers("/favicon.ico", "/resources/**", "/error") ; }위 문제화면 없이 로그인성공 후 메인화면으로 잘 리다이렉트 되는 것을 확인했습니다. 위 문제화면 특징 : 최초 웹어플리케이션 구동 후 로그인 성공시 999에러가 발견됨로그인이 안된 것은 아님. 999에러 화면에서 주소창에 localhost:8080/ 으로 직접 접속해보면 top위치에 로그인 버튼이 로그아웃 버튼으로 변경됨 강의에서 알려주신 코드외에 위 경우처럼 추가적인 조치가 필요한지 궁금합니다.문제가 발생하는 시점의 소스코드를 깃헙에 올렸습니다.
- 해결됨스프링 시큐리티
AuthenticationManager
public class SecurityConfig extends WebSecurityConfigurerAdapter { ... @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Bean public FilterSecurityInterceptor customFilterSecurityInterceptor() throws Exception { FilterSecurityInterceptor filterSecurityInterceptor = new FilterSecurityInterceptor(); ... filterSecurityInterceptor.setAuthenticationManager(authenticationManagerBean()); return filterSecurityInterceptor; } }위 방식으로 AuthenticationManager 를 받아 와서 사용하셨는데,authenticationManagerBean() 는 단순히 AuthenticationManager 빈을 반환한다고 이해하면 되나요? WebSecurityConfigurerAdapter 를 사용할 수 없는 5.7 이후 버전에 맞추어 구현한 아래 authenticationManager(HttpSecurity http) 를 사용해도 문제 없을까요?public class SecurityConfig { @Bean public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception { AuthenticationManagerBuilder authenticationManagerBuilder = http.getSharedObject(AuthenticationManagerBuilder.class); authenticationManagerBuilder.authenticationProvider(authenticationProvider); return authenticationManagerBuilder.build(); } @Bean public FilterSecurityInterceptor customFilterSecurityInterceptor(HttpSecurity http) throws Exception { FilterSecurityInterceptor filterSecurityInterceptor = new FilterSecurityInterceptor(); ... filterSecurityInterceptor.setAuthenticationManager(authenticationManager(http)); return filterSecurityInterceptor; } }
- 해결됨스프링 시큐리티
인가 관련 질문입니다.
안녕하세요. 섹션 5. 실전프로젝트 - 인가 프로세스 DB 연동 웹 계층 구현4) 웹 기반 인가처리 DB 연동 - FilterInvocationSecurityMetadataSource (1)강의 내용 중 질문이 있어 남깁니다. 일단 Spring Security 현 시점 최신 버전입니다. 질문할 부분은 FilterInvocationSecurityMetadataSource 구현체를 포함한 사용자 정의 FilterSecurityInterceptor 구현체를 최초로 구현/설정하고 실행하는 단계입니다.강의 상에서는 두 개의 FilterSecurityInterceptor가 마지막에 있고 앞에 위치한 사용자 정의 FilterSecurityInterceptor만 실행되고 뒤의 것은 실행되지 않아서 정적으로 설정한 인가가 적용되지 않는 모습이었는데, 제 버전에는 사용자 정의 FilterSecurityInterceptor, AuthorizationFilter가 있고강의와 달리 AuthorizationFilter 에서 정상적으로 해당 인가가 처리되는 모습입니다.이는 버전상의 차이가 맞나요? 혹은 잘못 이해했거나 설정상에 실수가 있었을 수 있나요?맞다면 사용자 정의 AuthorizationFilter를 구현한 완전히 새로운 방법을 사용해야 할까요?
- 미해결스프링 시큐리티
SecurityResourceService 에서 JPA proxy 관련 질문이 있습니다!
안녕하세요 강사님! 좋은 퀄리티의 Security 강의 제공해주셔서 감사드립니다.[실전프로젝트 - 인가 프로세스 DB 연동 웹 계층 구현]5) 웹 기반 인가처리 DB 연동 - FilterInvocationSecurityMetadataSource (2)수강하면서 생겼던 질문이 있습니다.// val resourcesList = resourcesRepository.findAllResources() val resourcesList = resourcesRepository.findAll()강사님께서 미리 만들어두셨던 findAllResources 메소드를 통한 JPQL로 fetch하지 않고 Spring DataJPA 기본 findAll 메소드로 resources 리스트 가져와서 Role의 roleName을 LinkedHashMap에 넣었습니다.(해당 서비스 클래스의 getResourceList 메소드에는 @Transactional 걸어둔 상태입니다.)그렇게 하니까 다음과 같은 에러가 발생했었습니다.failed to lazily initialize a collection of role: io.beaniejoy.coresecurity.domain.entity.Resources.roleSet, could not initialize proxy - no SessionResources 엔티티에 @ManyToMany로 roleSet에 fetch 모드를 LAZY로 걸어둔 상태여서 저는 lazy한 방식으로 proxy를 통해 role.getRoleName() 할 때 role_resources, role 두 테이블로 조회쿼리 날라가면서 잘 가져올 것이라 생각했었는데요. 왜 proxy를 initialize 하지 못했는지, resources를 findAll할 때 결국 fetch join으로 가져올 수 밖에 없는 것인지 궁금했습니다.(제가 JPA를 잘 알지 못하여 죄송합니다.)
- 미해결스프링 시큐리티
AjaxAuthenticationProvider 관련 질문
현재 AjaxAuthenticationProvider를 구현하면서 저는 UserDetailsService, PasswordEncoder를 생성자 주입을 통해서 구현하였습니다. 그리고 AjaxSecurityConfig는 다음과 같이 설정하였습니다.@Configuration @EnableWebSecurity @RequiredArgsConstructor @Order(1) public class AjaxSecurityConfig { private final PasswordEncoder passwordEncoder; private final UserDetailsService userDetailsService; @Bean public AuthenticationProvider ajaxAuthenticationProvider() { return new AjaxAuthenticationProvider(userDetailsService, passwordEncoder); } @Bean public AuthenticationManager ajaxAuthenticationManager() throws Exception { return new ProviderManager(ajaxAuthenticationProvider()); } @Bean AjaxAuthenticationFilter ajaxAuthenticationFilter() throws Exception { AjaxAuthenticationFilter ajaxAuthenticationFilter = new AjaxAuthenticationFilter(); ajaxAuthenticationFilter.setAuthenticationManager(ajaxAuthenticationManager()); return ajaxAuthenticationFilter; } @Bean SecurityFilterChain ajaxAuthenticationSecurityFilterChain(HttpSecurity http) throws Exception { http .antMatcher("/api/**") .authorizeRequests() .anyRequest().authenticated(); http.addFilterBefore(ajaxAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class); http.csrf().disable(); return http.build(); } } 여기서 UserDetailsService, PasswordEncoder는 제가 따로 만든 CommonSecurityConfig상에 빈으로 등록을 해놓은 상태이고요 여기서 질문드릴 부분은 제가 AuthenticationManager에 대해서 AuthenticationProvider를 등록하기 위해서 위와 같은 구조로 구현을 하였고 이외의 방법으로도 많이 해보았지만 전부 AjaxAuthenticationProvider가 Manager에 등록되지 않고 그에 따라서 실제 인증을 처리할 때 AjaxAuthenticationProvider를 통해서 수행하지 못해서 401 응답이 발생합니다. 그리고 저 상태에서 ProviderManager의 getProviders for문을 돌리는 부분에 브레이킹 포인트를 걸고 Provider 종류를 보았는데 AjaxAuthenticationProvider만 있는 것을 확인할 수 있습니다.이 부분은 당연히 제가 new ProviderManager(ajaxAuthenticationProvider())로 설정했기 때문에 위와 같은 결과가 도출되었다고 판단하고 있습니다. Spring Boot 버전은 2.7.3이고 기존 강의에서 설정한 방식과 많이 달라졌는데 혹시 위의 방법이 최선인지 여쭤보고 싶습니다.제 생각에는 제가 새로운 security 버전을 완벽하게 알지못해서 더 나은 방법을 못찾고 있다고 생각합니다 일단 위와같이 구현을 하면 ajax login request가 정상적으로 응답이 되긴합니다.
- 미해결스프링 시큐리티
FormAuthentictaionDetailsSource 의존주입 관련 질문입니다
안녕하세요 선생님강의 정말 잘 듣고있습니다. 실전프로젝트편 8회차 강의에서 AuthenticationDetailsSource 인터페이스를 구현하는FormAuthenticationDetailSource 클래스를 만들고, Bean으로 등록하는 부분까지는 이해가 되었습니다그 이후에 SecurityConfig 파일에서 위에서 등록한 Bean을 의존주입을 해 줄때 왜 아래 사진과 같이 인터페이스로 의존주입을 받는지 궁금합니다.인터페이스로 의존주입을 받았는데 디버깅으로 돌려보면 FormAuthenticationDetailSource 객체가 잘 주입되어있어서, 스프링 시큐리티에서 알맞은 객체를 찾아 주입해주는 것인지 궁금합니다.감사합니다!
- 미해결스프링 시큐리티
쓰레드 생명 주기?
안녕하세요.강사님의 시큐리티 강의를 재밌게 듣고 있는 수강생입니다.이게 맞게 질문드리는건진 모르겠는데,쓰레드 로컬의 생명주기는 어떻게 되는걸까요? 몇가지 질문을 드리자면..제가 스프링을 학습해보면서 사용자가 서버에 접속하면 서블릿 컨테이너의 쓰레드 풀에서 쓰레드 하나를 할당받아 사용하는 걸로 알고 있는데, 시큐리티에서 사용되는 쓰레드가 풀에서 받은 쓰레드랑 동일한 것일까요?클라이언트는 인증이 완료되고, DispatcherServlet까지 거쳐 정상적인 응답을 받으면 쓰레드를 반환하지 않는지요? 쓰레드를 반환하면 컨텍스트 정보가 다 날라갈 것이라 생각했는데, 시간 지나도 로그인 유지가 잘 되는거 같아 의아합니다.톰캣의 쓰레드 풀 설정을 보통 몇십개에서 몇백개 사이로 하던데, 동시 접속자 수가 많아져 쓰레드 개수가 부족하면 인증 정보가 SecurityContext에 어떻게 관리될지가 궁금합니다.제가 아는 정보가 좀 짬뽕되어 맞게 질문드리는 건진 모르겠으니 강사님의 소중한 고견 좀 부탁드리겠습니다. 감사합니다!
- 미해결스프링 시큐리티
인자를 두개 넘기게 할수 있는 방법있을까요??
[spring][spring security] 기존에는1)Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); ------> 2) public class CustomAuthenticationProvider implements AuthenticationProvider authenticate(authenticationToken) 메소드 ------> 3)public class PrincipalDetailService implements UserDetailsService 1)을 호출하면 2)클래스와 3) 클래스가 사용됩니다.------------------------------------------------------------------------저는 여기서 !!!! 인자를 2개 넘기고 싶습니다.1)Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken, "인자 추가")------> 2) public class CustomAuthenticationProvider implements AuthenticationProvider의 authenticate (authenticationToken, "인자 추가") 메소드 하면 에러가 납니다. 이미 security가 지원하는 AuthenticationProvider을 받아서 쓰는 거라 인자 추가가 안되는 것 같습니다... 스 할 수 있는 방법이나 아이디어가 있으실까요?? 어떤 아이디어도 좋습니다 !참고로) AuthenticationProvider는 읽기 전용이라 수정이 안되기도 하고, spring이 제가 만든 AuthenticationProvider 사용하지 않습니다...!
- 미해결스프링 시큐리티
form처리 provider 와 ajax 처리 provider 동시사용
안녕하세요 강사님 해당 과정 진행중에 안풀리는 부분이 있어 질문드립니다.Form로그인 관련 SecurityCofig 와 Ajax 로그인 SecurityConfig 를 동시 사용중인데요Ajax 로그인 인증처리를 담당하는 AjaxAuthenticationProvider를 사용하지 않으면 Form로그인 처리를 담당하는 CustomAuthentication 클래스가 정상 동작하여 Account 객체를 가지고 오는데 AjaxAuthenticationProvider를 사용하게 두면 "AbstractUserDetailsAuthenticationProvider" 클래스에서 처리하게 됩니다.. 이유를 모르겠네요
- 미해결스프링 시큐리티
로그인 기능 구현 안됨 ㅜㅜ
안녕하세요! 개인 프로젝트에 강의를 보면서 스프링 시큐리티를 입히고 있는 과정에서 문제가 있어서 문의드립니다!저의 SecurityConfig 클래스는 이렇게 되어있는데 로그인 시 스프링 시큐리티가 호출되지 않습니다 ㅜㅜ도대체 어디가 문제인 걸까요! 며칠째 삽질하다 문의 드립니다!package com.zhfvkq.dyshop.security; import com.zhfvkq.dyshop.member.service.CustomUserDetailsService; import com.zhfvkq.dyshop.security.provider.CustomAuthenticationProvider; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.security.servlet.PathRequest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer; import org.springframework.security.crypto.factory.PasswordEncoderFactories; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; @Slf4j @Configuration @RequiredArgsConstructor public class SecurityConfig { private final AuthenticationSuccess authenticationSuccess; private final AuthenticationFailure authenticationFailure; private final LogoutExecute logoutExecute; private final LogoutSuccess logoutSuccess; private final CustomUserDetailsService customUserDetailsService; private final AuthenticationEntryException authenticationEntryException; private final AccessDeniedHandlerException accessDeniedHandlerException; private String[] ignoredMatcherPattern = {"/", "/img/**", "/lib/**", "/member/**"}; @Bean public static PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); } @Bean public CustomAuthenticationProvider customAuthenticationProvider() { return new CustomAuthenticationProvider(); } @Bean public AuthenticationManager authenticationManager(AuthenticationConfiguration authConfiguration) throws Exception { return authConfiguration.getAuthenticationManager(); } @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().authenticated() ; http.formLogin() // 로그인 .loginPage("/member/login") .usernameParameter("userId") .passwordParameter("password") .loginProcessingUrl("/member/login") .successHandler(authenticationSuccess) .failureHandler(authenticationFailure) .permitAll() ; http.logout() // 로그아웃 .logoutUrl("/member/logout") // default post .logoutSuccessUrl("/") .invalidateHttpSession(true) // 세션 무효화 .deleteCookies("SESSION", "JSESSIONID", "remember-me") .addLogoutHandler(logoutExecute) .logoutSuccessHandler(logoutSuccess) ; http.rememberMe() // 사용자 저장 .rememberMeParameter("idMaintain") // default 파라미터는 remember-me .tokenValiditySeconds(604800) // 7일로 설정(default 14일) .alwaysRemember(false) .userDetailsService(customUserDetailsService) ; http.sessionManagement() .maximumSessions(1) // -1 무제한 .expiredUrl("/member/login") // 세션 만료 ; http.exceptionHandling() // Exception 처리 .authenticationEntryPoint(authenticationEntryException) // 인증 예외 .accessDeniedHandler(accessDeniedHandlerException) // 인가 예외 ; return http.build(); } /** * 정적 자원 및 루트 페이지 ignore */ @Bean public WebSecurityCustomizer webSecurityCustomizer() { return (web) -> web.ignoring() .requestMatchers(PathRequest.toStaticResources().atCommonLocations()) .antMatchers(ignoredMatcherPattern); } } 제 깃허브도 같이 전달 드립니다!https://github.com/zhfvkqHub dyshop프로젝트
- 미해결스프링 시큐리티
UserNotFoundException 은 UsernameNotFoundException이 맞나요?
안녕하세요. PPT 설명으로 표현된 UserNotFoundException이 찾아보니 UsernameNotFoundException 인 것 같습니다. 오타인가요? 아니면 버전이 바뀌면서 이름이 바뀐걸까요? package org.springframework.security.core.userdetails; import org.springframework.security.core.AuthenticationException; /** * Thrown if an {@link UserDetailsService} implementation cannot locate a {@link User} by * its username. * * @author Ben Alex */ public class UsernameNotFoundException extends AuthenticationException { /** * Constructs a <code>UsernameNotFoundException</code> with the specified message. * @param msg the detail message. */ public UsernameNotFoundException(String msg) { super(msg); } /** * Constructs a {@code UsernameNotFoundException} with the specified message and root * cause. * @param msg the detail message. * @param cause root cause */ public UsernameNotFoundException(String msg, Throwable cause) { super(msg, cause); } }
- 미해결스프링 시큐리티
_csrf 토큰 생성 애러
안녕하세요 강사님 CSRF의 _csrf 토큰을 생성하는 곳에서 에러가 발생해 질문 드립니다.우선 강사님의 코드를 그대로 작성했었는데EL1007E: Property or field 'token' cannot be found on null 오류가 발생했습니다. <meta id="_csrf" name="_csrf" th:content="${_csrf.token}"/> <meta id="_csrf_header" name="_csrf_header" th:content="${_csrf.headerName}"/>오류 발생 당시 코드입니다.그래서 아래의 코드로 변경하였습니다.<meta name="_csrf" th:content="${_csrf?.token}" th:if="${_csrf} ne null"> <meta name="_csrf_header" th:content="${_csrf?.headerName}" th:if="${_csrf} ne null">그랬더니 home 화면에서 csrf 토큰이 제대로 생성되지 않습니다. 하지만 login 화면에서는 같은 코드를 작성했는데 csrf 값이 정상적으로 출력 되었습니다.해당 전체 코드의 Othkkartho/SpringSecurityLearn at ch4.7 (github.com) 깃허브 링크 입니다.
- 미해결스프링 시큐리티
AuthenticationManager에 AjaxProvider가 등록되지 않습니다
강사님 안녕하세요!아무리 해봐도AuthenticationManager 에 provider로 AjaxAuthenticationProvider가 등록되질 않는데요 원인을 모르겟습니다...
- 미해결스프링 시큐리티
WebSecurityConfigurerAdapter confiture 메서드의 http 파라미터의 역할
안녕하세요 선생님, 강의를 복습중에 질문이 있습니다.WebSecurityConfigurerAdapter 의 configure 메서드 에서 http 파라미터로 설정 작업을 진행하는데 있어 사용자의 설정이 어떻게 filterChanigProxy 의 필터들의 목록을 바꾸는지가 궁금합니다.파라미터의 HttpSecurity 타입의 http 파라미터는 사용자가 설정 후 빈으로 등록되어있나여?또한 HttpSecurity 타입의 빈을 사용자가 설정하는데 있어 해당 빈이 어떻게 필터체인에 구성될 필터들의 요소를 바꿔주나요?감사합니다.
- 미해결스프링 시큐리티
spring mvc설정으로 인한 controller-mapping error
spring mvc방식으로 구현해보고 있는데 권한 인증인 403에러는 잘뜹니다. 하지만 controller를 통해서 들어가면 404에러가 뜹니다. 관련되서 질문드립니다.@RestControllerpublic class AdminController { @GetMapping("/admin") public String admin() { return "admin"; }} xml <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd "> <security:http auto-config="true" use-expressions="false"> <security:intercept-url pattern="/**" access="ROLE_ADMIN"/> <security:form-login/> </security:http> <security:authentication-manager> <security:authentication-provider> <security:user-service> <security:user name="admin" password="{noop}1234" authorities="ROLE_ADMIN, ROLE_USER"/> <security:user name="user" password="{noop}1234" authorities="ROLE_USER"/> </security:user-service> </security:authentication-provider> </security:authentication-manager> <mvc:resources mapping="/jsp/**" location="/jsp/"></mvc:resources> <context:annotation-config/> <context:component-scan base-package="com.test"/> <mvc:annotation-driven /> <mvc:default-servlet-handler/> <bean id="viewResolver" class = "org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </bean></beans> web.xml <?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:spring/context-spring.xml </param-value> </context-param> <filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>dispatcherServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/context-spring.xml</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dispatcherServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> </web-app> 접속 404오류 로그 DEBUG [FilterChainProxy] - Securing GET /adminDEBUG [HttpSessionSecurityContextRepository] - Retrieved SecurityContextImpl [Authentication=UsernamePasswordAuthenticationToken [Principal=org.springframework.security.core.userdetails.User [Username=admin, Password=[PROTECTED], Enabled=true, AccountNonExpired=true, credentialsNonExpired=true, AccountNonLocked=true, Granted Authorities=[ROLE_ADMIN, ROLE_USER]], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=0:0:0:0:0:0:0:1, SessionId=B6D437E830FDEBF274A77AF35C51A114], Granted Authorities=[ROLE_ADMIN, ROLE_USER]]]DEBUG [SecurityContextPersistenceFilter] - Set SecurityContextHolder to SecurityContextImpl [Authentication=UsernamePasswordAuthenticationToken [Principal=org.springframework.security.core.userdetails.User [Username=admin, Password=[PROTECTED], Enabled=true, AccountNonExpired=true, credentialsNonExpired=true, AccountNonLocked=true, Granted Authorities=[ROLE_ADMIN, ROLE_USER]], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=0:0:0:0:0:0:0:1, SessionId=B6D437E830FDEBF274A77AF35C51A114], Granted Authorities=[ROLE_ADMIN, ROLE_USER]]]DEBUG [FilterSecurityInterceptor] - Authorized filter invocation [GET /admin] with attributes [ROLE_ADMIN]DEBUG [FilterChainProxy] - Secured GET /adminDEBUG [DispatcherServlet] - GET "/admin", parameters={}DEBUG [SimpleUrlHandlerMapping] - Mapped to org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler@8c32dcDEBUG [DispatcherServlet] - Completed 404 NOT_FOUNDDEBUG [SecurityContextPersistenceFilter] - Cleared SecurityContextHolder to complete request
- 미해결스프링 시큐리티
webSecurityConfigurerAdapter Deprecated됨
새롭게 올려주실 수 있나요?