简体   繁体   English

部署到 Tomcat 时 msal-java-webapp-sample 不起作用

[英]msal-java-webapp-sample does not work when deployed to Tomcat

I suppose same problem as described in question MSAL for Java quickstart sample app throws exception .我想与问题MSAL for Java quickstart sample app throws exception中描述的问题相同。 When using IDE and deploying to embedded tomcat, app works.当使用 IDE 并部署到嵌入式 tomcat 时,应用程序可以工作。 After spending one day, I figured out what is the problem.花了一天时间,我弄清楚了问题所在。
Application AuthPageController specifies @RequestMapping("/msal4jsample/secure/aad") .应用程序AuthPageController指定@RequestMapping("/msal4jsample/secure/aad") This works with embedded tomcat.这适用于嵌入式 tomcat。 When deployed to tomcat server, tomcat removes application name from path since it is deployment information and exploded folder name depends on war file name.当部署到 tomcat 服务器时,tomcat 从路径中删除应用程序名称,因为它是部署信息,并且分解的文件夹名称取决于战争文件名。 Same application can be deployed multiple times to different folders.同一个应用程序可以多次部署到不同的文件夹。 Tomcat maps url as /secure/aad and request in this case is never handled. Tomcat 将 url 映射为/secure/aad aad ,并且在这种情况下永远不会处理请求。 To fix problem, I created array of request mappings @RequestMapping(value = {"/msal4jsample/secure/aad", "/secure/aad"}) .为了解决问题,我创建了请求映射数组@RequestMapping(value = {"/msal4jsample/secure/aad", "/secure/aad"})
I forked MS Azure repository and made changes.我分叉了 MS Azure 存储库并进行了更改。 Please take a look at zdenko-s/ms-identity-java-webapp请看一下zdenko-s/ms-identity-java-webapp
There are other fixes too.还有其他修复。

  • War file name is specified in pom.xml, no need to rename it. war文件名在pom.xml中指定,无需重命名。 Removed rename step from documentation also也从文档中删除了重命名步骤
  • .gitignore wrongly specifies exclude target . .gitignore 错误地指定了排除target Should be */target应该是*/target

Sharing info.分享信息。 Fix in my forked branch修复我的分叉分支

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM