Can I get saml-token as string?

断了今生、忘了曾经 提交于 2019-12-10 10:39:30

问题


I am using spring-security-saml2 1.0.0.RELEASE. It works well and pretty good for me.

But New requirement is rised. I need saml-token as string.

can I get the saml-token as string. I find saml-token in log. But how to get the saml-token as string format?


回答1:


Good question, I've just added a new chapter to the Spring SAML manual which addresses this issue:

Authentication assertion

Assertion used to authenticate user is stored in the SAMLCredential object under property authenticationAssertion. By default the original content (DOM) of the assertion is discarded and system only keeps an unmarshalled version which might slightly differ from the original, e.g. in white-spaces. In order to instruct Spring SAML to keep the assertion in the original form (keep its DOM) set property releaseDOM to false on bean WebSSOProfileConsumerImpl.

Assertion can be serialized to String using the following call:

XMLHelper.nodeToString(SAMLUtil.marshallMessage(credential.getAuthenticationAssertion()))



来源:https://stackoverflow.com/questions/28512753/can-i-get-saml-token-as-string

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!