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

인프런 커뮤니티 질문&답변

상진님의 프로필 이미지
상진

작성한 질문수

스프링 기반 REST API 개발

스프링 시큐리티 기본 설정

예제 에러 질문 드립니다.

작성

·

2K

0

강의를 여러번 돌려보아도 놓친 부분이 없는데 문제가 발생하였고

여러가지를 손보아도 해결이 되지않아 질문 드립니다ㅠㅠ

첫번째 예제 실행시 /docs/index.html 로 접속하면 로그인 페이지로 이동이 됩니다

@Override

public void configure(WebSecurity web) throws Exception {

web.ignoring().mvcMatchers("/docs/index.html");

web.ignoring().requestMatchers(PathRequest.toStaticResources().atCommonLocations());

}

org.springframework.security.access.AccessDeniedException: Access is denied

at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:84) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:233) ~[spring-security-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:124) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:206) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) ~[spring-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:461) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:394) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.14.jar:9.0.14]

at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

2019-02-26 23:18:33.044 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.util.matcher.AndRequestMatcher : Trying to match using Ant [pattern='/', GET]

2019-02-26 23:18:33.045 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Request '/error' matched by universal pattern '/'

2019-02-26 23:18:33.045 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.util.matcher.AndRequestMatcher : Trying to match using NegatedRequestMatcher [requestMatcher=Ant [pattern='/*/favicon.']]

2019-02-26 23:18:33.045 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/error'; against '//favicon.'

2019-02-26 23:18:33.045 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.matcher.NegatedRequestMatcher : matches = true

2019-02-26 23:18:33.045 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.util.matcher.AndRequestMatcher : Trying to match using NegatedRequestMatcher [requestMatcher=MediaTypeRequestMatcher [contentNegotiationStrategy=org.springframework.web.accept.ContentNegotiationManager@5020e5ab, matchingMediaTypes=[application/json], useEquals=false, ignoredMediaTypes=[/]]]

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : httpRequestMediaTypes=[text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, /;q=0.8]

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : Processing text/html

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : application/json .isCompatibleWith text/html = false

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : Processing application/xhtml+xml

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : application/json .isCompatibleWith application/xhtml+xml = false

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : Processing image/webp

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : application/json .isCompatibleWith image/webp = false

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : Processing image/apng

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : application/json .isCompatibleWith image/apng = false

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : Processing application/xml;q=0.9

2019-02-26 23:18:33.046 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : application/json .isCompatibleWith application/xml;q=0.9 = false

2019-02-26 23:18:33.047 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : Processing /;q=0.8

2019-02-26 23:18:33.047 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : Ignoring

2019-02-26 23:18:33.047 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : Did not match any media types

2019-02-26 23:18:33.047 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.matcher.NegatedRequestMatcher : matches = true

2019-02-26 23:18:33.047 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.util.matcher.AndRequestMatcher : Trying to match using NegatedRequestMatcher [requestMatcher=RequestHeaderRequestMatcher [expectedHeaderName=X-Requested-With, expectedHeaderValue=XMLHttpRequest]]

2019-02-26 23:18:33.047 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.matcher.NegatedRequestMatcher : matches = true

2019-02-26 23:18:33.047 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.util.matcher.AndRequestMatcher : All requestMatchers returned true

2019-02-26 23:18:33.585 WARN 15076 --- [nio-8080-exec-1] o.a.c.util.SessionIdGeneratorBase : Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [522] milliseconds.

2019-02-26 23:18:33.587 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.s.HttpSessionRequestCache : DefaultSavedRequest added to Session: DefaultSavedRequest[http://localhost:8080/error]

2019-02-26 23:18:33.587 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.a.ExceptionTranslationFilter : Calling Authentication entry point.

2019-02-26 23:18:33.587 DEBUG 15076 --- [nio-8080-exec-1] s.w.a.DelegatingAuthenticationEntryPoint : Trying to match using AndRequestMatcher [requestMatchers=[NegatedRequestMatcher [requestMatcher=RequestHeaderRequestMatcher [expectedHeaderName=X-Requested-With, expectedHeaderValue=XMLHttpRequest]], MediaTypeRequestMatcher [contentNegotiationStrategy=org.springframework.web.accept.ContentNegotiationManager@5020e5ab, matchingMediaTypes=[application/xhtml+xml, image/, text/html, text/plain], useEquals=false, ignoredMediaTypes=[/]]]]

2019-02-26 23:18:33.587 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.util.matcher.AndRequestMatcher : Trying to match using NegatedRequestMatcher [requestMatcher=RequestHeaderRequestMatcher [expectedHeaderName=X-Requested-With, expectedHeaderValue=XMLHttpRequest]]

2019-02-26 23:18:33.587 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.matcher.NegatedRequestMatcher : matches = true

2019-02-26 23:18:33.587 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.util.matcher.AndRequestMatcher : Trying to match using MediaTypeRequestMatcher [contentNegotiationStrategy=org.springframework.web.accept.ContentNegotiationManager@5020e5ab, matchingMediaTypes=[application/xhtml+xml, image/, text/html, text/plain], useEquals=false, ignoredMediaTypes=[/]]

2019-02-26 23:18:33.587 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : httpRequestMediaTypes=[text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, /;q=0.8]

2019-02-26 23:18:33.587 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : Processing text/html

2019-02-26 23:18:33.588 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : application/xhtml+xml .isCompatibleWith text/html = false

2019-02-26 23:18:33.588 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : image/ .isCompatibleWith text/html = false

2019-02-26 23:18:33.588 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.u.m.MediaTypeRequestMatcher : text/html .isCompatibleWith text/html = true

2019-02-26 23:18:33.588 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.w.util.matcher.AndRequestMatcher : All requestMatchers returned true

2019-02-26 23:18:33.588 DEBUG 15076 --- [nio-8080-exec-1] s.w.a.DelegatingAuthenticationEntryPoint : Match found! Executing org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint@4abfa2ff

2019-02-26 23:18:33.589 DEBUG 15076 --- [nio-8080-exec-1] o.s.s.web.DefaultRedirectStrategy : Redirecting to 'http://localhost:8080/login'

2019-02-26 23:18:33.589 DEBUG 15076 --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.

2019-02-26 23:18:33.591 DEBUG 15076 --- [nio-8080-exec-1] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/css/']

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/login'; against '/css/'

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/js/']

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/login'; against '/js/'

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/images/']

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/login'; against '/images/'

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/webjars/']

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/login'; against '/webjars/'

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='//favicon.ico']

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/login'; against '/**/favicon.ico'

2019-02-26 23:18:33.602 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : No matches found

2019-02-26 23:18:33.603 DEBUG 15076 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /login at position 1 of 15 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'

2019-02-26 23:18:33.604 DEBUG 15076 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /login at position 2 of 15 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'

2019-02-26 23:18:33.604 DEBUG 15076 --- [nio-8080-exec-2] w.c.HttpSessionSecurityContextRepository : HttpSession returned null object for SPRING_SECURITY_CONTEXT

2019-02-26 23:18:33.604 DEBUG 15076 --- [nio-8080-exec-2] w.c.HttpSessionSecurityContextRepository : No SecurityContext was available from the HttpSession: org.apache.catalina.session.StandardSessionFacade@63c5180d. A new one will be created.

2019-02-26 23:18:33.604 DEBUG 15076 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /login at position 3 of 15 in additional filter chain; firing Filter: 'HeaderWriterFilter'

2019-02-26 23:18:33.605 DEBUG 15076 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /login at position 4 of 15 in additional filter chain; firing Filter: 'CsrfFilter'

2019-02-26 23:18:33.607 DEBUG 15076 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /login at position 5 of 15 in additional filter chain; firing Filter: 'LogoutFilter'

2019-02-26 23:18:33.607 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Request 'GET /login' doesn't match 'POST /logout'

2019-02-26 23:18:33.607 DEBUG 15076 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /login at position 6 of 15 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'

2019-02-26 23:18:33.607 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Request 'GET /login' doesn't match 'POST /login'

2019-02-26 23:18:33.607 DEBUG 15076 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /login at position 7 of 15 in additional filter chain; firing Filter: 'DefaultLoginPageGeneratingFilter'

2019-02-26 23:18:33.610 DEBUG 15076 --- [nio-8080-exec-2] o.s.s.w.header.writers.HstsHeaderWriter : Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@5cbf4d4c

2019-02-26 23:18:33.611 DEBUG 15076 --- [nio-8080-exec-2] w.c.HttpSessionSecurityContextRepository : SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.

2019-02-26 23:18:33.611 DEBUG 15076 --- [nio-8080-exec-2] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed

