Commit 9181e7e4 authored by michael.simon's avatar michael.simon
Browse files

first changes

parent ccc613b7
...@@ -19,10 +19,8 @@ import javax.ejb.Singleton; ...@@ -19,10 +19,8 @@ import javax.ejb.Singleton;
import javax.ejb.Startup; import javax.ejb.Startup;
import javax.inject.Inject; import javax.inject.Inject;
import org.opensaml.Configuration; import org.opensaml.core.config.InitializationException;
import org.opensaml.DefaultBootstrap; import org.opensaml.core.config.InitializationService;
import org.opensaml.xml.ConfigurationException;
import org.opensaml.xml.XMLConfigurator;
import org.slf4j.Logger; import org.slf4j.Logger;
import edu.kit.scc.webreg.drools.BpmProcessService; import edu.kit.scc.webreg.drools.BpmProcessService;
...@@ -132,19 +130,12 @@ public class ApplicationBootstrap { ...@@ -132,19 +130,12 @@ public class ApplicationBootstrap {
userService.convertLegacyUsers(); userService.convertLegacyUsers();
try { try {
logger.info("OpenSAML Bootstrap...");
logger.info("OpenSAML Bootstrap..."); InitializationService.initialize();
DefaultBootstrap.bootstrap(); } catch (InitializationException e) {
logger.info("Loading XMLTooling configuration /liberty-paos-config.xml");
XMLConfigurator configurator = new XMLConfigurator();
configurator.load(Configuration.class.getResourceAsStream("/liberty-paos-config.xml"));
} catch (ConfigurationException e) {
logger.error("Serious Error happened", e); logger.error("Serious Error happened", e);
} }
bpmProcessService.init(); bpmProcessService.init();
......
...@@ -15,8 +15,8 @@ import java.util.Map; ...@@ -15,8 +15,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.kie.api.runtime.KieSession; import org.kie.api.runtime.KieSession;
import org.opensaml.saml2.core.Assertion; import org.opensaml.saml.saml2.core.Assertion;
import org.opensaml.saml2.metadata.EntityDescriptor; import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import edu.kit.scc.webreg.entity.GroupEntity; import edu.kit.scc.webreg.entity.GroupEntity;
import edu.kit.scc.webreg.entity.RegistryEntity; import edu.kit.scc.webreg.entity.RegistryEntity;
......
...@@ -25,8 +25,8 @@ import org.kie.api.builder.ReleaseId; ...@@ -25,8 +25,8 @@ import org.kie.api.builder.ReleaseId;
import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession; import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.FactHandle; import org.kie.api.runtime.rule.FactHandle;
import org.opensaml.saml2.core.Assertion; import org.opensaml.saml.saml2.core.Assertion;
import org.opensaml.saml2.metadata.EntityDescriptor; import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import org.slf4j.Logger; import org.slf4j.Logger;
import edu.kit.scc.webreg.audit.ServiceRegisterAuditor; import edu.kit.scc.webreg.audit.ServiceRegisterAuditor;
......
...@@ -15,6 +15,7 @@ import java.io.StringWriter; ...@@ -15,6 +15,7 @@ import java.io.StringWriter;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
...@@ -75,9 +76,9 @@ public class HttpCallbackHook implements UserServiceHook { ...@@ -75,9 +76,9 @@ public class HttpCallbackHook implements UserServiceHook {
if (appConfig.getConfigValue("HttpCallbackHook_positive_match_regex") != null) if (appConfig.getConfigValue("HttpCallbackHook_positive_match_regex") != null)
positiveMatchRegex = appConfig.getConfigValue("HttpCallbackHook_positive_match_regex"); positiveMatchRegex = appConfig.getConfigValue("HttpCallbackHook_positive_match_regex");
VelocityEngine engine = new VelocityEngine(); Properties p = new Properties();
engine.setProperty("runtime.log.logsystem.log4j.logger", "root"); p.put("runtime.log.logsystem.log4j.logger", "root");
engine.init(); VelocityEngine engine = new VelocityEngine(p);
Map<String, Object> context = new HashMap<String, Object>(); Map<String, Object> context = new HashMap<String, Object>();
context.put("user", user); context.put("user", user);
VelocityContext velocityContext = new VelocityContext(context); VelocityContext velocityContext = new VelocityContext(context);
......
...@@ -20,8 +20,8 @@ import javax.ejb.Stateless; ...@@ -20,8 +20,8 @@ import javax.ejb.Stateless;
import javax.inject.Inject; import javax.inject.Inject;
import org.kie.api.runtime.KieSession; import org.kie.api.runtime.KieSession;
import org.opensaml.saml2.metadata.EntitiesDescriptor; import org.opensaml.saml.saml2.metadata.EntitiesDescriptor;
import org.opensaml.saml2.metadata.EntityDescriptor; import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import org.slf4j.Logger; import org.slf4j.Logger;
import edu.kit.scc.webreg.dao.BaseDao; import edu.kit.scc.webreg.dao.BaseDao;
......
...@@ -15,25 +15,23 @@ import javax.ejb.Stateless; ...@@ -15,25 +15,23 @@ import javax.ejb.Stateless;
import javax.inject.Inject; import javax.inject.Inject;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import org.apache.commons.httpclient.HttpClient; import org.apache.http.auth.AuthScope;
import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope; import org.apache.http.client.HttpClient;
import org.opensaml.common.xml.SAMLConstants; import org.apache.http.impl.client.HttpClientBuilder;
import org.opensaml.saml2.core.Assertion; import org.opensaml.saml.common.xml.SAMLConstants;
import org.opensaml.saml2.core.Audience; import org.opensaml.saml.saml2.core.Assertion;
import org.opensaml.saml2.core.AudienceRestriction; import org.opensaml.saml.saml2.core.Audience;
import org.opensaml.saml2.core.AuthnRequest; import org.opensaml.saml.saml2.core.AudienceRestriction;
import org.opensaml.saml2.core.Response; import org.opensaml.saml.saml2.core.AuthnRequest;
import org.opensaml.saml2.metadata.EntityDescriptor; import org.opensaml.saml.saml2.core.Response;
import org.opensaml.saml2.metadata.SingleSignOnService; import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import org.opensaml.ws.soap.client.BasicSOAPMessageContext; import org.opensaml.saml.saml2.metadata.SingleSignOnService;
import org.opensaml.ws.soap.client.SOAPClientException; import org.opensaml.soap.client.SOAPClientException;
import org.opensaml.ws.soap.client.http.HttpClientBuilder; import org.opensaml.soap.client.http.HttpSOAPClient;
import org.opensaml.ws.soap.client.http.HttpSOAPClient; import org.opensaml.soap.common.SOAPException;
import org.opensaml.ws.soap.common.SOAPException; import org.opensaml.soap.soap11.Envelope;
import org.opensaml.ws.soap.soap11.Envelope; import org.opensaml.xmlsec.encryption.support.DecryptionException;
import org.opensaml.xml.encryption.DecryptionException;
import org.opensaml.xml.security.SecurityException;
import org.slf4j.Logger; import org.slf4j.Logger;
import edu.kit.scc.webreg.dao.RegistryDao; import edu.kit.scc.webreg.dao.RegistryDao;
......
...@@ -15,12 +15,11 @@ import javax.enterprise.context.ApplicationScoped; ...@@ -15,12 +15,11 @@ import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject; import javax.inject.Inject;
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.beanutils.PropertyUtils;
import org.opensaml.saml2.core.Assertion; import org.opensaml.saml.saml2.core.Assertion;
import org.opensaml.saml2.core.Response; import org.opensaml.saml.saml2.core.Response;
import org.opensaml.saml2.metadata.EntityDescriptor; import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import org.opensaml.ws.soap.common.SOAPException; import org.opensaml.soap.common.SOAPException;
import org.opensaml.xml.encryption.DecryptionException; import org.opensaml.xmlsec.encryption.support.DecryptionException;
import org.opensaml.xml.security.SecurityException;
import org.slf4j.Logger; import org.slf4j.Logger;
import edu.kit.scc.webreg.audit.Auditor; import edu.kit.scc.webreg.audit.Auditor;
......
...@@ -25,32 +25,33 @@ import javax.inject.Inject; ...@@ -25,32 +25,33 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import net.shibboleth.utilities.java.support.xml.BasicParserPool;
import net.shibboleth.utilities.java.support.xml.XMLParserException;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.client.ClientProtocolException; import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.opensaml.common.xml.SAMLConstants; import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml2.common.Extensions; import org.opensaml.core.xml.io.Unmarshaller;
import org.opensaml.saml2.core.Attribute; import org.opensaml.core.xml.io.UnmarshallerFactory;
import org.opensaml.saml2.metadata.AttributeAuthorityDescriptor; import org.opensaml.core.xml.io.UnmarshallingException;
import org.opensaml.saml2.metadata.AttributeService; import org.opensaml.core.xml.schema.XSAny;
import org.opensaml.saml2.metadata.EntitiesDescriptor; import org.opensaml.saml.common.xml.SAMLConstants;
import org.opensaml.saml2.metadata.EntityDescriptor; import org.opensaml.saml.ext.saml2mdattr.EntityAttributes;
import org.opensaml.saml2.metadata.IDPSSODescriptor; import org.opensaml.saml.ext.saml2mdui.UIInfo;
import org.opensaml.saml2.metadata.OrganizationDisplayName; import org.opensaml.saml.saml2.core.Attribute;
import org.opensaml.saml2.metadata.SPSSODescriptor; import org.opensaml.saml.saml2.metadata.AttributeAuthorityDescriptor;
import org.opensaml.saml2.metadata.SingleSignOnService; import org.opensaml.saml.saml2.metadata.AttributeService;
import org.opensaml.samlext.saml2mdattr.EntityAttributes; import org.opensaml.saml.saml2.metadata.EntitiesDescriptor;
import org.opensaml.samlext.saml2mdui.UIInfo; import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import org.opensaml.xml.XMLObject; import org.opensaml.saml.saml2.metadata.Extensions;
import org.opensaml.xml.io.Unmarshaller; import org.opensaml.saml.saml2.metadata.IDPSSODescriptor;
import org.opensaml.xml.io.UnmarshallerFactory; import org.opensaml.saml.saml2.metadata.OrganizationDisplayName;
import org.opensaml.xml.io.UnmarshallingException; import org.opensaml.saml.saml2.metadata.SPSSODescriptor;
import org.opensaml.xml.parse.BasicParserPool; import org.opensaml.saml.saml2.metadata.SingleSignOnService;
import org.opensaml.xml.parse.XMLParserException;
import org.opensaml.xml.schema.XSAny;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.w3c.dom.Document; import org.w3c.dom.Document;
...@@ -211,7 +212,7 @@ public class MetadataHelper implements Serializable { ...@@ -211,7 +212,7 @@ public class MetadataHelper implements Serializable {
List<OrganizationDisplayName> displayList = entityDesc.getOrganization().getDisplayNames(); List<OrganizationDisplayName> displayList = entityDesc.getOrganization().getDisplayNames();
if (displayList.size() > 0) if (displayList.size() > 0)
return displayList.get(0).getName().getLocalString(); return displayList.get(0).getValue();
else else
return entityDesc.getEntityID(); return entityDesc.getEntityID();
} }
...@@ -256,13 +257,13 @@ public class MetadataHelper implements Serializable { ...@@ -256,13 +257,13 @@ public class MetadataHelper implements Serializable {
UIInfo uiInfo = (UIInfo) xmlObject; UIInfo uiInfo = (UIInfo) xmlObject;
if (uiInfo.getDescriptions().size() > 0) { if (uiInfo.getDescriptions().size() > 0) {
idp.setDescription(uiInfo.getDescriptions().get(0).getName().getLocalString()); idp.setDescription(uiInfo.getDescriptions().get(0).getValue());
} }
if (uiInfo.getDisplayNames().size() > 0) { if (uiInfo.getDisplayNames().size() > 0) {
idp.setDisplayName(uiInfo.getDisplayNames().get(0).getName().getLocalString()); idp.setDisplayName(uiInfo.getDisplayNames().get(0).getValue());
} }
if (uiInfo.getInformationURLs().size() > 0) { if (uiInfo.getInformationURLs().size() > 0) {
idp.setInformationUrl(uiInfo.getInformationURLs().get(0).getURI().getLocalString()); idp.setInformationUrl(uiInfo.getInformationURLs().get(0).getValue());
} }
} }
} }
......
...@@ -14,16 +14,18 @@ import javax.enterprise.context.ApplicationScoped; ...@@ -14,16 +14,18 @@ import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.opensaml.common.SAMLObject; import org.opensaml.messaging.context.MessageContext;
import org.opensaml.common.binding.BasicSAMLMessageContext; import org.opensaml.messaging.encoder.MessageEncoder;
import org.opensaml.common.xml.SAMLConstants; import org.opensaml.messaging.encoder.MessageEncodingException;
import org.opensaml.saml2.binding.encoding.HTTPRedirectDeflateEncoder; import org.opensaml.profile.action.MessageEncoderFactory;
import org.opensaml.saml2.core.AuthnRequest; import org.opensaml.saml.common.SAMLObject;
import org.opensaml.saml2.core.NameID; import org.opensaml.saml.common.messaging.context.SAMLBindingContext;
import org.opensaml.saml2.metadata.EntityDescriptor; import org.opensaml.saml.common.xml.SAMLConstants;
import org.opensaml.saml2.metadata.SingleSignOnService; import org.opensaml.saml.saml2.binding.encoding.impl.HTTPRedirectDeflateEncoder;
import org.opensaml.ws.message.encoder.MessageEncodingException; import org.opensaml.saml.saml2.core.AuthnRequest;
import org.opensaml.ws.transport.http.HttpServletResponseAdapter; import org.opensaml.saml.saml2.core.NameID;
import org.opensaml.saml.saml2.metadata.EntityDescriptor;
import org.opensaml.saml.saml2.metadata.SingleSignOnService;
import org.slf4j.Logger; import org.slf4j.Logger;
import edu.kit.scc.webreg.entity.SamlIdpMetadataEntity; import edu.kit.scc.webreg.entity.SamlIdpMetadataEntity;
...@@ -56,13 +58,14 @@ public class Saml2RedirectService { ...@@ -56,13 +58,14 @@ public class Saml2RedirectService {
spEntity.getEntityId(), spEntity.getAcs(), SAMLConstants.SAML2_POST_BINDING_URI); spEntity.getEntityId(), spEntity.getAcs(), SAMLConstants.SAML2_POST_BINDING_URI);
logger.debug("Sending client to idp {} endpoint {}", idpEntity.getEntityId(), sso.getLocation()); logger.debug("Sending client to idp {} endpoint {}", idpEntity.getEntityId(), sso.getLocation());
MessageContext<AuthnRequest> messageContext = new MessageContext<AuthnRequest>();
SAMLBindingContext bindingContext = new SAMLBindingContext();
bindingContext.setBindingDescriptor(sso);
HTTPRedirectDeflateEncoder encoder = new HTTPRedirectDeflateEncoder(); HTTPRedirectDeflateEncoder encoder = new HTTPRedirectDeflateEncoder();
BasicSAMLMessageContext<SAMLObject, AuthnRequest, NameID> messageContext = messageContext.setMessage(authnRequest);
new BasicSAMLMessageContext<SAMLObject, AuthnRequest, NameID>(); messageContext. setPeerEntityEndpoint(sso);
messageContext.setOutboundSAMLMessage(authnRequest); //messageContext.setOutboundMessageTransport(new HttpServletResponseAdapter(response, true));
messageContext.setPeerEntityEndpoint(sso);
messageContext.setOutboundMessageTransport(new HttpServletResponseAdapter(response, true));
encoder.encode(messageContext); encoder.encode(messageContext);
} }
......
...@@ -24,25 +24,24 @@ import javax.inject.Inject; ...@@ -24,25 +24,24 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import org.opensaml.Configuration; import net.shibboleth.utilities.java.support.xml.BasicParserPool;
import org.opensaml.common.impl.SecureRandomIdentifierGenerator; import net.shibboleth.utilities.java.support.xml.XMLParserException;
import org.opensaml.saml2.core.Assertion;
import org.opensaml.saml2.core.Attribute; import org.opensaml.core.config.Configuration;
import org.opensaml.saml2.core.AttributeStatement; import org.opensaml.core.xml.XMLObject;
import org.opensaml.xml.XMLObject; import org.opensaml.core.xml.XMLObjectBuilder;
import org.opensaml.xml.XMLObjectBuilder; import org.opensaml.core.xml.io.Marshaller;
import org.opensaml.xml.io.Marshaller; import org.opensaml.core.xml.io.MarshallerFactory;
import org.opensaml.xml.io.MarshallerFactory; import org.opensaml.core.xml.io.MarshallingException;
import org.opensaml.xml.io.MarshallingException; import org.opensaml.core.xml.io.Unmarshaller;
import org.opensaml.xml.io.Unmarshaller; import org.opensaml.core.xml.io.UnmarshallerFactory;
import org.opensaml.xml.io.UnmarshallerFactory; import org.opensaml.core.xml.io.UnmarshallingException;
import org.opensaml.xml.io.UnmarshallingException; import org.opensaml.core.xml.schema.XSAny;
import org.opensaml.xml.parse.BasicParserPool; import org.opensaml.core.xml.schema.XSDateTime;
import org.opensaml.xml.parse.XMLParserException; import org.opensaml.core.xml.schema.XSString;
import org.opensaml.xml.schema.XSAny; import org.opensaml.saml.saml2.core.Assertion;
import org.opensaml.xml.schema.XSDateTime; import org.opensaml.saml.saml2.core.Attribute;
import org.opensaml.xml.schema.XSString; import org.opensaml.saml.saml2.core.AttributeStatement;
import org.opensaml.xml.util.XMLHelper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
......
...@@ -17,10 +17,10 @@ import javax.inject.Inject; ...@@ -17,10 +17,10 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.opensaml.common.SAMLVersion; import org.opensaml.saml.common.SAMLVersion;
import org.opensaml.saml2.core.AuthnRequest; import org.opensaml.saml.saml2.core.AuthnRequest;
import org.opensaml.saml2.core.Issuer; import org.opensaml.saml.saml2.core.Issuer;
import org.opensaml.saml2.core.NameIDPolicy; import org.opensaml.saml.saml2.core.NameIDPolicy;
@Named("ssoHelper") @Named("ssoHelper")
@ApplicationScoped @ApplicationScoped
......
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