Tag: http basic authentication

使用具有不同AuthenticationProviders的多个WebSecurityConfigurerAdapter(用于Web应用程序的API和LDAP的基本身份validation)

根据Spring Security Reference 5.7节 ,应该可以定义多个安全适配器。 我尝试做同样但没有成功。 在服务器重新启动之后,API的前x次正常使用基本身份validation,但是经过几次我被重定向到登录(表单)页面,这应该只针对我们的Web应用程序,而不是API调用。 我的代码: @EnableWebSecurity public class MultiHttpSecurityConfig { @Configuration @Order(1) public static class ApiWebSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter { @Autowired private Environment env; @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication(). withUser(“admin”).password(“pw_test”).roles(API_ROLE); } protected void configure(HttpSecurity http) throws Exception { http .antMatcher(“/services/**”) .authorizeRequests() .anyRequest().hasRole(API_ROLE) .and() .httpBasic() .and() .csrf() .disable(); } } […]

Spring Security HTTP基本身份validation

我正在尝试使用Spring Security进行非常简单的基本身份validation。 我已正确配置命名空间,服务器中没有例外。 在我的“servlet.xml”中,我获得了Spring Security的下一个: 它几乎都是完美的:非POST的方法不会提示任何登录表单, POST方法会提示它。 问题是,既不是cucu ,也不是bob可以登录那里。 任何人都可以看到我做错了什么? 提前致谢! 😉

Selenium – 通过URL进行基本身份validation

在我的Selenium-Test (使用chromedriver-2.24 )中,我尝试使用以下语句通过基本身份validation访问我的网页: WebDriver driver = …; driver.get(“http://admin:admin@localhost:8080/project/”); 但谷歌Chrome在控制台中给出了以下警告: [弃用]其URL包含嵌入凭据(例如https://user:pass@host/ )的子资源请求被阻止。 有关详细信息,请参阅https://www.chromestatus.com/feature/5669008342777856 。 在标记的链接中提到支持被删除: 在子资源请求中删除对嵌入式凭据的支持。 (已删除) 我现在的问题是,还有另一种从Selenium进行基本身份validation的方法吗? 注意 :这没有帮助: 如何使用Java处理Selenium Webdriver中的HTTP Basic Auth头?