xsuaa-spring-boot-starter无法识别JWT

2020-08-22 13:51发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


SAP CAP Java专家您好,

在我的示例项目 epmbp-consumer-app-java 添加了依赖性 cloud-security-xsuaa-integration 春季:

  com.sap.cloud.security.xsuaa 
  xsuaa-spring-boot-starter  

作为 srv/pom.xml 。 我认为通过这样做,我应该实现我的服务将接受来自approuter的JWT。 但是,当部署到我的SAP CP Cloud Foundry试用帐户并通过approuter访问端点时,我被重定向到路径/login。

期待您的帮助。

最好的牧羊犬
格雷戈尔

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


SAP CAP Java专家您好,

在我的示例项目 epmbp-consumer-app-java 添加了依赖性 cloud-security-xsuaa-integration 春季:

  com.sap.cloud.security.xsuaa 
  xsuaa-spring-boot-starter  

作为 srv/pom.xml 。 我认为通过这样做,我应该实现我的服务将接受来自approuter的JWT。 但是,当部署到我的SAP CP Cloud Foundry试用帐户并通过approuter访问端点时,我被重定向到路径/login。

期待您的帮助。

最好的牧羊犬
格雷戈尔

9条回答
zhangjiyang1323
1楼 · 2020-08-22 14:31.采纳回答

只需在此处解决此问题:缺少两个依赖项:

 
  com.sap.cds 
  cds-feature-xsuaa 
 

 <依赖性>
  com.sap.cds 
  cds-feature-cloudfoundry 
 

 
昵称总是被占用
2楼-- · 2020-08-22 14:27