2번째 예제로 /docs/index.html에 접속시에는 404 에러가 발생합니다

@Override

protected void configure(HttpSecurity http) throws Exception {

http.authorizeRequests()

.mvcMatchers("/docs/index.html").anonymous()

.requestMatchers(PathRequest.toStaticResources().atCommonLocations()).anonymous();

}

. ____ _ __ _ _

/\ / ' () _

( ( ) | ' | '| | ' / ` |

\/ )| |)| | | | | || (| | ) ) ) )

' |__| .|| ||| |, | / / / /

=========||==============|/=///_/

:: Spring Boot :: (v2.1.2.RELEASE)

2019-02-26 23:23:31.800 INFO 8696 --- [ main] n.s.demoinfleanrestapi.DemoApplication : Starting DemoApplication on DESKTOP-822PETH with PID 8696 (D:intel-springdemo-inflean-rest-apitargetclasses started by sangjin in D:intel-springdemo-inflean-rest-api)

2019-02-26 23:23:31.804 INFO 8696 --- [ main] n.s.demoinfleanrestapi.DemoApplication : No active profile set, falling back to default profiles: default

2019-02-26 23:23:34.220 INFO 8696 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.

2019-02-26 23:23:34.573 INFO 8696 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 303ms. Found 2 repository interfaces.

2019-02-26 23:23:35.201 INFO 8696 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$b320f992] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2019-02-26 23:23:35.245 INFO 8696 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.hateoas.config.HateoasConfiguration' of type [org.springframework.hateoas.config.HateoasConfiguration$$EnhancerBySpringCGLIB$$32a146c4] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2019-02-26 23:23:36.086 INFO 8696 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)

2019-02-26 23:23:36.122 INFO 8696 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]

2019-02-26 23:23:36.122 INFO 8696 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.14]

2019-02-26 23:23:36.134 INFO 8696 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:Program FilesJavajdk-11.0.2bin;C:WINDOWSSunJavabin;C:WINDOWSsystem32;C:WINDOWS;D:appsangjinproduct12.2.0dbhome_1bin;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;"C:C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32;";C:Program FilesJavajdk-11.0.2bin;C:Program Files (x86)Windows Kits8.1Windows Performance Toolkit;C:Program FilesMicrosoft SQL Server110ToolsBinn;C:Program Files (x86)Microsoft SDKsTypeScript1.0;C:Program FilesMicrosoft SQL Server120ToolsBinn;C:Program FilesMySQLMySQL Utilities 1.6;C:WINDOWSsystem32;C:WINDOWSSystem32WindowsPowerShellv1.0;C:WINDOWSSystem32OpenSSH;C:Program FilesGitcmd;C:UserssangjinAppDataLocalMicrosoftWindowsApps;D:Program FilesJetBrainsIntelliJ IDEA Community Edition 2018.3.1bin;;C:Program FilesJavajdk-11.0.2bin;;.]

2019-02-26 23:23:36.449 INFO 8696 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext

2019-02-26 23:23:36.449 INFO 8696 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4553 ms

2019-02-26 23:23:36.673 INFO 8696 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...

2019-02-26 23:23:36.833 INFO 8696 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.

2019-02-26 23:23:36.901 INFO 8696 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [

name: default

...]

2019-02-26 23:23:37.002 INFO 8696 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.7.Final}

2019-02-26 23:23:37.003 INFO 8696 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found

2019-02-26 23:23:37.263 INFO 8696 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}

2019-02-26 23:23:37.454 INFO 8696 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect

2019-02-26 23:23:38.364 DEBUG 8696 --- [ main] org.hibernate.SQL :

drop table if exists account

2019-02-26 23:23:38.373 DEBUG 8696 --- [ main] org.hibernate.SQL :

drop table if exists account_roles

2019-02-26 23:23:38.376 DEBUG 8696 --- [ main] org.hibernate.SQL :

drop table if exists event

2019-02-26 23:23:38.379 DEBUG 8696 --- [ main] org.hibernate.SQL :

drop table if exists hibernate_sequence

2019-02-26 23:23:38.389 DEBUG 8696 --- [ main] org.hibernate.SQL :

create table account (

id integer not null,

email varchar(255),

password varchar(255),

primary key (id)

) engine=MyISAM

2019-02-26 23:23:38.403 DEBUG 8696 --- [ main] org.hibernate.SQL :

