Commit f2ebfed6 authored by michael.simon's avatar michael.simon
Browse files

move saml exception around in own package

parent a058a204
......@@ -75,7 +75,6 @@ import edu.kit.scc.webreg.exc.NoScopedUsernameException;
import edu.kit.scc.webreg.exc.NoServiceFoundException;
import edu.kit.scc.webreg.exc.NoUserFoundException;
import edu.kit.scc.webreg.exc.RestInterfaceException;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.exc.UnauthorizedException;
import edu.kit.scc.webreg.exc.UserNotRegisteredException;
import edu.kit.scc.webreg.exc.UserUpdateException;
......@@ -88,6 +87,7 @@ import edu.kit.scc.webreg.service.saml.Saml2AssertionService;
import edu.kit.scc.webreg.service.saml.Saml2ResponseValidationService;
import edu.kit.scc.webreg.service.saml.SamlHelper;
import edu.kit.scc.webreg.service.saml.SsoHelper;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
@Stateless
public class UserLoginServiceImpl implements UserLoginService, Serializable {
......
......@@ -55,9 +55,6 @@ import edu.kit.scc.webreg.event.EventSubmitter;
import edu.kit.scc.webreg.event.UserEvent;
import edu.kit.scc.webreg.exc.EventSubmitException;
import edu.kit.scc.webreg.exc.MetadataException;
import edu.kit.scc.webreg.exc.NoAssertionException;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.exc.SamlUnknownPrincipalException;
import edu.kit.scc.webreg.exc.UserUpdateException;
import edu.kit.scc.webreg.service.SerialService;
import edu.kit.scc.webreg.service.ServiceService;
......@@ -66,6 +63,9 @@ import edu.kit.scc.webreg.service.reg.AttributeSourceQueryService;
import edu.kit.scc.webreg.service.saml.AttributeQueryHelper;
import edu.kit.scc.webreg.service.saml.Saml2AssertionService;
import edu.kit.scc.webreg.service.saml.SamlHelper;
import edu.kit.scc.webreg.service.saml.exc.NoAssertionException;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.saml.exc.SamlUnknownPrincipalException;
@ApplicationScoped
public class UserUpdater implements Serializable {
......
......@@ -67,7 +67,7 @@ import edu.kit.scc.webreg.entity.SamlMetadataEntity;
import edu.kit.scc.webreg.entity.SamlSpConfigurationEntity;
import edu.kit.scc.webreg.entity.SamlUserEntity;
import edu.kit.scc.webreg.exc.MetadataException;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
@Named("attributeQueryHelper")
......
......@@ -41,8 +41,8 @@ import org.slf4j.Logger;
import edu.kit.scc.webreg.entity.SamlMetadataEntity;
import edu.kit.scc.webreg.entity.SamlSpConfigurationEntity;
import edu.kit.scc.webreg.exc.NoAssertionException;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.saml.exc.NoAssertionException;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
@ApplicationScoped
public class Saml2AssertionService {
......
......@@ -24,7 +24,7 @@ import org.opensaml.saml.saml2.core.AttributeQuery;
import org.opensaml.saml.saml2.core.AuthnRequest;
import org.opensaml.saml.saml2.core.Response;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
@ApplicationScoped
public class Saml2DecoderService {
......
......@@ -41,8 +41,8 @@ import org.opensaml.xmlsec.signature.support.impl.ExplicitKeySignatureTrustEngin
import org.slf4j.Logger;
import edu.kit.scc.webreg.entity.SamlMetadataEntity;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.exc.SamlUnknownPrincipalException;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.saml.exc.SamlUnknownPrincipalException;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
......
......@@ -4,7 +4,7 @@ import javax.servlet.http.HttpServletResponse;
import org.opensaml.saml.saml2.core.AuthnRequest;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
public interface SamlIdpService {
......
......@@ -81,8 +81,8 @@ import edu.kit.scc.webreg.entity.ScriptEntity;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.ServiceSamlSpEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.script.ScriptingEnv;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
import net.shibboleth.utilities.java.support.resolver.ResolverException;
......
......@@ -26,9 +26,9 @@ import edu.kit.scc.webreg.entity.SamlIdpMetadataEntity;
import edu.kit.scc.webreg.entity.SamlIdpMetadataEntityStatus;
import edu.kit.scc.webreg.entity.SamlSpConfigurationEntity;
import edu.kit.scc.webreg.entity.SamlUserEntity;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.exc.UserUpdateException;
import edu.kit.scc.webreg.service.impl.UserUpdater;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.session.SessionManager;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
......
......@@ -8,7 +8,7 @@
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.exc;
package edu.kit.scc.webreg.service.saml.exc;
import java.io.Serializable;
......
......@@ -8,7 +8,7 @@
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.exc;
package edu.kit.scc.webreg.service.saml.exc;
import java.io.Serializable;
......
......@@ -8,7 +8,7 @@
* Contributors:
* Michael Simon - initial
******************************************************************************/
package edu.kit.scc.webreg.exc;
package edu.kit.scc.webreg.service.saml.exc;
import java.io.Serializable;
......
......@@ -43,13 +43,13 @@ import edu.kit.scc.webreg.bootstrap.ApplicationConfig;
import edu.kit.scc.webreg.entity.SamlAAConfigurationEntity;
import edu.kit.scc.webreg.entity.SamlSpMetadataEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.SamlSpMetadataService;
import edu.kit.scc.webreg.service.UserService;
import edu.kit.scc.webreg.service.saml.Saml2DecoderService;
import edu.kit.scc.webreg.service.saml.Saml2ResponseValidationService;
import edu.kit.scc.webreg.service.saml.SamlHelper;
import edu.kit.scc.webreg.service.saml.SsoHelper;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
@ApplicationScoped
......
......@@ -25,12 +25,12 @@ import org.slf4j.Logger;
import edu.kit.scc.webreg.bootstrap.ApplicationConfig;
import edu.kit.scc.webreg.entity.SamlIdpConfigurationEntity;
import edu.kit.scc.webreg.entity.SamlSpMetadataEntity;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.SamlIdpConfigurationService;
import edu.kit.scc.webreg.service.SamlSpMetadataService;
import edu.kit.scc.webreg.service.saml.Saml2DecoderService;
import edu.kit.scc.webreg.service.saml.SamlHelper;
import edu.kit.scc.webreg.service.saml.SamlIdpService;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.session.SessionManager;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
......
......@@ -20,8 +20,8 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.saml.SamlIdpService;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.session.SessionManager;
@ApplicationScoped
......
......@@ -29,6 +29,7 @@ import edu.kit.scc.webreg.entity.SamlAAConfigurationEntity;
import edu.kit.scc.webreg.entity.SamlSpConfigurationEntity;
import edu.kit.scc.webreg.service.SamlAAConfigurationService;
import edu.kit.scc.webreg.service.SamlSpConfigurationService;
import edu.kit.scc.webreg.service.saml.exc.SamlAuthenticationException;
@Named
@WebServlet(urlPatterns = {"/Shibboleth.sso/*", "/saml/sp/*"})
......@@ -58,34 +59,36 @@ public class SamlSpDispatcherServlet implements Servlet {
public void service(ServletRequest servletRequest, ServletResponse servletResponse)
throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
String context = request.getServletContext().getContextPath();
String path = request.getRequestURI().substring(
context.length());
logger.debug("Dispatching request context '{}' path '{}'", context, path);
SamlSpConfigurationEntity spConfig = spConfigService.findByHostname(request.getServerName());
throw new ServletException(new SamlAuthenticationException("persistent id missing"));
if (spConfig != null && spConfig.getAcs() != null &&
spConfig.getAcs().endsWith(context + path)) {
logger.debug("Executing POST Handler for entity {}", spConfig.getEntityId());
postHandler.service(request, response, spConfig);
return;
}
SamlAAConfigurationEntity aaConfig = aaConfigService.findByHostname(request.getServerName());
if (aaConfig != null && aaConfig.getAq() != null &&
aaConfig.getAq().endsWith(context + path)) {
logger.debug("Executing AttributeQuery Handler for entity {}", aaConfig.getEntityId());
attributeQueryServlet.service(request, response, aaConfig);
return;
}
logger.info("No matching servlet for context '{}' path '{}'", context, path);
// HttpServletRequest request = (HttpServletRequest) servletRequest;
// HttpServletResponse response = (HttpServletResponse) servletResponse;
//
// String context = request.getServletContext().getContextPath();
// String path = request.getRequestURI().substring(
// context.length());
//
// logger.debug("Dispatching request context '{}' path '{}'", context, path);
//
// SamlSpConfigurationEntity spConfig = spConfigService.findByHostname(request.getServerName());
//
// if (spConfig != null && spConfig.getAcs() != null &&
// spConfig.getAcs().endsWith(context + path)) {
// logger.debug("Executing POST Handler for entity {}", spConfig.getEntityId());
// postHandler.service(request, response, spConfig);
// return;
// }
//
// SamlAAConfigurationEntity aaConfig = aaConfigService.findByHostname(request.getServerName());
//
// if (aaConfig != null && aaConfig.getAq() != null &&
// aaConfig.getAq().endsWith(context + path)) {
// logger.debug("Executing AttributeQuery Handler for entity {}", aaConfig.getEntityId());
// attributeQueryServlet.service(request, response, aaConfig);
// return;
// }
//
// logger.info("No matching servlet for context '{}' path '{}'", context, path);
}
......
......@@ -104,6 +104,7 @@ public class SecurityFilter implements Filter {
path.startsWith("/Shibboleth.sso/") ||
path.startsWith("/saml/") ||
path.startsWith("/logout/") ||
path.startsWith("/error") ||
path.equals("/favicon.ico")
) {
chain.doFilter(servletRequest, servletResponse);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment