use of com.evolveum.midpoint.authentication.impl.module.authentication.ModuleAuthenticationImpl in project midpoint by Evolveum.
the class MidpointAnonymousAuthenticationFilter method processAuthentication.
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) {
Authentication authentication = createBasicAuthentication((HttpServletRequest) req);
moduleAuthentication.setAuthentication(authentication);
mpAuthentication.setPrincipal(authentication.getPrincipal());
}
}
}
use of com.evolveum.midpoint.authentication.impl.module.authentication.ModuleAuthenticationImpl in project midpoint by Evolveum.
the class MidpointExceptionTranslationFilter method sendStartAuthentication.
@Override
protected void sendStartAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, AuthenticationException reason) throws ServletException, IOException {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (!AuthSequenceUtil.isRecordSessionLessAccessChannel(request)) {
requestCache.saveRequest(request, response);
}
LOGGER.debug("Calling Authentication entry point.");
getAuthenticationEntryPoint().commence(request, response, reason);
if (authentication instanceof MidpointAuthentication) {
MidpointAuthentication mpAuthentication = (MidpointAuthentication) authentication;
ModuleAuthenticationImpl moduleAuthentication = (ModuleAuthenticationImpl) mpAuthentication.getProcessingModuleAuthentication();
if (moduleAuthentication != null && moduleAuthentication.getAuthentication() instanceof AnonymousAuthenticationToken) {
moduleAuthentication.setAuthentication(createNewAuthentication((AnonymousAuthenticationToken) moduleAuthentication.getAuthentication()));
mpAuthentication.setPrincipal(null);
}
SecurityContextHolder.getContext().setAuthentication(mpAuthentication);
}
}
use of com.evolveum.midpoint.authentication.impl.module.authentication.ModuleAuthenticationImpl in project midpoint by Evolveum.
the class PreLogoutFilter method doFilter.
@Override
public void doFilter(ServletRequest request, ServletResponse response) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
ModuleAuthenticationImpl moduleAuthentication = null;
if (authentication != null && authentication.isAuthenticated()) {
moduleAuthentication = (ModuleAuthenticationImpl) AuthUtil.getAuthenticatedModule();
}
if (authentication == null || ((moduleAuthentication == null || !moduleAuthentication.isInternalLogout()) && !((HttpServletRequest) request).getServletPath().endsWith("/logout"))) {
return;
}
if (moduleAuthentication != null) {
moduleAuthentication.setState(AuthenticationModuleState.LOGOUT_PROCESSING);
}
}
use of com.evolveum.midpoint.authentication.impl.module.authentication.ModuleAuthenticationImpl in project midpoint by Evolveum.
the class HttpClusterModuleFactory method createEmptyModuleAuthentication.
private ModuleAuthenticationImpl createEmptyModuleAuthentication(ModuleWebSecurityConfiguration configuration) {
ModuleAuthenticationImpl moduleAuthentication = new ModuleAuthenticationImpl(AuthenticationModuleNameConstants.CLUSTER);
moduleAuthentication.setPrefix(configuration.getPrefixOfModule());
moduleAuthentication.setNameOfModule(configuration.getNameOfModule());
return moduleAuthentication;
}
Aggregations