CAP自定义事件处理程序和登录用户

2020-08-17 05:44发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)如果通过APP路由器进行数据访问...

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

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


如果通过APP路由器进行数据访问(如XSUAA身份验证所建议的那样),则转移的用户将始终是"匿名":

 srv.before('READ','Partner',request => {
         var user = request.user.id; //<<<总是"匿名"})

其他信息

default-env.json

 {
     "目的地":[
         {
             " name":" srv-binding",
             " url":" https://<我们的公司> .cfapps.eu10.hana.ondemand.com",
             " forwardAuthToken":true
         }
     ],
     " VCAP_SERVICES":{
         " xsuaa":[
             {
                 "名称":" wsw_vdr-uaa","标签":" xsuaa","标签":[" xsuaa"],
                 "凭据":{
                     " apiurl":" https://api.authentication.eu10.hana.ondemand.com",
 .... 

xs-app.json

 {
     " welcomeFile":" webapp/index.html",
     " authenticationMethod":"路由",
     "路线":[
         {
             " source":" ^/webapp/index.html",
             " target":" index.html",
             " localDir":" webapp/",
             " cacheControl":"无需缓存,无需存储,必须重新验证"
         },
         {
             " source":" ^/webapp/(.*)$",
             " target":" $ 1",
             " localDir":" webapp/",
             " authenticationType":" xsuaa"
         },
         {
             " source":" ^/logout.html $",
             " localDir":" webapp/",
             " authenticationType":"无"
         },
         {
             " source":" ^(。*)$",
             " destination":" srv-binding",
             " authenticationType":" xsuaa"
         }
     ],
     "登出": {
         " logoutEndpoint":"/img/logout",
         " logoutPage":" logout.html"
     }
 }
 

mta.yaml

 ############# SERVER MODULE ###########################
  -名称:wsw_vdr-srv
    类型:nodejs
    路径:srv
    参数:
      记忆体:256M
      磁盘配额:512M
    特性:
      退出:1#由deploy.js任务终止
    要求:
     ####从CAP配置中提取的资源####
     -名称:wsw_vdr-db
     -名称:wsw_vdr-uaa
    提供:
     -名称:CAP服务使用者(例如approuter)所需的srv-binding#
       特性:
         srv-url:$ {default-url}
  ################################################  ##########