06-27-2016 03:45 AM
@Configuration
protected static class AuthConfig extends WebSecurityConfigurerAdapter {
@Value('${authn.authnUrl}')
private String authnUrl;
@Value('${authn.clientId}')
private String clientId;
@Value('${authn.privateKeyPath}')
private String privateKeyPath;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(new PreAuthAuthenticationProvider());
}
@Override
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.addFilterBefore(authnFilter(), SecurityContextPersistenceFilter.class)
.addFilterAfter(preAuthFilter(), LogoutFilter.class)
.exceptionHandling()
.authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint('/login'));
}
private Filter preAuthFilter() throws Exception {
PreAuthProcessingFilter filter = new PreAuthProcessingFilter();
filter.setAuthenticationManager(authenticationManager());
return filter;
}
private Filter authnFilter() {
return new AuthnFilterBuilder()
.setAuthnUrl(authnUrl)
.setClientId(clientId)
.setPrivateKeyPath(privateKeyPath)
.enableSystemAuth()
.enableUIAuth()
.build();
}
}
06-27-2016 05:13 AM
06-27-2016 06:08 AM
09-29-2016 01:38 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.