create table account_roles (

account_id integer not null,

roles varchar(255)

) engine=MyISAM

2019-02-26 23:23:38.415 DEBUG 8696 --- [ main] org.hibernate.SQL :

create table event (

id integer not null,

base_price integer not null,

begin_enrollment_date_time datetime,

begin_event_date_time datetime,

close_enrollment_date_time datetime,

description varchar(255),

end_event_date_time datetime,

event_status varchar(255),

free bit not null,

limit_of_enrollment integer not null,

location varchar(255),

max_price integer not null,

name varchar(255),

offline bit not null,

manager_id integer,

primary key (id)

) engine=MyISAM

2019-02-26 23:23:38.427 DEBUG 8696 --- [ main] org.hibernate.SQL :

create table hibernate_sequence (

next_val bigint

) engine=MyISAM

2019-02-26 23:23:38.439 DEBUG 8696 --- [ main] org.hibernate.SQL :

insert into hibernate_sequence values ( 1 )

2019-02-26 23:23:38.441 DEBUG 8696 --- [ main] org.hibernate.SQL :

insert into hibernate_sequence values ( 1 )

2019-02-26 23:23:38.442 DEBUG 8696 --- [ main] org.hibernate.SQL :

alter table account_roles 

add constraint FKtp61eta5i06bug3w1qr6286uf

foreign key (account_id)

references account (id)

2019-02-26 23:23:38.463 DEBUG 8696 --- [ main] org.hibernate.SQL :

alter table event 

add constraint FKphlyw4y37tcvehs0e107b93cn

foreign key (manager_id)

references account (id)

2019-02-26 23:23:38.489 INFO 8696 --- [ main] o.h.t.schema.internal.SchemaCreatorImpl : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@25765a49'

2019-02-26 23:23:38.491 INFO 8696 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'

2019-02-26 23:23:39.205 WARN 8696 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning

2019-02-26 23:23:39.338 DEBUG 8696 --- [ main] edFilterInvocationSecurityMetadataSource : Adding web access control expression 'anonymous', for Mvc [pattern='/docs/index.html']

2019-02-26 23:23:39.339 DEBUG 8696 --- [ main] edFilterInvocationSecurityMetadataSource : Adding web access control expression 'anonymous', for org.springframework.boot.autoconfigure.security.servlet.StaticResourceRequest$StaticResourceRequestMatcher@4113d9ab

2019-02-26 23:23:39.344 DEBUG 8696 --- [ main] o.s.s.w.a.i.FilterSecurityInterceptor : Validated configuration attributes

2019-02-26 23:23:39.345 DEBUG 8696 --- [ main] o.s.s.w.a.i.FilterSecurityInterceptor : Validated configuration attributes

2019-02-26 23:23:39.348 INFO 8696 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@347f8029, org.springframework.security.web.context.SecurityContextPersistenceFilter@4ed19540, org.springframework.security.web.header.HeaderWriterFilter@73230721, org.springframework.security.web.csrf.CsrfFilter@4e210016, org.springframework.security.web.authentication.logout.LogoutFilter@7d7f966f, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@322eb1a, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@cce92b5, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@3f78a5ed, org.springframework.security.web.session.SessionManagementFilter@62264d4f, org.springframework.security.web.access.ExceptionTranslationFilter@4abfa2ff, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@384f0e32]

2019-02-26 23:23:39.606 INFO 8696 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'

2019-02-26 23:23:40.510 INFO 8696 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''

2019-02-26 23:23:40.513 INFO 8696 --- [ main] n.s.demoinfleanrestapi.DemoApplication : Started DemoApplication in 9.558 seconds (JVM running for 10.686)

2019-02-26 23:23:40.661 INFO 8696 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'

2019-02-26 23:23:40.661 INFO 8696 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'

2019-02-26 23:23:40.671 INFO 8696 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 10 ms

2019-02-26 23:23:40.682 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 1 of 11 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'

2019-02-26 23:23:40.684 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 2 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'

2019-02-26 23:23:40.684 DEBUG 8696 --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : No HttpSession currently exists

2019-02-26 23:23:40.684 DEBUG 8696 --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : No SecurityContext was available from the HttpSession: null. A new one will be created.

2019-02-26 23:23:40.686 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 3 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'

2019-02-26 23:23:40.687 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 4 of 11 in additional filter chain; firing Filter: 'CsrfFilter'

2019-02-26 23:23:40.688 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 5 of 11 in additional filter chain; firing Filter: 'LogoutFilter'

2019-02-26 23:23:40.689 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Request 'GET /docs/index.html' doesn't match 'POST /logout'

2019-02-26 23:23:40.689 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'

2019-02-26 23:23:40.689 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.s.HttpSessionRequestCache : saved request doesn't match

2019-02-26 23:23:40.689 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'

2019-02-26 23:23:40.690 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'

2019-02-26 23:23:40.692 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.a.AnonymousAuthenticationFilter : Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@6332191e: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'

2019-02-26 23:23:40.692 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'

2019-02-26 23:23:40.692 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.session.SessionManagementFilter : Requested session ID FBA1E30ACC405B91BAD285151F88F495 is invalid.

2019-02-26 23:23:40.692 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 10 of 11 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'

2019-02-26 23:23:40.692 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html at position 11 of 11 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'

2019-02-26 23:23:40.702 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.a.i.FilterSecurityInterceptor : Secure object: FilterInvocation: URL: /docs/index.html; Attributes: [anonymous]

2019-02-26 23:23:40.703 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.a.i.FilterSecurityInterceptor : Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@6332191e: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS

2019-02-26 23:23:40.709 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.access.vote.AffirmativeBased : Voter: org.springframework.security.web.access.expression.WebExpressionVoter@2bccb588, returned: 1

2019-02-26 23:23:40.709 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.a.i.FilterSecurityInterceptor : Authorization successful

2019-02-26 23:23:40.709 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.a.i.FilterSecurityInterceptor : RunAsManager did not change Authentication object

2019-02-26 23:23:40.709 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /docs/index.html reached end of additional filter chain; proceeding with original chain

2019-02-26 23:23:40.725 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.header.writers.HstsHeaderWriter : Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@151c286f

2019-02-26 23:23:40.725 DEBUG 8696 --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.

2019-02-26 23:23:40.726 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.a.ExceptionTranslationFilter : Chain processed normally

2019-02-26 23:23:40.727 DEBUG 8696 --- [nio-8080-exec-1] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 1 of 11 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 2 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : No HttpSession currently exists

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : No SecurityContext was available from the HttpSession: null. A new one will be created.

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 3 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 4 of 11 in additional filter chain; firing Filter: 'CsrfFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 5 of 11 in additional filter chain; firing Filter: 'LogoutFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.u.matcher.AntPathRequestMatcher : Request 'GET /error' doesn't match 'POST /logout'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.s.HttpSessionRequestCache : saved request doesn't match

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.a.AnonymousAuthenticationFilter : Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@6332191e: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 10 of 11 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'

2019-02-26 23:23:40.730 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error at position 11 of 11 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'

2019-02-26 23:23:40.731 DEBUG 8696 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : /error reached end of additional filter chain; proceeding with original chain

2019-02-26 23:23:40.763 DEBUG 8696 --- [nio-8080-exec-1] o.s.s.w.a.ExceptionTranslationFilter : Chain processed normally

2019-02-26 23:23:40.763 DEBUG 8696 --- [nio-8080-exec-1] w.c.HttpSessionSecurityContextRepository : SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.

2019-02-26 23:23:40.763 DEBUG 8696 --- [nio-8080-exec-1] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed

2019-02-26 23:23:48.532 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 1 of 11 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 2 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] w.c.HttpSessionSecurityContextRepository : No HttpSession currently exists

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] w.c.HttpSessionSecurityContextRepository : No SecurityContext was available from the HttpSession: null. A new one will be created.

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 3 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 4 of 11 in additional filter chain; firing Filter: 'CsrfFilter'

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 5 of 11 in additional filter chain; firing Filter: 'LogoutFilter'

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Request 'GET /docs/index.html' doesn't match 'POST /logout'

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.s.HttpSessionRequestCache : saved request doesn't match

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'

2019-02-26 23:23:48.533 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'

2019-02-26 23:23:48.534 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.a.AnonymousAuthenticationFilter : Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@6332191e: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'

2019-02-26 23:23:48.534 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'

2019-02-26 23:23:48.534 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.session.SessionManagementFilter : Requested session ID FBA1E30ACC405B91BAD285151F88F495 is invalid.

2019-02-26 23:23:48.534 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 10 of 11 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'

