Spring security Spring Security SAML:在错误页面上显示SAML令牌
我已经基于这个项目构建了一个SAML SP:并且希望在错误页面上显示SAML标记,以便进行调试 我添加了一个错误控制器Spring security Spring Security SAML:在错误页面上显示SAML令牌,spring-security,saml,spring-saml,Spring Security,Saml,Spring Saml,我已经基于这个项目构建了一个SAML SP:并且希望在错误页面上显示SAML标记,以便进行调试 我添加了一个错误控制器 import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
@Controller
public class ErrorController implements org.springframework.boot.autoconfigure.web.ErrorController {
private static final Logger log = LoggerFactory.getLogger(SSOController.class);
private static final String PATH = "/error";
@RequestMapping(value = PATH)
public String error(HttpServletRequest request, Model model, Exception exception) {
model.addAttribute(exception);
return "error";
}
@Override
public String getErrorPath() {
return PATH;
}
}
我正在用错误的请求测试它,但是异常没有包含太多有用的信息。我希望在错误页面上或至少在日志中显示SAML标记,以便进行故障排除
如何访问SAML令牌或至少访问SAML令牌的属性
提前谢谢
此外,是否有一种方法可以使用Postman(或类似工具)来制造相同的SAML令牌,从而使测试更容易。现在,我每次都部署到AWS,因为第三部分IdP没有配置为处理本地主机
再次感谢
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
SAMLCredential credential = (SAMLCredential) authentication.getCredentials();
System.out.println("assertion is:" + XMLHelper.nodeToString(SAMLUtil.marshallMessage(credential.getAuthenticationAssertion())))