use of com.evolveum.midpoint.authentication.api.config.RemoteModuleAuthentication in project midpoint by Evolveum.
the class AbstractPageRemoteAuthenticationSelect method getProviders.
private List<IdentityProvider> getProviders() {
List<IdentityProvider> providers = new ArrayList<>();
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication instanceof MidpointAuthentication) {
MidpointAuthentication mpAuthentication = (MidpointAuthentication) authentication;
ModuleAuthentication moduleAuthentication = mpAuthentication.getProcessingModuleAuthentication();
if (moduleAuthentication instanceof RemoteModuleAuthentication) {
providers = ((RemoteModuleAuthentication) moduleAuthentication).getProviders();
if (providers.isEmpty()) {
String key = getErrorKeyEmptyProviders();
error(getString(key));
}
return providers;
}
String key = getErrorKeyUnsupportedType();
error(getString(key));
return providers;
}
String key = "web.security.flexAuth.unsupported.auth.type";
error(getString(key));
return providers;
}
use of com.evolveum.midpoint.authentication.api.config.RemoteModuleAuthentication in project midpoint by Evolveum.
the class RemoteAuthenticationEntryPoint method commence.
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication instanceof MidpointAuthentication) {
MidpointAuthentication mpAuthentication = (MidpointAuthentication) authentication;
ModuleAuthentication moduleAuthentication = mpAuthentication.getProcessingModuleAuthentication();
if (moduleAuthentication instanceof RemoteModuleAuthentication) {
List<IdentityProvider> providers = ((RemoteModuleAuthentication) moduleAuthentication).getProviders();
if (request.getSession().getAttribute("SPRING_SECURITY_LAST_EXCEPTION") == null) {
if (providers.size() == 1) {
response.sendRedirect(providers.get(0).getRedirectLink());
return;
}
} else if (getLoginFormUrl().equals(request.getServletPath()) && AuthenticationModuleState.LOGIN_PROCESSING.equals(moduleAuthentication.getState())) {
return;
}
}
}
super.commence(request, response, authException);
}
Aggregations