草庐IT

HttpSecurity

全部标签

java - HttpSecurity 配置 - permitall 仍然需要基本身份验证

我正在尝试向我的应用程序添加一个不安全的Controller端点/foo/bar,但每当我尝试调用它时,我都会收到401Unauthorized。这是我的WebSecurityConfigurerAdapter:http.authorizeRequests().antMatchers("/foo/**").permitAll().and().formLogin().loginPage("/login").permitAll().and().requestMatchers().antMatchers("/login","/oauth/authorize","/oauth/confirm_

java - Spring 安全 : hasAuthority is ignored when configured globally for HttpSecurity

我在带有OAuth2的SpringMVC上有一个RESTAPI。为了支持像hasRole和hasAuthority这样的表达式处理程序,我添加了以下配置:@Configuration@EnableGlobalMethodSecurity(prePostEnabled=true)publicclassMethodSecurityConfigextendsGlobalMethodSecurityConfiguration{@OverrideprotectedMethodSecurityExpressionHandlercreateExpressionHandler(){returnnewO

Spring Security HttpSecurity 配置测试

我有一个SpringBoot+SpringSecurity应用程序,它有几个antMatchers路径;一些fullyAuthenticated(),一些permitAll()。如何编写一个测试来验证SecurityConfiguration我的端点在/api/**下(以及最终其他)是否得到正确保护?publicclassSecurityConfigurationextendsWebSecurityConfigurerAdapter{protectedvoidconfigure(HttpSecurityhttp)throwsException{http//....antMatchers

Spring Security HttpSecurity 配置测试

我有一个SpringBoot+SpringSecurity应用程序,它有几个antMatchers路径;一些fullyAuthenticated(),一些permitAll()。如何编写一个测试来验证SecurityConfiguration我的端点在/api/**下(以及最终其他)是否得到正确保护?publicclassSecurityConfigurationextendsWebSecurityConfigurerAdapter{protectedvoidconfigure(HttpSecurityhttp)throwsException{http//....antMatchers

Spring Security 使用 HttpSecurity 授权对 url 和方法的请求

有没有办法使用org.springframework.security.config.annotation.web.builders.HttpSecurity授权对特定url的发布请求?我正在使用HttpSecurity作为:@Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.addFilterAfter(newCsrfCookieGeneratorFilter(),CsrfFilter.class).exceptionHandling().authenticationEntryPoint(auth

Spring Security 使用 HttpSecurity 授权对 url 和方法的请求

有没有办法使用org.springframework.security.config.annotation.web.builders.HttpSecurity授权对特定url的发布请求?我正在使用HttpSecurity作为:@Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.addFilterAfter(newCsrfCookieGeneratorFilter(),CsrfFilter.class).exceptionHandling().authenticationEntryPoint(auth