Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
reg-app
Regapp
Commits
f2ebfed6
Commit
f2ebfed6
authored
Nov 19, 2019
by
michael.simon
Browse files
move saml exception around in own package
parent
a058a204
Changes
17
Hide whitespace changes
Inline
Side-by-side
bwreg-service/src/main/java/edu/kit/scc/webreg/service/impl/UserLoginServiceImpl.java
View file @
f2ebfed6
...
...
@@ -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
{
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/impl/UserUpdater.java
View file @
f2ebfed6
...
...
@@ -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
{
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/saml/AttributeQueryHelper.java
View file @
f2ebfed6
...
...
@@ -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"
)
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/saml/Saml2AssertionService.java
View file @
f2ebfed6
...
...
@@ -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
{
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/saml/Saml2DecoderService.java
View file @
f2ebfed6
...
...
@@ -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
{
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/saml/Saml2ResponseValidationService.java
View file @
f2ebfed6
...
...
@@ -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
;
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/saml/SamlIdpService.java
View file @
f2ebfed6
...
...
@@ -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
{
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/saml/SamlIdpServiceImpl.java
View file @
f2ebfed6
...
...
@@ -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
;
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/service/saml/SamlSpPostServiceImpl.java
View file @
f2ebfed6
...
...
@@ -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
;
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/exc/NoAssertionException.java
→
bwreg-service/src/main/java/edu/kit/scc/webreg/
service/saml/
exc/NoAssertionException.java
View file @
f2ebfed6
...
...
@@ -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
;
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/exc/SamlAuthenticationException.java
→
bwreg-service/src/main/java/edu/kit/scc/webreg/
service/saml/
exc/SamlAuthenticationException.java
View file @
f2ebfed6
...
...
@@ -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
;
...
...
bwreg-service/src/main/java/edu/kit/scc/webreg/exc/SamlUnknownPrincipalException.java
→
bwreg-service/src/main/java/edu/kit/scc/webreg/
service/saml/
exc/SamlUnknownPrincipalException.java
View file @
f2ebfed6
...
...
@@ -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
;
...
...
bwreg-webapp/src/main/java/edu/kit/scc/webreg/sec/Saml2AttributeQueryHandler.java
View file @
f2ebfed6
...
...
@@ -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
...
...
bwreg-webapp/src/main/java/edu/kit/scc/webreg/sec/Saml2IdpRedirectHandler.java
View file @
f2ebfed6
...
...
@@ -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
;
...
...
bwreg-webapp/src/main/java/edu/kit/scc/webreg/sec/Saml2IdpRedirectResponseHandler.java
View file @
f2ebfed6
...
...
@@ -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
...
...
bwreg-webapp/src/main/java/edu/kit/scc/webreg/sec/SamlSpDispatcherServlet.java
View file @
f2ebfed6
...
...
@@ -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);
}
...
...
bwreg-webapp/src/main/java/edu/kit/scc/webreg/sec/SecurityFilter.java
View file @
f2ebfed6
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment