Перед обновлением с Java 1.6 до Java 1.8 мы могли войти в веб-приложение. После обновления мы не могли войти в одно из веб-приложений, но я мог войти в другое. Они используют те же версии Spring-Security, OJDBC и Hibernate.
Однако, если мы удалим следующие jar-файлы из пути к классам, вход в систему снова будет работать, если вам не нужно использовать кошелек для входа в систему:
Удаление их в верхних средах не является вариантом, поскольку мы используем кошельки oracle для входа в систему.
Когда я устанавливаю уровень журнала на DEBUG, я вижу, что вход в систему был отклонен как пользователь anonomys, но ранее в журналах он успешно аутентифицировал логин / пароль.
Успешная аутентификация:
DEBUG [org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter][http-bio-8080-exec-10] - Authentication success. Updating SecurityContextHolder to contain: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@85ca488a: Principal: org.springframework.security.core.userdetails.User@f75cc3bd: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ADMIN,READ_ONLY; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@2cd90: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 383A7E52904236DDEA18E00864C0B94C; Granted Authorities: ADMIN, READ_ONLY
DEBUG [org.springframework.security.web.context.HttpSessionSecurityContextRepository][http-bio-8080-exec-10] - SecurityContext stored to HttpSession: 'org.springframework.security.core.context.SecurityContextImpl@85ca488a: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@85ca488a: Principal: org.springframework.security.core.userdetails.User@f75cc3bd: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ADMIN,READ_ONLY; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@2cd90: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 383A7E52904236DDEA18E00864C0B94C; Granted Authorities: ADMIN, READ_ONLY'
Затем в доступе отказано:
DEBUG [org.springframework.security.access.vote.AffirmativeBased][http-bio-8080-exec-5] - Voter: org.springframework.security.web.access.expression.WebExpressionVoter@259af14a, returned: -1
DEBUG [org.springframework.security.web.access.ExceptionTranslationFilter][http-bio-8080-exec-5] - Access is denied (user is anonymous); redirecting to authentication entry point
Полная трассировка стека:
DEBUG [org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter][http-bio-8080-exec-10] - Authentication success. Updating SecurityContextHolder to contain: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@85ca488a: Principal: org.springframework.security.core.userdetails.User@f75cc3bd: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ADMIN,READ_ONLY; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@2cd90: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 383A7E52904236DDEA18E00864C0B94C; Granted Authorities: ADMIN, READ_ONLY
DEBUG [org.springframework.security.web.context.HttpSessionSecurityContextRepository][http-bio-8080-exec-10] - SecurityContext stored to HttpSession: 'org.springframework.security.core.context.SecurityContextImpl@85ca488a: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@85ca488a: Principal: org.springframework.security.core.userdetails.User@f75cc3bd: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ADMIN,READ_ONLY; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@2cd90: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 383A7E52904236DDEA18E00864C0B94C; Granted Authorities: ADMIN, READ_ONLY'
DEBUG [org.springframework.security.web.context.SecurityContextPersistenceFilter][http-bio-8080-exec-10] - SecurityContextHolder now cleared, as request processing completed
DEBUG [org.springframework.security.web.context.HttpSessionSecurityContextRepository][http-bio-8080-exec-8] - No HttpSession currently exists
DEBUG [org.springframework.security.web.context.HttpSessionSecurityContextRepository][http-bio-8080-exec-8] - No SecurityContext was available from the HttpSession: null. A new one will be created.
DEBUG [org.springframework.security.web.authentication.AnonymousAuthenticationFilter][http-bio-8080-exec-8] - Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@9055c2bc: 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'
DEBUG [org.springframework.security.web.access.intercept.FilterSecurityInterceptor][http-bio-8080-exec-5] - Secure object: FilterInvocation: URL: /canary/dashboard.action; Attributes: [hasAnyRole('READ_ONLY','READ_ONLY2','STATISTICS','ADMIN')]
DEBUG [org.springframework.security.web.access.intercept.FilterSecurityInterceptor][http-bio-8080-exec-5] - Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@9055c2bc: 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
DEBUG [org.springframework.security.access.vote.AffirmativeBased][http-bio-8080-exec-5] - Voter: org.springframework.security.web.access.expression.WebExpressionVoter@259af14a, returned: -1
DEBUG [org.springframework.security.web.access.ExceptionTranslationFilter][http-bio-8080-exec-5] - Access is denied (user is anonymous); redirecting to authentication entry point
org.springframework.security.access.AccessDeniedException: Access is denied
at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:71)
at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:204)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:106)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
<security:authentication-manager alias = "authenticationManager">
<security:authentication-provider user-service-ref = "userDetailsService"/>
<security:authentication-provider ref = "ldapProvider"/>
</security:authentication-manager>
<bean id = "userDetailsService" class = "*******.CustomUserDetailsService">
<property name = "userDetailsService" ref = "userDetailsService"/>
<property name = "dataSource" ref = "dataSource"/>
<property name = "annotatedSessionFactory" ref = "sessionFactory"></property>
</bean>
<bean id = "ldapProvider" class = "org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
<constructor-arg ref = "authenticator"/>
<constructor-arg ref = "ldapAuthPopulator"/>
</bean>
еще одна вещь в том же духе: убедитесь, что на вашей новой Java установлена неограниченная криптография - поиск сразу даст результаты
Я попробую ваше первое предложение, но, возможно, я не смогу сделать второе, поскольку это IBM, а не под моим прямым контролем. Однако следует отметить, что проблема непоследовательна. Иногда работает нормально. В других случаях возникает эта тихая проблема с ошибкой.
Добавление OraclePKIProvider не повлияло.
У меня есть предположение, что если он решит, я добавлю его как решение: если конфигурация отличается, вы должны проверить файлы политик. Для неограниченного шифрования (которое, вероятно, является решением вашей проблемы) вы можете найти загрузки и информацию здесь: oracle.com/technetwork/java/javase/downloads/…, пожалуйста, дайте мне знать, помогло ли это.
@ScrappyDev, как вы пробовали добавить OraclePKIProvider, если сервер не находится под вашим контролем? Имеет значение положение этого провайдера в файле java.security. См. стр.9 этого документа: oracle.com/technetwork/topics/…
Я пробовал это в своей среде разработки. Не контролируйте тестовую или производственную среду.
@ScrappyDev пойми. Попробуйте установить это свойство где-нибудь на раннем этапе, когда ваше приложение запускается: System.setProperty("javax.net.debug", "ssl");, и, надеюсь, ваши журналы покажут, что не удается с точки зрения PKI.
@diginoise К сожалению, изменение порядка у меня не сработало. Включение режима отладки.
@diginoise Не могли бы вы добавить свой ответ? Я хотел бы дать вам награду до того, как истечет время




