简体   繁体   English

StormPath Spring Boot集成-收到无效的CORS请求错误

[英]StormPath Spring Boot Integration - getting Invalid CORS request error

Trying to integrate the StormPath with Spring Boot receiving multiple errors. 尝试将StormPath与Spring Boot集成,从而收到多个错误。 Following here is the application setup. 接下来是应用程序设置。

Using stormpath-default-spring-boot-starter version 1.2.1. 使用stormpath-default-spring-boot-starter版本1.2.1。

1) application.properties contains only stormpath id, secret and href as follows,

stormpath.client.apiKey.id = <id>
stormpath.client.apiKey.secret = <secret>
stormpath.application.href = <href>

2) SpringSecurityWebAppConfig.Java (Override spring security)

@Configuration
public class SpringSecurityWebAppConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.apply(stormpath());
    }
}

When application is run,
------------------------
1) http://localhost:8080/register renders register screen. 

2) http://localhost:8080/login (GET) throws error "Unable to invoke StormPath controller: Resolved account store cannot be an Organization".

3) http://localhost:8080/login (POST)  (from PostMan) throws error "Invalid CORS request".

Appreciate the help. 感谢帮助。

For your problem #2 we released the SDK v1.2.2 and fixed the issue you're facing now. 针对您的问题2,我们发布了SDK v1.2.2,并修复了您现在面临的问题。 When organizations and/or groups were mapped to an application this problem occurred. 当组织和/或组映射到应用程序时,会发生此问题。 Updating the library version will allow you to render the login page. 更新库版本将允许您呈现login页面。

As for #3 you have two options either to disable the CORS filter stormpath.web.cors.enabled = false or add the PostMap origin header to the list of allowed originUris ie stormpath.web.cors.allowed.originUris = <origin-header-value> . 对于#3,您有两个选择来禁用CORS过滤器stormpath.web.cors.enabled = false或将PostMap origin标头添加到允许的originUris列表中,即stormpath.web.cors.allowed.originUris = <origin-header-value>

In case you want to dig in more about CORS you might be interested in checking the blog Tips and Tricks for AngularJS and Spring Boot with Stormpath article from one of Stormpath Evangelists. 如果您想进一步了解CORS,则可能有兴趣查看其中一位Stormpath福音派博客关于AngularJS和Spring Boot with Stormpath的技巧和窍门

Hope this helps, 希望这可以帮助,

José Luis 何塞·路易斯

Full disclosure: I am one of Stormpath's Engineers. 全面披露:我是Stormpath的工程师之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM