我正在 Jboss Wildfly 10 上使用 struts2 开发一个简单的 Web 应用程序。为了安全起见,需要将 Picketlink 与 SAML2 一起使用,以使用外部身份服务器(由 WSO2IS 公开)。
我使用 WSO2IS 创建了一个自定义服务提供程序,在 Web 应用程序中定义了安全性,并在 JBoss 中配置了 picketlink 以使用在 WSO2IS 中配置的服务提供程序。
安全过滤器工作,当我尝试打开 localhost:8087/MyApp SSO 工作并在 WSO2IS 登录页面上重定向,但登录后总是有 samlsso 提供者的直通,https:// localhost:9446/samlsso,显示重定向到目标操作的页面(还有一个“POST”按钮)。
问题是按下按钮或使用自动重定向称为返回 home.action 的操作,我无法在应用程序的页面中导航。我调用的任何链接,通过 Web 按钮,调用正确的操作,然后使用令牌(例如 https://localhost:9446/samlsso?SAMLRequest= 令牌)在 samlsso 上重定向(我想是通过 picketlink),然后返回回家。行动。
所有动作都有返回类型“tyles”,以及 ajax 调用的 2 个 json 结果。
这是我配置的详细信息:
Jboss-web.xml
<jboss-web>
<context-root>MYAPP</context-root>
<security-domain>MYAPP_SD</security-domain>
</jboss-web>
Web.xml 配置如下:
<security-constraint>
<web-resource-collection>
<web-resource-name>NoLock</web-resource-name>
<url-pattern>/css/*</url-pattern>
<url-pattern>/images/*</url-pattern>
<url-pattern>/img/*</url-pattern>
<url-pattern>/js/*</url-pattern>
<url-pattern>/jsp/*</url-pattern>
<url-pattern>/struts/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>MYAPPContext</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Application/MyAppRole</role-name>
</auth-constraint>
</security-constraint>
<!-- Define the Login Configuration for this Application -->
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>Application/MyAppRole</role-name>
</security-role>
角色Application/MyAppRole被定义到 wso2 身份服务器中,用于配置一个名为 MyAppRole 的新服务提供者。我在上面添加了一些用户。
在 Jboss 中,在 configuration->subsystem->security 我创建了一个 Security Domain MyApp_SD,身份验证代码为“
org.picketlink.identity.federation.bindings.jboss.auth.SAML2LoginModule”
即使在 Jboss 中,在 configuration->picketlink 中,我在安全域“ MyApp_SD ”(受信任域 localhost:8087)上创建了一个新的“MyApp_Federation”,并在联邦中创建了一个名为MyApp.war的新服务提供程序,甚至超过MyApp_SD作为安全域,并且 SAMLHandler 配置如下:
- SAML2LogOutHandler:类名 org.picketlink.identity.federation.web.handlers.saml2.SAML2LogOutHandler
- RolesGenerationHandler:类名 org.picketlink.identity.federation.web.handlers.saml2.RolesGenerationHandler
- SAML2AuthenticationHandler:类名
org.picketlink.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler,具有以下处理程序参数:- ASSERTION_SESSION_ATTRIBUTE_NAME:org.picketlink.sp.assertion
- DISABLE_ROLE_PICKING:假
- CLOCK_SKEW_MILIS:120000
- ROLE_KEY: http://wso2.org/claims/role
- SAML2AttributeHandler:类名 org.picketlink.identity.federation.web.handlers.saml2.SAML2AttributeHandler,具有以下处理程序参数:
- ATTRIBUTE_CHOOSE_FRIENDLY_NAME:假
那么,我的配置有问题吗?是 web.xml 约束、struts2 动作配置还是 picketlink 配置的问题?