我有一个springboot应用程序,它根据LDAP验证身份验证。我通过邮递员测试了它,它工作得很好。我扩展了WebSecurityConfigurerAdapter以根据LDAP验证登录凭据。这是工作很好,没有任何问题。我有一个angular前端,我调用/login,并将用户名和密码发送到它。它没有工作,我得到一个CORs错误。我将下面的代码添加到application.java中,我再也看不到CORs错误了。
@Bean
public WebMvcConfigurer corsConfigurer()
{
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedMethods("*").allowedOrigins("*");
}
};
}
但是,我仍然得到了401未经授权的/login调用,而不是CORs错误。我不确定我在这里错过了什么。有什么能帮我的吗?
Springboot LDap身份验证
@Configuration
@Order(SecurityProperties.IGNORED_ORDER)
@CrossOrigin(origins = "*")
public class ApplicationSecurity extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().permitAll();
http.csrf().disable();
http.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint);
http.formLogin().successHandler(authenticationSuccessHandler);
http.formLogin().failureHandler(authenticationFailureHandler);
}
@SuppressWarnings("deprecation")
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.userDnPatterns("uid={0},ou=people")
.groupSearchBase("ou=groups")
.contextSource()
.url("ldap://localhost:8389/dc=springframework,dc=org")
.and()
.passwordCompare()
.passwordEncoder(new LdapShaPasswordEncoder())
.passwordAttribute("userPassword");
}
}
this.http.post("http://localhost:8080/login", data);
我终于把它修好了。有2个更改使我的代码工作。
return this.http.post(url+ "?username=" + data.username + "&password=" + data.password, "")
我的SpringBoot应用程序中有一个控制器: 我想在mocks的帮助下,将其与服务分开进行测试。如何实施?
尝试在Heroku云中部署Spring Boot应用程序,但编译java应用程序时出现错误,但在我的本地计算机中运行良好。
喂,伙计们! 这是我的第一次,所以我会尽力做到最好。 我想创建一个应用程序,它是运行与Springboot框架,我想把它连接到一个docker容器嵌入MySQL(但Spring启动应用程序不是运行在docker) 所以我一直关注这个帖子 我已经做了我的docker-comact: 我用这个命令运行它: 一切都很好,所以现在我在Spring靴上改变application.properties: 但当
如何从播放控制台删除应用程序?有没有办法删除被拒绝的应用程序从谷歌播放开发者控制台?我们如何从Play控制台永久删除草稿应用程序或游戏。
我有一个Angular project web app,在我使用“ng build…”构建它之后,它正在Apache web服务器中成功运行命令现在,我想让它成为Android应用程序,为此,我尝试使用Cordova。首先,我创建了一个Cordova项目,然后在www目录下,我放置了来自NG的文件。是的,在那之前我还使用了Cordova平台add android。但是,当我在模拟器或真实设备上安装
我的OpenShift 4.5. x安装中的控制台用户界面神秘地停止工作。现在访问控制台URL会导致消息: 应用程序不可用 应用程序当前未在此终结点处为请求提供服务。它可能尚未启动或仍在启动。 如果路由存在但找不到相应的服务或pod,通常会看到这一点,但在这种情况下,路由存在: 该服务存在: 豆荚存在并且健康: 查看控制台pods的日志,联系oauth服务似乎有问题: 但是 命名空间中的 pod