简体   繁体   中英

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 . When using IDE and deploying to embedded tomcat, app works. After spending one day, I figured out what is the problem.
Application AuthPageController specifies @RequestMapping("/msal4jsample/secure/aad") . This works with embedded 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. Same application can be deployed multiple times to different folders. Tomcat maps url as /secure/aad and request in this case is never handled. To fix problem, I created array of request mappings @RequestMapping(value = {"/msal4jsample/secure/aad", "/secure/aad"}) .
I forked MS Azure repository and made changes. Please take a look at zdenko-s/ms-identity-java-webapp
There are other fixes too.

  • War file name is specified in pom.xml, no need to rename it. Removed rename step from documentation also
  • .gitignore wrongly specifies exclude target . Should be */target

Sharing info. Fix in my forked branch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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