当前位置:网站首页>Resttemplate multiple authentication information authorization

Resttemplate multiple authentication information authorization

2022-06-21 20:04:00 GodSure0914

Business scenario , I spliced a request header through the program , Then put the request header in HttpHeaders adopt RestTemplate Call exit gateway , Pass the interface test swagger There is absolutely no problem with calling , But once it is sent to the server and called by the program, an error will be reported
 Insert picture description here

You can see from the log , What's reported here is json Conversion error , But by log The log discovery involves my own splicing Authorization No problem , Finally, print the log at the exit gateway and find restTemplate Two... Were passed on the request Authorization In the past , The gateway only takes the first one for analysis , The reason for the problem is that the browser itself has an authentication information ,java The code uses when assigning this authentication information HttpHeaders Of add Method , and add The method is based on the original information , So when the gateway resolves, it only resolves the browser segment , It eventually leads to an error report , take add Change to set Then the problem is solved , The worst is through swagger Local calls can't find this problem at all !!!
 Insert picture description here
 Insert picture description here
 Insert picture description here

原网站

版权声明
本文为[GodSure0914]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206211814026331.html