2019-02-26 23:23:48.534 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html at position 11 of 11 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'

2019-02-26 23:23:48.536 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.a.i.FilterSecurityInterceptor : Secure object: FilterInvocation: URL: /docs/index.html; Attributes: [anonymous]

2019-02-26 23:23:48.536 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.a.i.FilterSecurityInterceptor : Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@6332191e: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS

2019-02-26 23:23:48.537 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.access.vote.AffirmativeBased : Voter: org.springframework.security.web.access.expression.WebExpressionVoter@2bccb588, returned: 1

2019-02-26 23:23:48.537 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.a.i.FilterSecurityInterceptor : Authorization successful

2019-02-26 23:23:48.537 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.a.i.FilterSecurityInterceptor : RunAsManager did not change Authentication object

2019-02-26 23:23:48.537 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /docs/index.html reached end of additional filter chain; proceeding with original chain

2019-02-26 23:23:48.542 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.header.writers.HstsHeaderWriter : Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@151c286f

2019-02-26 23:23:48.543 DEBUG 8696 --- [nio-8080-exec-2] w.c.HttpSessionSecurityContextRepository : SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.

2019-02-26 23:23:48.543 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.a.ExceptionTranslationFilter : Chain processed normally

2019-02-26 23:23:48.543 DEBUG 8696 --- [nio-8080-exec-2] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed

2019-02-26 23:23:48.543 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 1 of 11 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'

2019-02-26 23:23:48.543 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 2 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'

2019-02-26 23:23:48.543 DEBUG 8696 --- [nio-8080-exec-2] w.c.HttpSessionSecurityContextRepository : No HttpSession currently exists

2019-02-26 23:23:48.543 DEBUG 8696 --- [nio-8080-exec-2] w.c.HttpSessionSecurityContextRepository : No SecurityContext was available from the HttpSession: null. A new one will be created.

2019-02-26 23:23:48.543 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 3 of 11 in additional filter chain; firing Filter: 'HeaderWriterFilter'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 4 of 11 in additional filter chain; firing Filter: 'CsrfFilter'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 5 of 11 in additional filter chain; firing Filter: 'LogoutFilter'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Request 'GET /error' doesn't match 'POST /logout'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.s.HttpSessionRequestCache : saved request doesn't match

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.a.AnonymousAuthenticationFilter : Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@6332191e: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 10 of 11 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error at position 11 of 11 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'

2019-02-26 23:23:48.544 DEBUG 8696 --- [nio-8080-exec-2] o.s.security.web.FilterChainProxy : /error reached end of additional filter chain; proceeding with original chain

2019-02-26 23:23:48.547 DEBUG 8696 --- [nio-8080-exec-2] o.s.s.w.a.ExceptionTranslationFilter : Chain processed normally

2019-02-26 23:23:48.547 DEBUG 8696 --- [nio-8080-exec-2] w.c.HttpSessionSecurityContextRepository : SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.

2019-02-26 23:23:48.547 DEBUG 8696 --- [nio-8080-exec-2] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed

답변 2

0

상진님의 프로필 이미지
상진
질문자

어노테이션붙이고 상속도 받았는데 이런 에러가 발생합니다.
혹시 스프링부트 2.1.2 버전을 사용해서 강의에서 사용하는 버전과 달라서일까요?
아니면 제가 DB로 mysql을 연결해서 쓰고있어서 그럴까요?
전체코드입니다
import naver.sangjin.demoinfleanrestapi.accounts.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
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.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

@Autowired
AccountService accountService;

@Autowired
PasswordEncoder passwordEncoder;

@Bean
public TokenStore tokenStore() {
    return new InMemoryTokenStore();
}

@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}

@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.userDetailsService(accountService)
            .passwordEncoder(passwordEncoder);
}

@Override
public void configure(WebSecurity web) throws Exception {
    web.ignoring().mvcMatchers("/docs/index.html");
    web.ignoring().requestMatchers(PathRequest.toStaticResources().atCommonLocations());
}

}

0

백기선님의 프로필 이미지
백기선
지식공유자

public void configure(WebSecurity web) throws Exception 이 메소드 들어있는 클래스 전체 코드를 보고 싶은데요. 혹시 @Configuration을 안붙였거나 extends WebSecurityCOnfigurereAdapter를 안하신건 아니실까요?

상진님의 프로필 이미지
상진

작성한 질문수

질문하기