use of com.evolveum.midpoint.authentication.impl.filter.MidpointAnonymousAuthenticationFilter in project midpoint by Evolveum.
the class RemoteModuleWebSecurityConfigurer method createAnonymousFilter.
@Override
protected AnonymousAuthenticationFilter createAnonymousFilter() {
AnonymousAuthenticationFilter filter = new MidpointAnonymousAuthenticationFilter(authRegistry, authChannelRegistry, PrismContext.get(), UUID.randomUUID().toString(), "anonymousUser", AuthorityUtils.createAuthorityList("ROLE_ANONYMOUS")) {
@Override
protected void processAuthentication(ServletRequest req) {
if (SecurityContextHolder.getContext().getAuthentication() instanceof MidpointAuthentication) {
MidpointAuthentication mpAuthentication = (MidpointAuthentication) SecurityContextHolder.getContext().getAuthentication();
ModuleAuthenticationImpl moduleAuthentication = (ModuleAuthenticationImpl) mpAuthentication.getProcessingModuleAuthentication();
if (moduleAuthentication != null && (moduleAuthentication.getAuthentication() == null || getAuthTokenClass().isAssignableFrom(moduleAuthentication.getAuthentication().getClass()))) {
Authentication authentication = createBasicAuthentication((HttpServletRequest) req);
moduleAuthentication.setAuthentication(authentication);
mpAuthentication.setPrincipal(authentication.getPrincipal());
}
}
}
};
filter.setAuthenticationDetailsSource(new RemoteAuthenticationDetailsSource(getAuthTokenClass()));
return filter;
}
Aggregations