Я пытаюсь понять, почему Spring Security отказывает в доступе / привод / здоровье Может кто-нибудь определить проблему?
В журналах написано:
27/02/2020 11:24:57.902 [http-nio-4104-exec-1] [,,] DEBUG o.s.s.w.u.m.AntPathRequestMatcher - Checking match of request : '/actuator/health'; against '/actuator/**'
27/02/2020 11:24:57.902 [http-nio-4104-exec-1] [,,] DEBUG o.s.s.w.a.i.FilterSecurityInterceptor - Secure object: FilterInvocation: URL: /actuator/health; Attributes: [hasIpAddress('127.0.0.1/32')]
27/02/2020 11:24:57.902 [http-nio-4104-exec-1] [,,] DEBUG o.s.s.w.a.i.FilterSecurityInterceptor - Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@187dbd2d: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS
27/02/2020 11:24:57.909 [http-nio-4104-exec-1] [,,] DEBUG o.s.s.access.vote.AffirmativeBased - Voter: org.springframework.security.web.access.expression.WebExpressionVoter@790ce264, returned: -1
27/02/2020 11:24:57.912 [http-nio-4104-exec-1] [,,] DEBUG o.s.s.w.a.ExceptionTranslationFilter - Access is denied (user is anonymous); redirecting to authentication entry point
org.springframework.security.access.AccessDeniedException: Access is denied
at no.gjensidige.bank.nasasupport.jwt.JwtTokenFilter.doFilterInternal(JwtTokenFilter.java:60) [15 skipped]
at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:256) [41 skipped]
at java.base/java.lang.Thread.run(Thread.java:830) [13 skipped]
http
.antMatcher("/**") // If you want to override the security provided by Spring Boot.
.cors().and()
.csrf().disable()
.authorizeRequests()
.antMatchers("/actuator/**")
.access("hasIpAddress('127.0.0.1/32')")
.antMatchers("/api")
.hasAnyAuthority("not important")
.antMatchers("/actuator/health", "/open/**")
.permitAll()
.anyRequest()
.denyAll();
Кто-нибудь обнаружит ошибку? Я использую spring-boot-2.2.2.RELEASE
Я должен был добавить это: @SpringBootApplication(exclude = {UserDetailsServiceAutoConfiguration.class}) to
удалить сгенерированный по умолчанию пароль. Я получаю ту же ошибку, если UserDetailsServiceAutoConfiguration исключен или нет.