Cemal,
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.regexMatchers("/desktop/.*","/desktop?.*","/login.*")
.authenticated()
.and()
.authorizeRequests()
.regexMatchers("/")
.permitAll()
.and()
.httpBasic()
.authenticationEntryPoint(authenticationEntryPoint)
.and()
.logout().logoutSuccessUrl("/logout")
.and()
.addFilterBefore(singleSignOutFilter,
CasAuthenticationFilter.class)
.addFilterBefore(logoutFilter, LogoutFilter.class);
}
@Bean
@Primary
public DynamicRedirectCasAuthenticationEntryPoint
authenticationEntryPoint(
ServiceProperties sP) {
DynamicRedirectCasAuthenticationEntryPoint entryPoint
= new DynamicRedirectCasAuthenticationEntryPoint();
entryPoint.setLoginUrl("https://casserver/cas/login");
entryPoint.setServiceProperties(sP);
return entryPoint;
}
@Bean
public CasAuthenticationProvider casAuthenticationProvider() {
CasAuthenticationProvider provider = new
CasAuthenticationProvider();
provider.setServiceProperties(serviceProperties());
provider.setTicketValidator(ticketValidator());
provider.setUserDetailsService(
s -> new User("colinr", "Mellon", true, true, true, true,
AuthorityUtils.createAuthorityList("ROLE_ADMIN")));
provider.setKey("CAS_PROVIDER_LOCALHOST_9000");
return provider;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws
Exception {
auth.authenticationProvider(authenticationProvider);
}
@Override
protected AuthenticationManager authenticationManager() throws
Exception {
return new ProviderManager(Arrays.asList(authenticationProvider));
}
@Bean
public CasAuthenticationFilter
casAuthenticationFilter(ServiceProperties sP) throws Exception {
CasAuthenticationFilter filter = new CasAuthenticationFilter();
filter.setServiceProperties(sP);
filter.setAuthenticationManager(authenticationManager());
return filter;
}
On 2019-12-24 2:37 a.m., Cemal Önder wrote:
Ryan,
How do you configure your CasAuthenticationFilter? Do you configure
AuthenticationManager? Here is an example:
|
.addFilterBefore(casAuthenticationFilter(),.....)
|
|
privateCasAuthenticationFiltercasAuthenticationFilter()
{
CasAuthenticationFilterauthenticationFilter =newCasAuthenticationFilter();
authenticationFilter.setAuthenticationManager(authenticationManager );
returnauthenticationFilter;
}
@Bean
protectedAuthenticationManagerauthenticationManager()
{
returnnewProviderManager(Arrays.asList(casAuthenticationProvider()));
}
@Bean
publicCasAuthenticationProvidercasAuthenticationProvider()
{
finalCasAuthenticationProviderprovider =newCasAuthenticationProvider();
provider.setServiceProperties(serviceProperties );
provider.setKey("CAS_DUMMY_KEY");
returnprovider;
}
|
--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
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]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/a/apereo.org/d/msgid/cas-user/879c0016-b851-436a-877d-b08d2a05ccb8%40apereo.org
<https://groups.google.com/a/apereo.org/d/msgid/cas-user/879c0016-b851-436a-877d-b08d2a05ccb8%40apereo.org?utm_medium=email&utm_source=footer>.
--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
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].
To view this discussion on the web visit
https://groups.google.com/a/apereo.org/d/msgid/cas-user/9dc35075-3e08-c0a9-37e2-c840a19ced06%40caveo.ca.