package it.codegen.auth.cas.config;
import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Qualifier;import org.springframework.beans.factory.annotation.Value;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.context.annotation.ImportResource;import org.springframework.context.annotation.PropertySource;import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;import org.springframework.web.filter.RequestContextFilter;import com.sun.jna.platform.win32.Netapi32Util.User;import it.codegen.auth.cas.BasePermissionEvaluator;import java.util.ArrayList;import java.util.List;import java.util.Properties;import org.jasig.cas.client.session.SingleSignOutFilter;import org.springframework.security.web.authentication.logout.LogoutFilter;import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;import org.springframework.security.cas.ServiceProperties;import org.springframework.security.cas.web.CasAuthenticationEntryPoint;import org.springframework.security.cas.web.CasAuthenticationFilter;import it.codegen.auth.cas.TbxFilterSecurityMetadataSource;import it.codegen.auth.cas.CustomWebSecurityExpressionHandler;import it.codegen.auth.cas.TbxMethodSecurityExpressionHandler;import org.springframework.security.access.AccessDecisionVoter;import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler;import org.springframework.security.access.vote.AffirmativeBased;import org.springframework.security.access.vote.RoleVoter;import org.springframework.security.authentication.AuthenticationManager;import org.springframework.security.authentication.ProviderManager;import org.springframework.security.access.vote.AuthenticatedVoter;import org.springframework.security.cas.web.authentication.ServiceAuthenticationDetailsSource;import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;import org.springframework.security.config.annotation.web.builders.HttpSecurity;import org.springframework.security.config.annotation.web.builders.WebSecurity;import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;import org.springframework.security.core.Authentication;import org.springframework.security.core.AuthenticationException;import org.springframework.security.cas.authentication.CasAuthenticationProvider;import it.codegen.auth.cas.UserPrincipleHandler;import org.jasig.cas.client.validation.Cas20ProxyTicketValidator;import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;import net.sf.ehcache.Cache;import net.sf.ehcache.CacheManager;import org.springframework.security.cas.authentication.EhCacheBasedTicketCache;import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;import org.springframework.security.cas.web.CasAuthenticationFilter;import org.springframework.security.cas.web.authentication.ServiceAuthenticationDetailsSource;import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
/* * The purpose of this class is to replace the functionality of the applicationContext-security.xml * * */
@Configuration@EnableWebSecurity@ImportResource({"/WEB-INF/applicationContext-security.xml"})@PropertySource("classpath:application.properties")@EnableGlobalMethodSecurity(securedEnabled = true)public class AppConfig extends WebSecurityConfigurerAdapter { private String CAS_SERVICE_HOST="localhost:9443"; private final String LOGOUT_SUCCESSFUL_URL ="https://"+CAS_SERVICE_HOST+"/cas/logout"; private final String FILTER_PROCESS_URL="/logout/cas"; private final String SERVICE_URL="https://"+CAS_SERVICE_HOST+"/AuthAPI/login/cas"; private final String LOGIN_URL="https://"+CAS_SERVICE_HOST+"/cas/login"; private final String MODULE_PERMISSION_URL = "http://192.168.1.210:8080/TravelBoxAdminService/REST/admin/getModulePermissions"; private final String CAS20_TICKET_URL ="https://"+CAS_SERVICE_HOST+"/cas"; private final String FAILURE_URL="/casfailed.jsp"; @Bean public RequestContextFilter requestContextFilter(){ return new RequestContextFilter(); } @Bean public BasePermissionEvaluator permissionEvaluator(){ return new BasePermissionEvaluator(); } @Bean public SingleSignOutFilter singleLogoutFilter(){ return new SingleSignOutFilter(); } @Bean public LogoutFilter requestSingleLogoutFilter (){ LogoutFilter logoutFilter = new LogoutFilter(LOGOUT_SUCCESSFUL_URL,new SecurityContextLogoutHandler()); logoutFilter.setFilterProcessesUrl(FILTER_PROCESS_URL); return logoutFilter; } @Bean public ServiceProperties serviceProperties(){ ServiceProperties serviceprop = new ServiceProperties(); serviceprop.setService(SERVICE_URL); serviceprop.setAuthenticateAllArtifacts(true); return serviceprop; } @Bean public CasAuthenticationEntryPoint casEntryPoint(){ CasAuthenticationEntryPoint casAuthenticationEntryPoint = new CasAuthenticationEntryPoint(); casAuthenticationEntryPoint.setServiceProperties(serviceProperties()); casAuthenticationEntryPoint.setLoginUrl(LOGIN_URL); return casAuthenticationEntryPoint; } @Bean public TbxFilterSecurityMetadataSource tbxSecurityMetadataSource(){ TbxFilterSecurityMetadataSource tbxsms = new TbxFilterSecurityMetadataSource(null); tbxsms.setServiceUrl(MODULE_PERMISSION_URL); return tbxsms; } @Bean public CustomWebSecurityExpressionHandler webExpressionHandler(){ CustomWebSecurityExpressionHandler cwebse = new CustomWebSecurityExpressionHandler(); cwebse.setPermissionEvaluator(permissionEvaluator()); return cwebse; } @Bean public TbxMethodSecurityExpressionHandler tbxexpressionHandler(){ TbxMethodSecurityExpressionHandler tbxmseh = new TbxMethodSecurityExpressionHandler(); tbxmseh.setPermissionEvaluator(permissionEvaluator()); return tbxmseh; } @SuppressWarnings("null") @Bean public AffirmativeBased affirmativeBasedAccessDecisionManager(){ List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<AccessDecisionVoter<? extends Object>>(); RoleVoter rv = new RoleVoter(); rv.setRolePrefix(""); AuthenticatedVoter av = new AuthenticatedVoter(); decisionVoters.add(rv); decisionVoters.add(av); AffirmativeBased affirmativeBased = new AffirmativeBased(decisionVoters); return affirmativeBased; } @Bean public CasAuthenticationProvider casAuthProvider(){ CasAuthenticationProvider cap = new CasAuthenticationProvider(); cap.setServiceProperties(serviceProperties()); cap.setKey("poc_sample_cas"); cap.setAuthenticationUserDetailsService(userService()); cap.setTicketValidator(cas20TicketValidator()); cap.setStatelessTicketCache(ehCacheTicket()); return cap; } @Bean public UserPrincipleHandler userService(){ UserPrincipleHandler userPrincipleServiceHanlder = new UserPrincipleHandler(); return userPrincipleServiceHanlder; } @Bean public Cas20ProxyTicketValidator cas20TicketValidator(){ Cas20ProxyTicketValidator cas20validator = new Cas20ProxyTicketValidator(CAS20_TICKET_URL); cas20validator.setAcceptAnyProxy(true); return cas20validator; } @Bean public EhCacheManagerFactoryBean ehManager(){ EhCacheManagerFactoryBean ehmanager = new EhCacheManagerFactoryBean(); return ehmanager; } /*Initialize and Dispose Methods are not called*/ @Bean public Cache ehcache(){ Cache ch = new Cache("casTickets",50,true,false,3600,900); ch.setCacheManager(ehManager().getObject()); return ch; } @Bean public EhCacheBasedTicketCache ehCacheTicket(){ EhCacheBasedTicketCache ehCachedTicketCache = new EhCacheBasedTicketCache(); ehCachedTicketCache.setCache(ehcache()); return ehCachedTicketCache; } @Bean public ServiceAuthenticationDetailsSource serviceAuthenticationDataSource(){ ServiceAuthenticationDetailsSource serviceDetailSource = new ServiceAuthenticationDetailsSource(serviceProperties()); return serviceDetailSource; } @Bean public SimpleUrlAuthenticationFailureHandler simpleUrlAuthentication(){ SimpleUrlAuthenticationFailureHandler failureHandler = new SimpleUrlAuthenticationFailureHandler(); failureHandler.setDefaultFailureUrl(FAILURE_URL); return failureHandler; } //authentication manager related beans @Bean public CasAuthenticationFilter casFilter () throws Exception { CasAuthenticationFilter filter = new CasAuthenticationFilter(); filter.setAuthenticationManager(authenticationManagerBean()); filter.setServiceProperties(serviceProperties()); filter.setAuthenticationDetailsSource(serviceAuthenticationDataSource()); filter.setAuthenticationFailureHandler(simpleUrlAuthentication()); return filter; } //authentication-manager related @Bean public FilterSecurityInterceptor tbxFilterSecurityInterceptor() throws Exception{ FilterSecurityInterceptor interceptor = new FilterSecurityInterceptor(); interceptor.setAuthenticationManager(authenticationManagerBean()); interceptor.setAccessDecisionManager(affirmativeBasedAccessDecisionManager()); interceptor.setSecurityMetadataSource(tbxSecurityMetadataSource()); return interceptor; } //authentication manager related configuration // @Override // @Autowired // @Qualifier("org.springframework.security.authenticationManager") /* protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth .authenticationProvider(casAuthProvider()); }*/ @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/","/index.jsp","/cas-logout.jsp","/casfailed.jsp").permitAll() .and() .formLogin() .loginPage("/cas/login") .permitAll() .and() .logout() .logoutUrl("/cas-logout.jsp") .logoutSuccessUrl("/logout-success") .permitAll() .and() .exceptionHandling().accessDeniedPage("/403.jsp") .and() .csrf().disable() // .addFilterBefore(requestSingleLogoutFilter(), LogoutFilter.class) // .addFilterBefore(singleLogoutFilter(), SingleSignOutFilter.class) // .addFilterBefore(requestContextFilter(), RequestContextFilter.class) .addFilterBefore(tbxFilterSecurityInterceptor(), FilterSecurityInterceptor.class) .addFilter(casFilter()) .exceptionHandling().authenticationEntryPoint(casEntryPoint()); // http.addFilterBefore(requestSingleLogoutFilter(), LogoutFilter.class); // http.addFilterBefore(singleLogoutFilter(), SingleSignOutFilter.class); // http.addFilterBefore(requestContextFilter(), RequestContextFilter.class); // http.addFilterBefore(tbxFilterSecurityInterceptor(), FilterSecurityInterceptor.class); // http.addFilter(casFilter()); } @Bean(name="org.springframework.security.authenticationManager") @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } /*The Following Bean replaces the Utilities*/ @Bean public PropertySourcesPlaceholderConfigurer myPropertySourcesPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer p = new PropertySourcesPlaceholderConfigurer(); p.setProperties(properties()); return p; }
public Properties properties() { Properties props = new Properties(); props.setProperty("cas.service.host", "localhost:9443"); props.setProperty("cas.server.host", "localhost:9443"); props.setProperty("admin.server.host", "192.168.1.210"); props.setProperty("admin.server.port", "8080"); props.setProperty("admin.server.restApiPrefix", "TravelBoxAdminService/REST/admin/"); return props; } @Autowired protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth .authenticationProvider(casAuthProvider()); } /*@Override public void init(final WebSecurity web) throws Exception { final HttpSecurity http = getHttp(); web.addSecurityFilterChainBuilder(http).postBuildAction(new Runnable() { public void run() { FilterSecurityInterceptor securityInterceptor = http .getSharedObject(FilterSecurityInterceptor.class); web.securityInterceptor(securityInterceptor); } }); }*/ @Autowired private WebSecurity web; @Override public void configure(WebSecurity web) throws Exception { super.init(web); }
}
<?xml version="1.0" encoding="UTF-8"?><b:beans xmlns:b="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<http entry-point-ref="casEntryPoint" use-expressions="true"> <!-- <intercept-url pattern="/" access="permitAll"/> <intercept-url pattern="/index.jsp" access="permitAll"/> <intercept-url pattern="/cas-logout.jsp" access="permitAll"/> <intercept-url pattern="/casfailed.jsp" access="permitAll"/> -->
<custom-filter ref="requestSingleLogoutFilter" before="LOGOUT_FILTER"/> <custom-filter ref="singleLogoutFilter" before="CAS_FILTER"/> <custom-filter ref="requestContextFilter" before="FIRST"/> <!-- <custom-filter ref="tbxFilterSecurityInterceptor" before="FILTER_SECURITY_INTERCEPTOR"/> <custom-filter ref="casFilter" position="CAS_FILTER" /> --> <!-- <logout logout-success-url="/cas-logout.jsp"/> <csrf disabled="true"/> <access-denied-handler error-page="/403.jsp"/> --> </http> <b:bean id="propertyBean" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <b:property name="locations"> <b:list> <b:value>classpath:application.properties</b:value> <b:value>/WEB-INF/classes/application.properties</b:value> </b:list> </b:property> </b:bean> <!-- Migrated to AppConfig --> <!-- <b:bean id="requestContextFilter" class="org.springframework.web.filter.RequestContextFilter"/> --> <!-- Migrated to AppConfig --> <global-method-security pre-post-annotations="enabled"> <expression-handler ref="tbxexpressionHandler"/> </global-method-security>
<!-- <b:bean id="tbxFilterSecurityInterceptor" class="org.springframework.security.web.access.intercept.FilterSecurityInterceptor"> <b:property name="authenticationManager" ref="authManager"/> <b:property name="accessDecisionManager" ref="affirmativeBasedAccessDecisionManager"/> <b:property name="securityMetadataSource" ref="tbxSecurityMetadataSource"/> </b:bean> --> <!-- Migrated to AppConfig -->
<!-- <b:bean id="tbxSecurityMetadataSource" class="it.codegen.auth.cas.TbxFilterSecurityMetadataSource"> <b:constructor-arg> <util:map /> </b:constructor-arg> --> <!-- <b:property name="serviceUrl" value = "http://192.168.1.210:8080/TravelBoxAdminService/REST/admin/getModulePermissions" /> --> <!-- <b:property name="serviceUrl" value = "${url.modulePermissionService}" /> </b:bean> --> <!-- Migrated to AppConfig -->
<!-- Migrated to AppConfig --> <!-- <b:bean id="affirmativeBasedAccessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased"> <b:constructor-arg> <b:list> <b:bean id="roleVoter" class="org.springframework.security.access.vote.RoleVoter"> <b:property name="rolePrefix" value="" /> </b:bean> <b:bean id="authenticatedVoter" class="org.springframework.security.access.vote.AuthenticatedVoter"/> </b:list> </b:constructor-arg> </b:bean> --> <!-- Migrated to AppConfig --> <!-- <b:bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler"> <b:property name="permissionEvaluator" ref="myPermissionEvaluator"/> </b:bean> --> <!-- Migrated to AppConfig --> <!-- <b:bean id="webExpressionHandler" class="it.codegen.auth.cas.CustomWebSecurityExpressionHandler"> <b:property name="permissionEvaluator" ref="permissionEvaluator"/> </b:bean> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig -->
<!-- <b:bean id="tbxexpressionHandler" class="it.codegen.auth.cas.TbxMethodSecurityExpressionHandler"> <b:property name="permissionEvaluator" ref="permissionEvaluator"/> </b:bean> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig --> <!-- <b:bean id="permissionEvaluator" class="it.codegen.auth.cas.BasePermissionEvaluator"/> --> <!-- Migrated to AppConfig --> <!-- <authentication-manager alias="authManager"> <authentication-provider ref="casAuthProvider" /> </authentication-manager> --> <!-- <b:bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased"> <b:constructor-arg> <b:list> <b:bean id ="voters" class="org.springframework.security.access.vote.RoleVoter"> <b:property name="rolePrefix" value=""/> </b:bean> </b:list> </b:constructor-arg> <b:property name="decisionVoters"> <b:bean class="org.springframework.security.access.vote.RoleVoter"> <b:property name="rolePrefix" value=""/> </b:bean> </b:property> </b:bean> --> <!-- <user-service id="userService" > <user name="rod" password="rod" authorities="ROLE_SUPERVISOR,ROLE_USER" /> <user name="dianne" password="dianne" authorities="ROLE_USER" /> <user name="scott" password="scott" authorities="ROLE_USER" /> <user name="Ruwan" authorities="ROLE_SUPERVISOR,ROLE_USER" /> </user-service> -->
<!-- Migrated to AppConfig -->
<!-- This filter handles a Single Logout Request from the CAS Server --> <!-- <b:bean id="singleLogoutFilter" class="org.jasig.cas.client.session.SingleSignOutFilter"/> --> <!-- Migrated to AppConfig --> <!-- *********************************************************************************************** --> <!-- Migrated to AppConfig --> <!-- This filter redirects to the CAS Server to signal Single Logout should be performed --> <!-- <b:bean id="requestSingleLogoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter" p:filterProcessesUrl="/logout/cas"> <b:constructor-arg value="https://${env.casServiceHost}/cas/logout"/> <b:constructor-arg> <b:bean class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler"/> </b:constructor-arg> </b:bean> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig -->
<!-- <b:bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties" p:service="https://${env.casServiceHost}/AuthAPI/login/cas" p:authenticateAllArtifacts="true"/> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig --> <!-- <b:bean id="casEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint" p:serviceProperties-ref="serviceProperties" p:loginUrl="https://${env.casServiceHost}/cas/login" /> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig --> <!-- <b:bean id="serviceAuthenticationDataSource" class="org.springframework.security.cas.web.authentication.ServiceAuthenticationDetailsSource"> <b:constructor-arg ref="serviceProperties"/> </b:bean> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig --> <!-- <b:bean id="simpleUrlAuthentication" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler" p:defaultFailureUrl="/casfailed.jsp"/> --> <!-- Migrated to AppConfig --> <!-- <b:bean id="casFilter" class="org.springframework.security.cas.web.CasAuthenticationFilter" p:authenticationManager-ref="authManager" p:serviceProperties-ref="serviceProperties"> This property is not used p:proxyGrantingTicketStorage-ref="pgtStorage" p:proxyReceptorUrl="/login/cas/proxyreceptor"> This property is not used <b:property name="authenticationDetailsSource" ref="serviceAuthenticationDataSource"> </b:property> <b:property name="authenticationFailureHandler" ref="simpleUrlAuthentication"> </b:property> </b:bean> --> <!-- This property is not used in the current version --> <!-- NOTE: In a real application you should not use an in memory implementation. You will also want to ensure to clean up expired tickets by calling ProxyGrantingTicketStorage.cleanup() --> <!-- <b:bean id="pgtStorage" class="org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl"/> --> <!-- This property is not used in the current version --> <!-- Inner Beans From casAuthProvider Bean Start --> <!-- Migrated to AppConfig --> <!-- <b:bean id="userService" class="it.codegen.auth.cas.UserPrincipleHandler"> </b:bean> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig --> <!-- <b:bean id="cas20TicketValidator" class="org.jasig.cas.client.validation.Cas20ProxyTicketValidator" p:acceptAnyProxy="true"> This property is not used p:proxyCallbackUrl="https://${cas.service.host}/login/cas/proxyreceptor" p:proxyGrantingTicketStorage-ref="pgtStorage"> This property is not used <b:constructor-arg value="https://${env.casServiceHost}/cas" /> </b:bean> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig --> <!-- <b:bean id="ehManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig --> <!-- <b:bean id="ehcache" class="net.sf.ehcache.Cache" init-method="initialise" destroy-method="dispose"> <b:constructor-arg value="casTickets"/> <b:constructor-arg value="50"/> <b:constructor-arg value="true"/> <b:constructor-arg value="false"/> <b:constructor-arg value="3600"/> <b:constructor-arg value="900"/> <b:property name="cacheManager" ref="ehManager"> </b:property> </b:bean> --> <!-- Migrated to AppConfig --> <!-- Migrated to AppConfig --> <!-- <b:bean id="ehCacheTicket" class="org.springframework.security.cas.authentication.EhCacheBasedTicketCache"> <b:property name="cache" ref="ehcache"> </b:property> </b:bean> --> <!-- Migrated to AppConfig --> <!-- Inner Beans From casAuthProvider Bean End --> <!-- The inner beans are taken outside and referenced inside --> <!-- Migrated to AppConfig --> <!-- <b:bean id="casAuthProvider" class="org.springframework.security.cas.authentication.CasAuthenticationProvider" p:serviceProperties-ref="serviceProperties" p:key="poc_sample_cas"> <b:property name="authenticationUserDetailsService" ref="userService"> </b:property> <b:property name="ticketValidator" ref="cas20TicketValidator"> </b:property> <b:property name="statelessTicketCache" ref="ehCacheTicket"> </b:property> </b:bean> --> <!-- Migrated to AppConfig -->
<!-- Configuration for the environment can be overriden by system properties --> <!-- <context:property-placeholder system-properties-mode="OVERRIDE" properties-ref="environment"/> <util:properties id="environment"> <b:prop key="cas.service.host">localhost:9443</b:prop> <b:prop key="cas.server.host">localhost:9443</b:prop> <b:prop key="admin.server.host">192.168.1.210</b:prop> <b:prop key="admin.server.port">8080</b:prop> <b:prop key="admin.server.restApiPrefix">TravelBoxAdminService/REST/admin/</b:prop> <b:prop key="cas.service.host">${env.casServiceHost}</b:prop> <b:prop key="cas.server.host">${env.casServerHost}</b:prop> <b:prop key="admin.server.host">${env.adminServerHost}</b:prop> <b:prop key="admin.server.port">${env.adminServerPort}</b:prop> <b:prop key="admin.server.restApiPrefix">${env.adminServerRestApiPrefix}</b:prop> </util:properties> --></b:beans>
SEVERE: Exception sending context initialized event to listener instance
of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'org.springframework.security.filterChainProxy': Cannot
resolve reference to bean 'org.springframework.security.filterChains'
while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'org.springframework.security.filterChains': Cannot
resolve reference to bean
'org.springframework.security.web.DefaultSecurityFilterChain#0' while
setting bean property 'sourceList' with key [0]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name
'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot
create inner bean '(inner bean)#724fe50a' of type
[org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter]
while setting constructor argument with key [8]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name '(inner bean)#724fe50a': Cannot resolve reference to bean
'org.springframework.security.authentication.ProviderManager#0' while
setting bean property 'authenticationManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name
'org.springframework.security.authentication.ProviderManager#0': Cannot
resolve reference to bean
'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0'
while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name
'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0':
FactoryBean threw exception on object creation; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'org.springframework.security.authenticationManager'
defined in it.codegen.auth.cas.config.AppConfig: Bean instantiation via
factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.security.authentication.AuthenticationManager]:
Factory method 'authenticationManagerBean' threw exception; nested
exception is java.lang.IllegalArgumentException: delegateBuilder cannot
be null
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at
org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:634)
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:140)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:835)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
at
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1090)
at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1900)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
You need to contact Spring/Spring Security forums.
--
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
...
If you are asking whether you can configure a CAS instance via spring boot and java rather than XML, then the answer is yes you can. There is no CAS documentation for this sort of thing. Consult Spring boot’s docs and Spring in general.