Spring Security:如何获取初始目标URL [英] Spring Security: How to get the initial target url

查看:202
本文介绍了Spring Security:如何获取初始目标URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Spring Security来限制URL.我正在尝试在同一页面上提供注册和登录页面.

I am using the spring security to restricted urls. I am trying to provide signup and login page, on the same page.

在登录时,spring安全性会转移到受限页面.但是,我正在尝试将目标网址传递给注册过程,以便注册后我们可以重定向到受限制的页面.

On login spring security transfers to the restricted page. However i am trying to pass the target url to the signup process, so that after signup we can redirect to the restricted page.

如何获取重定向用户的实际URL.

How to get the actual URL that user was redirected from.

有什么想法吗?

推荐答案

这是我从Spring Security获得URL的方式.

This is how i got the URL from the Spring Security.


SavedRequest savedRequest = (SavedRequest)session.getAttribute(
    AbstractProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY);
String requestUrl = savedRequest.getFullRequestUrl();

这篇关于Spring Security:如何获取初始目标URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