Java Spring安全:来自外部网站的呼叫无法重定向到我们的应用程序
我们正在开发一个基于Spring的web应用程序,它使用SpringSecurity3.2.3。我们正在与外部支付网关(Java Spring安全:来自外部网站的呼叫无法重定向到我们的应用程序,java,spring,jsp,spring-security,payment-gateway,Java,Spring,Jsp,Spring Security,Payment Gateway,我们正在开发一个基于Spring的web应用程序,它使用SpringSecurity3.2.3。我们正在与外部支付网关(Paytm)集成,以接受用户的支付。以下是我们面临问题的场景: 用户登录到应用程序(这是一个HTTPnon-s应用程序)并单击一个按钮 将他重定向到支付网关(Paytmpayment gateway-它是HTTPSurl) 对于Paytm集成,我们配置了一个回调URL,即我们应用程序的索引页(例如http://server:port/app/index.jsp)。用户完成支付,
Paytm
)集成,以接受用户的支付。以下是我们面临问题的场景:
HTTP
non-s应用程序)并单击一个按钮
将他重定向到支付网关(Paytm
payment gateway-它是HTTPS
url)Paytm
集成,我们配置了一个回调URL,即我们应用程序的索引页(例如http://server:port/app/index.jsp
)。用户完成支付,并将控件重定向回Spring应用程序李>
Paytm
尝试调用我们应用程序的索引页面时(例如http://server:port/app/index.jsp
),它失败了,在Chrome调试器中,我们可以看到一个403禁止
响应Mozilla Firexfox
和IE 11
中运行良好。这个问题只出现在googlechrome
和Opera
浏览器中https://google.com
),重定向成功<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
//从spring安全性转义的其他URL
感谢您的建议和指点。通过将支付网关响应重定向到中间URL(我们创建了一个单独的web项目并提供了其链接),可以暂时解决此问题。然后,这个中间URL将控件重定向到我们的Spring应用程序。这个问题也在我的本地主机站点上使用https解决了。
添加SSL证书并试用。面临与op类似的问题,但我们通过将回调URL配置为使用https而不是http来解决此问题。但是,这可能不适用于所有人,因为每个支付网关都有不同的安全控制。希望这有帮助