希望有帮助:

 2020-03-09T15:00:09.41 + 0100 [APP/PROC/WEB/0] 2020-03-  09 14:00:09.414 INFO 6-[[main] osbwembedded.tomcat.TomcatWebServer:使用端口初始化的Tomcat:8080(http)
    2020-03-09T15:00:09.42 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:09.426 INFO 6 --- [main] o.apache.catalina.core.StandardService:正在启动 服务[Tomcat]
    2020-03-09T15:00:09.42 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:09.426 INFO 6 --- [main] org.apache.catalina.core.StandardEngine:正在启动 Servlet引擎:[Apache Tomcat/9.0.30]
    2020-03-09T15:00:09.54 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:09.547 INFO 6 --- [main] oaccC [Tomcat]。[localhost]。[/ ]:初始化Spring嵌入式WebApplicationContext
    2020-03-09T15:00:09.54 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:09.547 INFO 6 --- [main] osweb.context.ContextLoader:Root WebApplicationContext:初始化 在3804毫秒内完成
    2020-03-09T15:00:10.12 + 0100 [APP/PROC/WEB/0] OUT 2020-03-09 14:00:10.122 INFO 6 --- [main] com.zaxxer.hikari.HikariDataSource:HikariPool-1  -开始...
    2020-03-09T15:00:10.31 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:10.318 INFO 6 --- [main] com.zaxxer.hikari.HikariDataSource:HikariPool-1  -开始完成。
    2020-03-09T15:00:10.42 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:10.424 INFO 6 --- [main] com.sap.cds.feature.FeatureLoader:已加载 功能"默认CDS模型提供者工厂"
    2020-03-09T15:00:10.51 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:10.513 INFO 6 --- [main] c.s.c.services.impl.ServiceCatalogImpl:注册服务CatalogService
    2020-03-09T15:00:10.52 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:10.525 INFO 6 --- [main] cscservices.impl.ServiceCatalogImpl:注册的服务PersistenceService $ 默认
    2020-03-09T15:00:10.52 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:10.528 INFO 6 --- [main] cscservices.impl.ServiceCatalogImpl:注册的服务AuthorizationService $ 默认
    2020-03-09T15:00:10.53 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:10.531 INFO 6 --- [main] cscservices.impl.ServiceCatalogImpl:注册服务MessagingService $ 默认
    2020-03-09T15:00:10.53 + 0100 [APP/PROC/WEB/0] OUT 2020-03-09 14:00:10.534 INFO 6 --- [main] cscsimpl.runtime.CdsRuntimeImpl:创建的服务目录包含 4项服务
    2020-03-09T15:00:10.62 + 0100 [APP/PROC/WEB/0] OUT 2020-03-09 14:00:10.625 INFO 6 --- [main] cscfscadapter.AdapterBeanFactory:Servlet CdsODataV4Servlet映射到/odata/v4
    2020-03-09T15:00:10.63 + 0100 [APP/PROC/WEB/0] OUT 2020-03-09 14:00:10.631 INFO 6 --- [main] c.s.c.f.s.c.adapter.AdapterBeanFactory:Servlet ODataIndexServlet映射到/
    2020-03-09T15:00:11.62 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:11.621 INFO 6 --- [main] o.s.s.concurrent.ThreadPoolTask​​Executor:初始化ExecutorService'applicationTaskExecutor'
    2020-03-09T15:00:12.01 + 0100 [APP/PROC/WEB/0] OUT 2020-03-09 14:00:12.013 INFO 6 --- [main] c.s.c.s.x.a.XsuaaAutoConfiguration:为xsuaa请求自动配置RestOperations)
    2020-03-09T15:00:12.31 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:12.311 INFO 6 --- [main] .s.s.UserDetailsS​​erviceAutoConfiguration:
    2020-03-09T15:00:12.31 + 0100 [APP/PROC/WEB/0] OUT使用生成的安全密码:0c79613e-1864-42f1-a6e0-738104777a37
    2020-03-09T15:00:12.54 + 0100 [APP/PROC/WEB/0] OUT 2020-03-09 14:00:12.541 INFO 6 --- [main] ossweb.DefaultSecurityFilterChain:创建过滤器链:任何请求 ,[org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter @ 67dc6b48,org.springframework.security.web.context.SecurityContextPersistenceFilter @ 59371066,org.springframework.security.web.header.HeaderWriterFilter @ 63e70bf9,组织。  springframework.security.web.csrf.CsrfFilter@580ffea,org.springframework.security.web.authentication.logout.LogoutFilter@42f9873e,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@20a47036,org.springframework.security.web。  authentication.ui.DefaultLoginPageGeneratingFilter@51a719e7,org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@57f2e67,org.springframework.security.web.authentication.www.BasicAuthenticationFilter@6f240187,org.springframework.security.web.savedrequest。  RequestCacheA  wareFilter @ 3c544c9,org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@175ac243,org.springframework.security.web.authentication.AnonymousAuthenticationFilter@4571cebe,org.springframework.security.web.session.SessionManagementFilter@419f0ea,org.springframework。  security.web.access.ExceptionTranslationFilter @ 10f20d38,org.springframework.security.web.access.intercept.FilterSecurityInterceptor @ 1958c0d9]
    2020-03-09T15:00:12.71 + 0100 [APP/PROC/WEB/0] OUT 2020-03-09 14:00:12.718 INFO 6 --- [main] osbwembedded.tomcat.TomcatWebServer:Tomcat在端口上启动 (s):8080(http),上下文路径为"
    2020-03-09T15:00:12.72 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:00:12.721 INFO 6 --- [main] org.test.Application:在8.302秒内启动了应用程序 (JVM运行于9.368)
    2020-03-09T15:00:13.93 + 0100 [CELL/0] OUT容器变健康
    2020-03-09T15:02:02.15 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:02:02.151 INFO 6-[nio-8080-exec-6] oaccC [Tomcat]。  [localhost]。[/]:初始化Spring DispatcherServlet'dispatcherServlet'
    2020-03-09T15:02:02.15 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:02:02.152信息6-[nio-8080-exec-6] osweb.servlet。  DispatcherServlet:初始化Servlet'dispatcherServlet'
    2020-03-09T15:02:02.20 + 0100 [APP/PROC/WEB/0] 2020-03-09 14:02:02.208信息6-[nio-8080-exec-6] osweb.servlet。  DispatcherServlet:在56毫秒内完成初始化
    2020-03-09T15:02:02.31 + 0100 [RTR/1] OUT s0001142741trial-s0001142741trial-dev-test-srv.cfapps.eu10.hana.ondemand.com-[2020-03-09T14:02:02.108204796Z]  GET/app/odata/v4/CatalogService/Books HTTP/1.1" 302 0 0" https://s0001142741trial-s0001142741trial-dev-test-app.cfapps.eu10.hana.ondemand.com/app/index.html""  Mozilla/5.0(Macintosh; Intel Mac OS X 10_15_3)AppleWebKit/537.36(KHTML,例如Gecko)Chrome/80.0.3987.132 Safari/537.36""-"" 10.32.1.6:61003" x_forwarded_for:"-" x_forwarded_proto:" https"  vcap_request_id:" 75f39e84-0e60-4406-74db-d5aa3ce330a3" response_time:0.210239 gorouter_time:0.000223 app_id:" e2221d71-345a-44a2-b8b4-65cbc9057f0d" app_index:" 0" x_correlationid59:"-4dbcf34-9  tenantid:"-" x_scp_request_id:" df66d132-021c-407d-be93-4f3651c5ccbf-5E664C5A-2D2B86A" x_b3_traceid:" 75a76c3e341cabf3" x_b3_spanid:" 75a76c3e341cabb3b3c3e341cabb3
    2020-03-09T15:02:02.31 + 0100 [RTR/1] OUT 
打个大熊猫
3楼-- · 2020-08-22 14:32

嗨,格雷格,

您是否可以在后端日志中看到请求是否到达后端?

我试图确定这是一个approuter还是CAP Java问题。

最好的问候,
马塞尔

一周热门 更多>