Skip to content

Commit

Permalink
SamlAuthenticationEntryPoint.java: removed superfluous conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed May 15, 2020
1 parent d42ffe3 commit 5b87a1b
Showing 1 changed file with 14 additions and 14 deletions.
@@ -1,30 +1,30 @@
/*
* Copyright (c) 2010-2019 Evolveum and contributors
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.web.security;

import com.evolveum.midpoint.model.api.authentication.MidpointAuthentication;
import com.evolveum.midpoint.model.api.authentication.ModuleAuthentication;
import com.evolveum.midpoint.web.security.module.authentication.Saml2ModuleAuthentication;
import com.evolveum.midpoint.web.security.util.IdentityProvider;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.evolveum.midpoint.model.api.authentication.MidpointAuthentication;
import com.evolveum.midpoint.model.api.authentication.ModuleAuthentication;
import com.evolveum.midpoint.web.security.module.authentication.Saml2ModuleAuthentication;
import com.evolveum.midpoint.web.security.util.IdentityProvider;

/**
* @author skublik
*/

public class SamlAuthenticationEntryPoint extends WicketLoginUrlAuthenticationEntryPoint {

public SamlAuthenticationEntryPoint(String loginFormUrl) {
Expand All @@ -38,9 +38,9 @@ public void commence(HttpServletRequest request, HttpServletResponse response, A
if (authentication instanceof MidpointAuthentication) {
MidpointAuthentication mpAuthentication = (MidpointAuthentication) authentication;
ModuleAuthentication moduleAuthentication = mpAuthentication.getProcessingModuleAuthentication();
if (moduleAuthentication != null && moduleAuthentication instanceof Saml2ModuleAuthentication){
if (moduleAuthentication instanceof Saml2ModuleAuthentication) {
providers = ((Saml2ModuleAuthentication) moduleAuthentication).getProviders();
if (!providers.isEmpty() && providers.size() == 1
if (providers.size() == 1
&& request.getSession().getAttribute("SPRING_SECURITY_LAST_EXCEPTION") == null) {
response.sendRedirect(providers.get(0).getRedirectLink());
return;
Expand Down

0 comments on commit 5b87a1b

Please sign in to comment.