Fai*_*zal 2 java cors spring-boot stormpath
尝试将StormPath与Spring Boot集成,接收多个错误.以下是应用程序设置.
使用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".
Run Code Online (Sandbox Code Playgroud)
感谢帮助.
对于您的问题#2,我们发布了SDK v1.2.2并修复了您现在面临的问题.当组织和/或组映射到应用程序时,会出现此问题.更新库版本将允许您呈现login页面.
至于#3你有两个选择要么禁用CORS过滤器stormpath.web.cors.enabled = false或PostMap添加origin标题到允许列表中originUris即stormpath.web.cors.allowed.originUris = <origin-header-value>.
如果你想深入了解CORS,你可能会对Stormpath Evangelists之一的Stormpath文章中的AngularJS和Spring Boot的博客提示和技巧感兴趣.
希望这可以帮助,
何塞路易斯
完全披露:我是Stormpath的工程师之一.
| 归档时间: |
|
| 查看次数: |
618 次 |
| 最近记录: |