use of org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter in project spring-boot by spring-projects.
the class OAuth2SsoCustomConfiguration method postProcessAfterInitialization.
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (this.configType.isAssignableFrom(bean.getClass()) && bean instanceof WebSecurityConfigurerAdapter) {
ProxyFactory factory = new ProxyFactory();
factory.setTarget(bean);
factory.addAdvice(new SsoSecurityAdapter(this.applicationContext));
bean = factory.getProxy();
}
return bean;
}
use of org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter in project cas by apereo.
the class CasConfigurationServerWebApplication method casConfigurationServerWebSecurityConfigurerAdapter.
/**
* Cas configuration server web security configurer adapter.
*
* @param serverProperties the server properties
* @return the web security configurer adapter
*/
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public WebSecurityConfigurerAdapter casConfigurationServerWebSecurityConfigurerAdapter(final ServerProperties serverProperties) {
return new WebSecurityConfigurerAdapter() {
@Override
protected void configure(final HttpSecurity http) throws Exception {
val path = serverProperties.getServlet().getContextPath();
http.authorizeRequests().antMatchers(path + "/decrypt/**").authenticated().and().csrf().disable();
http.authorizeRequests().antMatchers(path + "/encrypt/**").authenticated().and().csrf().disable();
super.configure(http);
}
};
}
Aggregations