Updates for Security snapshots

This commit is contained in:
Dave Syer 2013-05-18 16:38:48 +01:00
parent ab121dc91b
commit bd5fea0d8c

View File

@ -30,9 +30,8 @@ import org.springframework.security.authentication.DefaultAuthenticationEventPub
import org.springframework.security.authentication.ProviderManager; import org.springframework.security.authentication.ProviderManager;
import org.springframework.security.config.annotation.authentication.AuthenticationBuilder; import org.springframework.security.config.annotation.authentication.AuthenticationBuilder;
import org.springframework.security.config.annotation.web.EnableWebSecurity; import org.springframework.security.config.annotation.web.EnableWebSecurity;
import org.springframework.security.config.annotation.web.ExpressionUrlAuthorizations;
import org.springframework.security.config.annotation.web.HttpConfigurator; import org.springframework.security.config.annotation.web.HttpConfigurator;
import org.springframework.security.config.annotation.web.SpringSecurityFilterChainBuilder.IgnoredRequestRegistry; import org.springframework.security.config.annotation.web.WebSecurityConfiguration;
import org.springframework.security.config.annotation.web.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.WebSecurityConfigurerAdapter;
/** /**
@ -70,24 +69,18 @@ public class SecurityConfiguration {
@Autowired @Autowired
private AuthenticationEventPublisher authenticationEventPublisher; private AuthenticationEventPublisher authenticationEventPublisher;
@Override
protected void ignoredRequests(IgnoredRequestRegistry ignoredRequests) {
ignoredRequests.antMatchers(this.healthzPath);
ignoredRequests.antMatchers(this.infoPath);
}
@Override
protected void authorizeUrls(ExpressionUrlAuthorizations interceptUrls) {
interceptUrls.antMatchers("/**").hasRole("USER");
}
@Override @Override
protected void configure(HttpConfigurator http) throws Exception { protected void configure(HttpConfigurator http) throws Exception {
http.antMatcher("/**").httpBasic().and().anonymous().disable(); http.antMatcher("/**").httpBasic().and().anonymous().disable();
if (this.security.isRequireSsl()) { if (this.security.isRequireSsl()) {
http.requiresChannel().antMatchers("/**").requiresSecure(); http.requiresChannel().antMatchers("/**").requiresSecure();
} }
http.authorizeUrls().antMatchers("/**").hasRole("USER");
}
@Override
public void configure(WebSecurityConfiguration builder) throws Exception {
builder.ignoring().antMatchers(this.healthzPath, this.infoPath);
} }
@Override @Override