From 1c0f423510cee0fd63f5bdcd02e163f7c78ee630 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com.> Date: Fri, 29 Nov 2024 08:59:29 +0000 Subject: [PATCH] remove unused repo --- ...mSaml2AuthenticationRequestRepository.java | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 src/main/java/stirling/software/SPDF/config/security/saml2/CustomSaml2AuthenticationRequestRepository.java diff --git a/src/main/java/stirling/software/SPDF/config/security/saml2/CustomSaml2AuthenticationRequestRepository.java b/src/main/java/stirling/software/SPDF/config/security/saml2/CustomSaml2AuthenticationRequestRepository.java deleted file mode 100644 index b7517480c..000000000 --- a/src/main/java/stirling/software/SPDF/config/security/saml2/CustomSaml2AuthenticationRequestRepository.java +++ /dev/null @@ -1,64 +0,0 @@ -package stirling.software.SPDF.config.security.saml2; - -import java.util.Enumeration; - -import org.springframework.security.saml2.provider.service.authentication.AbstractSaml2AuthenticationRequest; -import org.springframework.security.saml2.provider.service.web.Saml2AuthenticationRequestRepository; -import org.springframework.stereotype.Component; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.servlet.http.HttpSession; - -@Component -public class CustomSaml2AuthenticationRequestRepository - implements Saml2AuthenticationRequestRepository { - - private static final String AUTHENTICATION_REQUEST_KEY_PREFIX = "SAML2_AUTHENTICATION_REQUEST_"; - - @Override - public void saveAuthenticationRequest( - AbstractSaml2AuthenticationRequest authenticationRequest, - HttpServletRequest request, - HttpServletResponse response) { - HttpSession session = request.getSession(true); - String requestId = authenticationRequest.getId(); - session.setAttribute(AUTHENTICATION_REQUEST_KEY_PREFIX + requestId, authenticationRequest); - } - - @Override - public AbstractSaml2AuthenticationRequest loadAuthenticationRequest( - HttpServletRequest request) { - HttpSession session = request.getSession(false); - if (session != null) { - Enumeration attributeNames = session.getAttributeNames(); - while (attributeNames.hasMoreElements()) { - String attributeName = attributeNames.nextElement(); - if (attributeName.startsWith(AUTHENTICATION_REQUEST_KEY_PREFIX)) { - return (AbstractSaml2AuthenticationRequest) session.getAttribute(attributeName); - } - } - } - return null; - } - - @Override - public AbstractSaml2AuthenticationRequest removeAuthenticationRequest( - HttpServletRequest request, HttpServletResponse response) { - HttpSession session = request.getSession(false); - if (session != null) { - Enumeration attributeNames = session.getAttributeNames(); - while (attributeNames.hasMoreElements()) { - String attributeName = attributeNames.nextElement(); - if (attributeName.startsWith(AUTHENTICATION_REQUEST_KEY_PREFIX)) { - AbstractSaml2AuthenticationRequest auth = - (AbstractSaml2AuthenticationRequest) - session.getAttribute(attributeName); - session.removeAttribute(attributeName); - return auth; - } - } - } - return null; - } -}