【发布时间】:2015-05-30 01:39:21
【问题描述】:
我们正在开发一个基于 Spring 的 Web 应用程序,它使用 Spring Security 3.2.3。我们正在与外部支付网关 (Paytm) 集成以接受用户的付款。以下是我们面临问题的场景:
- 用户登录到应用程序(这是一个
HTTP非 S 应用程序)并单击一个按钮 将他重定向到支付网关(Paytm支付网关 - 它是HTTPSurl)。 - 对于
Paytm集成,我们配置了一个回调URL,即我们应用程序的索引页面(例如http://server:port/app/index.jsp)。用户完成支付,Paytm将控件重定向回我们的 Spring 应用程序。 - 当
Paytm尝试调用我们应用的索引页面(例如http://server:port/app/index.jsp)时,它失败了,在Chrome 调试器中,我们可以看到403 Forbidden响应。 - 但是,此方案在
Mozilla Firexfox和IE 11中运行良好。该问题仅在Google Chrome和Operabrowsers 中出现。 - 我们尝试在回调 URL 中提供一些其他网站(如
https://google.com),重定向成功。
我们怀疑它可能是 Spring Security 中的一些配置问题或缺少设置,但我们不确定。
这是我们的 Spring Security 配置:
<http auto-config="true" use-expressions="true">
<!-- Un-comment when authorization is implemented -->
<intercept-url pattern="/**" access="isAuthenticated()"/>
<form-login authentication-failure-handler-ref="failureHandler"
authentication-success-handler-ref="successHandler" />
<intercept-url pattern="/**" />
<logout logout-success-url="${login.page.url}" />
</http>
<authentication-manager alias="authenticationManager">
<authentication-provider>
<password-encoder ref="encoder" />
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select gu.email, gu.password, gu.enabled from global_user gu,global_organization_user gou, global_organization go where email=? and gu.enabled=1 and gu.is_deleted=0 and gou.user_id = gu.id and gou.organization_id=go.id and go.current_stage='ACTIVE' and go.is_deleted=0"
authorities-by-username-query="select u.email, r.role_id from global_user u, security_user_role r
where u.id = r.user_id and u.email=?" />
</authentication-provider>
</authentication-manager>
<beans:bean id="encoder"
class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder" />
<beans:bean id="successHandler"
class="app.server.security.authentication.AuthenticationSuccessHandler" />
<beans:bean id="failureHandler"
class="app.server.security.authentication.AuthenticationFailureHandler" />
<beans:bean id="expressionHandler"
class="app.server.security.authorization.CustomMethodSecurityExpressionHandler">
<beans:property name="permissionEvaluator" ref="authorizationEvaluator">
</beans:property>
</beans:bean>
<beans:bean id="authorizationEvaluator"
class="app.server.security.authorization.AuthorizationEvaluator" />
<global-method-security pre-post-annotations="enabled">
<expression-handler ref="expressionHandler" />
</global-method-security>
<http pattern="/rest/app/someurl**" security="none"/>
// other URLs which are escaped from spring security
感谢任何建议和指点。
【问题讨论】:
标签: java spring jsp spring-security payment-gateway