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.
From: Vibhatha Abeykoon [mailto:[email protected]] Sent: Wednesday, March 16, 2016 10:59 PM To: CAS Community <[email protected]> Cc: [email protected] Subject: Re: [cas-user] Spring XML to Java Configuration Conversion Hi, I want to know whether the conversion from xml to java configuration will work fine with spring boot? I am working on migrating the current implemented CAS system from xml configuration to Java configuration. I have completed about 80% of the conversion and currently both applicationContext-security.xml and AppConfig.java are supporting the configurations. I am not really sure whether my effort is successful or not. Please give me any guidelines or any kind of documentation to work CAS configuration with Java Configuration in Spring. On Tuesday, March 15, 2016 at 1:44:00 PM UTC+5:30, Misagh Moayyed wrote: You need to contact Spring/Spring Security forums. From: [email protected] <javascript:> [mailto:[email protected] <javascript:> ] On Behalf Of Vibhatha Abeykoon Sent: Monday, March 14, 2016 10:27 PM To: CAS Community <[email protected] <javascript:> > Subject: [cas-user] Spring XML to Java Configuration Conversion Hey, I am trying to convert my applicationContext-security.xml to java configuration when setting up CAS. Here is the current converted Java Config file. 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(); ... -- 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 [email protected]. Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
