AuthTokenAccessException: не удалось декодировать канал-носитель JWT: в заголовке запроса «Авторизация» отсутствует канал-носитель JWT - PullRequest
0 голосов
/ 05 февраля 2019

Я пытаюсь использовать облачные API SDK для вызова OData. Хотя я передаю токен JWT (учетные данные клиента) Я получаю следующее исключение:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.sap.cloud.sdk.cloudplatform.tenant.exception.TenantAccessException: Failed to get current tenant.] with root cause
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT com.sap.cloud.sdk.cloudplatform.security.exception.AuthTokenAccessException: Failed to decode JWT bearer: no JWT bearer present in "Authorization" header of request.
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.security.AuthTokenDecoder.decode(AuthTokenDecoder.java:204) ~[security-scp-cf-2.8.0.jar!/:na]

Полная трассировка стека:

2019-02-05T18:22:43.57+0530 [APP/PROC/WEB/0] OUT 2019-02-05 12:52:43.569 INFO 47 --- [nio-3000-exec-5] com.sap.icd.mt.lib.TenantIdDeterminer : Got tenantId 78fbfe7d-5a84-4b3b-a2e4-40bb0f8bd233 2019-02-05T18:22:43.57+0530 [APP/PROC/WEB/0] OUT 2019-02-05 12:52:43.570 INFO 47 --- [nio-3000-exec-5] c.s.i.m.h.TenantIdentifierResolver : Tenant id is 78fbfe7d-5a84-4b3b-a2e4-40bb0f8bd233 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT 2019-02-05 12:52:43.836 ERROR 47 --- [nio-3000-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.sap.cloud.sdk.cloudplatform.tenant.exception.TenantAccessException: Failed to get current tenant.] with root cause
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT com.sap.cloud.sdk.cloudplatform.security.exception.AuthTokenAccessException: Failed to decode JWT bearer: no JWT bearer present in "Authorization" header of request. 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.security.AuthTokenDecoder.decode(AuthTokenDecoder.java:204) ~[security-scp-cf-2.8.0.jar!/:na] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.security.AuthTokenRequestContextListener.getProperties(AuthTokenRequestContextListener.java:49) ~[security-scp-cf-2.8.0.jar!/:na] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.servlet.AbstractRequestContextListener.requestContextInitialized(AbstractRequestContextListener.java:40) ~[servlet-2.8.0.jar!/:na] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextCallable.notifyContextInitialized(RequestContextCallable.java:68) ~[servlet-2.8.0.jar!/:na] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextCallable.call(RequestContextCallable.java:129) ~[servlet-2.8.0.jar!/:na] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextServletFilter.doFilter(RequestContextServletFilter.java:173) ~[servlet-2.8.0.jar!/:na] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.93+0530 [RTR/1] OUT kxl0nr0kxfaotfbjatacollectors-srv.cfapps.sap.hana.ondemand.com - [2019-02-05T12:52:43.565+0000] "POST /collectCPIData HTTP/1.1" 500 240 156 "-" "PostmanRuntime/7.6.0" "-" "10.0.137.61:61096" x_forwarded_for:"-" x_forwarded_proto:"https" vcap_request_id:"049a65ff-88ee-4fde-5c73-ca5c56a8a317" response_time:0.367982033 app_id:"5f9d0eae-0b99-44e4-8b54-614370e47a1a" app_index:"0" x_correlationid:"-" x_b3_traceid:"def0a66ed80780e4" x_b3_spanid:"def0a66ed80780e4" x_b3_parentspanid:"-"
2019-02-05T18:22:43.93+0530 [RTR/1] OUT 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176) ~[spring-security-oauth2-2.3.4.RELEASE.jar!/:na]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.0.5.RELEASE.jar!/:5.0.5.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.6.RELEASE.jar!/:5.0.6.RELEASE]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.31.jar!/:8.5.31]
2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:677) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_181] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_181] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.31.jar!/:8.5.31] 2019-02-05T18:22:43.83+0530 [APP/PROC/WEB/0] OUT at java.lang.Thread.run(Thread.java:836) [na:1.8.0_181] 2019-02-05T18:22:43.84+0530 [APP/PROC/WEB/0] OUT 2019-02-05 12:52:43.844 INFO 47 --- [nio-3000-exec-5] com.sap.icd.mt.lib.TenantIdDeterminer : Got tenantId 78fbfe7d-5a84-4b3b-a2e4-40bb0f8bd233 2019-02-05T18:22:43.84+0530 [APP/PROC/WEB/0] OUT 2019-02-05 12:52:43.844 INFO 47 --- [nio-3000-exec-5] c.s.i.m.h.TenantIdentifierResolver : Tenant id is 78fbfe7d-5a84-4b3b-a2e4-40bb0f8bd233

Я не уверен, какие классынеобходимы для устранения неполадок.Пожалуйста, оставьте комментарий, чтобы получить дополнительную информацию.

1 Ответ

0 голосов
/ 05 февраля 2019

Похоже, JWT отсутствует в заголовке.Вы защитили свое приложение с approuter?Смотрите также: https://blogs.sap.com/2017/07/18/step-7-with-sap-s4hana-cloud-sdk-secure-your-application-on-sap-cloud-platform-cloudfoundry/

...