身份验证后开始方法执行



我使用Angluar作为客户端,Spring Boot作为服务器。 某些提供程序将在特定(获取/发布(终结点中直接调用我的服务器。如果用户经过身份验证,方法的执行将正常启动,如果没有用户被重定向到登录-ui(angluar-client(,成功登录后用户被重定向到主页,但我想开始执行以前的请求(获取/发布单点登录服务帖子(。我该如何解决这个问题?

 @PostMapping(value = ["/sso"])
    fun singleSignOnServicePost(
            request: HttpServletRequest,
            response: HttpServletResponse,
            authentication: Authentication,
            @RequestParam(value = "SAMLRequest") samlRequest: String) {
       //.......
}
 override fun configure(http: HttpSecurity) {
        http
                .csrf().disable()
                .exceptionHandling().authenticationEntryPoint(LoginUrlFilter("https://xxxx/login"))
                .and()
                .requestMatchers()
                .antMatchers(LOGIN_ENDPOINT_SUFFIX)
                .antMatchers(OAUTH_AUTHORIZATION_ENDPOINT_SUFFIX)
                .antMatchers(SAML_ENDPOINT_SUFFIX)
                .antMatchers(TWO_FACTOR_DEVICE_SETUP)
                .and()
                .formLogin().loginPage()(LOGIN_ENDPOINT_SUFFIX).permitAll().successHandler( authenticationSuccessHandler)
}
在重定向

到 Angular 的用户登录之前,使用 LocalStorage 来存储请求的端点。

(或(

在服务器端创建session并将请求的端点存储在session中,然后执行authentication

使用存储在 session/LocalStorage 中的值命中终结点。

最新更新