0
我尝试将安全性添加到其他应用程序。未授权访问弹簧安全
我配置我的课谁扩展WebSecurityConfigurerAdapter。
http.authorizeRequests().antMatchers("/rest/**").authenticated();
http.csrf().disable();
http.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint);
http.formLogin().successHandler(authenticationSuccessHandler);
http.formLogin().failureHandler(authenticationFailureHandler);
我有一个login.html,index.html谁加载(通过jQuery)一些其他HTML文件在index.html。
我试着用卷曲
curl -i -X POST -d username=test -d password=test http://localhost:8080/rest/cities
访问服务,我收到了
HTTP/1.1 401 Unauthorized
与其余所有URL被固定,但我提供的用户名和密码应字。
当我调试时,我看到,然后我的类实现UserDetailsService谁拥有方法loadUserByUsername永远不会被调用。
有些人不正确地做链接。
感谢工作,只需要看看有没有办法保护我的html文件。 –