Spring 3.x несовместима с java 8, и лучше всего перейти на 4.x.
Учитывая, что вы столкнулись с проблемами при обновлении java (например, отсутствие изменения кода с вашей стороны), это просто подтверждает, что существует несовместимость версий.
В зависимости от того, насколько сильно вы настроили свои перехватчики, это может быть среднее усилие или совсем не прилагается (я помню, был крошечный разрыв обратной совместимости с spring 3.0.x до 3.1.x при объявлении анонимных ресурсов в конфигурации xml, однако все интерфейсы java остались обратно совместимыми )
Петро, он работает в другом моем приложении, которое имеет почти такую же настройку (с точки зрения весны).
Кроме того, я пытаюсь выполнить обновление, которое занимает некоторое время из-за того, насколько раздражающе старый этот код.
Обновился до 4.0.6.RELEASE, но проблема все еще существует.
В порядке приоритета (соотношение легкости реализации и отладки):
System.setProperty("javax.net.debug", "ssl"); как можно раньше в выполнении приложения и посмотреть, какие исключения выбрасываются.Cipher.getMaxAllowedKeyLength("AES") == Integer.MAX_VALUE имеет значение правда. Если его нет, его можно загрузить из Oracle (или из других источников, если вы используете OpenJDK) - просто найдите: Файлы политики юрисдикции с неограниченной надежностью Java Cryptography Extension (JCE).JAVA_HOME/jre/lib/security/java.security в соответствии с стр.9 из эта документация Oracle, помня, что порядок имеет значение.
любые файлы конфигурации для кошельков Oracle. Я также думаю, что вам нужно добавить Oracle PKI в список поставщиков безопасности в вашем JRE / JDK. См. Запись
security.provider.X=oracle.security.pki.OraclePKIProviderвJAVA_HOME/jre/lib/security/java.security. Если вы обновили свою Java, гарантированно, что вам не хватает этих записей конфигурации безопасности.