首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >集成Angular 5 App和Spring boot。Spring安全屏蔽应用程序

集成Angular 5 App和Spring boot。Spring安全屏蔽应用程序
EN

Stack Overflow用户
提问于 2018-05-22 15:41:48
回答 1查看 108关注 0票数 0

我已经将构建的angular应用程序添加到资源下的静态文件夹中。当我转到localhost:8080时,应用程序没有显示。我如何配置spring安全,只允许angular 5应用通过。

我的Http配置:

代码语言:javascript
运行
复制
http
            .cors()
                .and()
            .csrf()
                .disable()
            .exceptionHandling()
                .authenticationEntryPoint(unauthorizedHandler)
                .and()
            .sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                .and()
            .authorizeRequests()
                .antMatchers("/auth/**").permitAll()
                .antMatchers("/h2-console/**").permitAll()
                .antMatchers("/users/checkUsernameAvailability",
                        "/users/checkEmailAvailability")
                    .permitAll()
                .anyRequest().authenticated();
EN

回答 1

Stack Overflow用户

发布于 2018-05-22 15:47:53

您拥有以下内容:

代码语言:javascript
运行
复制
.anyRequest().authenticated();

因此,如果您没有登录,Spring Security将阻止对根目录http://localhost:8080的访问。

尝试登录并添加以下行。

代码语言:javascript
运行
复制
.antMatchers("/**").permitAll()

以上代码行必须仅用于测试。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50462303

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档