在 servlet 环境(Tomcat Web 服务器)中使用 OPENSAML2 时出现编组错误
我正在尝试使用 OpenSAML2 库设置我的服务提供商。我正在尝试设置一个 servlet,它接受来自用户浏览器的 HttpRequest,并根据我想要创建 SAML 身份验证请求数据包的请求参数。
我能够创建 SAML 数据包,但是我想对 SAML 进行 Base64 编码,以便我可以将用户浏览器重定向到身份提供程序服务器。为此,我尝试使用“org.opensaml.saml2.core.impl.AuthnRequestMarshaller#marshall(AuthnRequest)”来编组 SAML 身份验证请求。
当我在 Web 服务器环境(独立 JAVA 应用程序)之外尝试时,效果很好。但是,当我将其作为 servlet 组件运行时,我收到一条错误消息“没有可用于 {urn:oasis:names:tc:SAML:2.0:assertion}Issuer,{urn:oasis:names:tc:SAML:2.0 的子级”的编组器:protocol}AuthnRequest",其中 Issuer 是 AuthnRequest 对象的组件。
我正在使用 Tomcat 5.5.34 网络服务器。如果有人能帮助我弄清楚这里发生了什么,那就太好了。它也将帮助其他尝试编写自己的服务提供者的人。令人惊讶的是,可用于此目的的文档非常少。
谢谢, 考斯图布
I am trying to setup my Service provider using OpenSAML2 libraries. I am trying to set up a servlet which would accept HttpRequest from user's browser and based on the request parameters I want to create a SAML Authentication request packet.
I am able to create the SAML packet, however I want to Base64 encode the SAML so that I can redirect the user browser to the Identity provider server. In order to do that I am trying to marshall the SAML Authentication Request using 'org.opensaml.saml2.core.impl.AuthnRequestMarshaller#marshall(AuthnRequest)'.
This works fine when I try it outside of the web server environment (standalone JAVA application). However when I run it as a servlet component I get an error saying "No marshaller available for {urn:oasis:names:tc:SAML:2.0:assertion}Issuer, child of {urn:oasis:names:tc:SAML:2.0:protocol}AuthnRequest", where Issuer is a component of the AuthnRequest object.
I am using Tomcat 5.5.34 webserver. It would be nice if someone can help me figure out whats happening here. It would help others trying to write their own Service Providers as well. Surprisingly very less documentation is available for this.
Thanks,
Kaustubh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要在 Tomcat common/endorsed 目录中包含以下 jars..resolver
这里是一个示例SAML2 服务提供者[还包括示例 WAR]。
You need to have following jars inside Tomcat common/endorsed directory..
Here is an example of SAML2 service provider [also includes the sample WAR].
普拉巴斯的回答很中肯。我遇到了同样的问题,并通过在 Sun iJDK 中支持 xalan 和 xerces 解决了这个问题。查看 Shibboleth 网站 的官方指南。查看“安装库”下的 openSAML 部署要求。
Prabath's answer is on the dot. I faced the same issue, and resolved it by endorsing xalan and xerces in the Sun iJDK. Check out the official guide from the Shibboleth site. Look under "Installing the Library" for openSAML deployment requirements.
我可以通过引入这行代码来解决这个问题 -
DefaultBootstrap.bootstrap();
。I am able to resolve this by introducing this line of code -
DefaultBootstrap.bootstrap();
.