我已经使用 spring-security-saml2 实现了 saml-adfs 服务提供者。SAML-ADFS 身份验证正常进行。身份验证后,我试图将其重定向到登录页面,该页面几乎没有变量,例如根据登录的用户信息动态填充的 UserID。对于 html 页面渲染,我使用的是 spring-boot-started-thymeleaf lib。我浏览了各种文章并完成了以下配置。我所有的 html 文件都存在于 src/main/resources/templates 中。
我收到“圆形视图路径 [着陆],检查您的 ViewResolver 设置!错误。
If I change it to a static html page, which is present in src/main/resources/static folder, then it is loading the content.
Please guide me how I can resolve this issue. I have dependency of spring-boot-starter-web and spring-boot-starter-thymeleaf in my build.gradle
landing.html page
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<title>Landing!</title>
</head>
<body>
<h1>You are logged as <span th:text="${username}">null</span>!</h1>
<p>
<a th:href="@{/saml/logout}">Global Logout</a><br/>
<a th:href="@{/saml/logout?local=true}">Local Logout</a>
</p>
</body>
</html>
@Controller
public class LandingController {
@RequestMapping("/landing")`enter code here`
public String landing(@CurrentUser User user, Model model) {
model.addAttribute("username", user.getUsername());
return "landing";
}