imports etc
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
package no.steras.opensamlbook;
|
||||
|
||||
import org.opensaml.common.impl.SecureRandomIdentifierGenerator;
|
||||
import org.opensaml.ws.soap.soap11.Body;
|
||||
import org.opensaml.ws.soap.soap11.Envelope;
|
||||
import org.opensaml.xml.Configuration;
|
||||
import org.opensaml.xml.XMLObject;
|
||||
import org.opensaml.xml.XMLObjectBuilderFactory;
|
||||
import org.opensaml.xml.io.Marshaller;
|
||||
import org.opensaml.xml.io.MarshallingException;
|
||||
import net.shibboleth.utilities.java.support.security.RandomIdentifierGenerationStrategy;
|
||||
import org.opensaml.core.xml.XMLObject;
|
||||
import org.opensaml.core.xml.XMLObjectBuilderFactory;
|
||||
import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
|
||||
import org.opensaml.core.xml.io.Marshaller;
|
||||
import org.opensaml.core.xml.io.MarshallingException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
@@ -30,20 +28,17 @@ import java.security.NoSuchAlgorithmException;
|
||||
*/
|
||||
public class OpenSAMLUtils {
|
||||
private static Logger logger = LoggerFactory.getLogger(OpenSAMLUtils.class);
|
||||
private static SecureRandomIdentifierGenerator secureRandomIdGenerator;
|
||||
private static RandomIdentifierGenerationStrategy secureRandomIdGenerator;
|
||||
|
||||
static {
|
||||
try {
|
||||
secureRandomIdGenerator = new SecureRandomIdentifierGenerator();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
secureRandomIdGenerator = new RandomIdentifierGenerationStrategy();
|
||||
|
||||
}
|
||||
|
||||
public static <T> T buildSAMLObject(final Class<T> clazz) {
|
||||
T object = null;
|
||||
try {
|
||||
XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
|
||||
XMLObjectBuilderFactory builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();
|
||||
QName defaultElementName = (QName)clazz.getDeclaredField("DEFAULT_ELEMENT_NAME").get(null);
|
||||
object = (T)builderFactory.getBuilder(defaultElementName).buildObject(defaultElementName);
|
||||
} catch (IllegalAccessException e) {
|
||||
@@ -68,7 +63,7 @@ public class OpenSAMLUtils {
|
||||
builder = factory.newDocumentBuilder();
|
||||
|
||||
Document document = builder.newDocument();
|
||||
Marshaller out = Configuration.getMarshallerFactory().getMarshaller(object);
|
||||
Marshaller out = XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(object);
|
||||
out.marshall(object, document);
|
||||
|
||||
Transformer transformer = TransformerFactory.newInstance().newTransformer();
|
||||
@@ -87,7 +82,7 @@ public class OpenSAMLUtils {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public static Envelope wrapInSOAPEnvelope(final XMLObject xmlObject) throws IllegalAccessException {
|
||||
Envelope envelope = OpenSAMLUtils.buildSAMLObject(Envelope.class);
|
||||
Body body = OpenSAMLUtils.buildSAMLObject(Body.class);
|
||||
@@ -98,4 +93,5 @@ public class OpenSAMLUtils {
|
||||
|
||||
return envelope;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -5,27 +5,6 @@ import no.steras.opensamlbook.sp.SPConstants;
|
||||
import no.steras.opensamlbook.sp.SPCredentials;
|
||||
import org.apache.xml.security.utils.EncryptionConstants;
|
||||
import org.joda.time.DateTime;
|
||||
import org.opensaml.common.SAMLObject;
|
||||
import org.opensaml.common.impl.SecureRandomIdentifierGenerator;
|
||||
import org.opensaml.saml2.core.*;
|
||||
import org.opensaml.saml2.encryption.Encrypter;
|
||||
import org.opensaml.saml2.metadata.provider.MetadataProviderException;
|
||||
import org.opensaml.security.SAMLSignatureProfileValidator;
|
||||
import org.opensaml.ws.soap.soap11.Body;
|
||||
import org.opensaml.ws.soap.soap11.Envelope;
|
||||
import org.opensaml.xml.Configuration;
|
||||
import org.opensaml.xml.XMLObject;
|
||||
import org.opensaml.xml.encryption.EncryptionException;
|
||||
import org.opensaml.xml.encryption.EncryptionParameters;
|
||||
import org.opensaml.xml.encryption.KeyEncryptionParameters;
|
||||
import org.opensaml.xml.io.*;
|
||||
import org.opensaml.xml.parse.BasicParserPool;
|
||||
import org.opensaml.xml.parse.XMLParserException;
|
||||
import org.opensaml.xml.schema.XSString;
|
||||
import org.opensaml.xml.schema.impl.XSStringBuilder;
|
||||
import org.opensaml.xml.security.keyinfo.KeyInfoGeneratorFactory;
|
||||
import org.opensaml.xml.signature.*;
|
||||
import org.opensaml.xml.validation.ValidationException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
@@ -57,7 +36,7 @@ import java.security.spec.ECField;
|
||||
* Created by Privat on 4/6/14.
|
||||
*/
|
||||
public class ArtifactResolutionServlet extends HttpServlet {
|
||||
private static Logger logger = LoggerFactory.getLogger(ArtifactResolutionServlet.class);
|
||||
/* private static Logger logger = LoggerFactory.getLogger(ArtifactResolutionServlet.class);
|
||||
|
||||
@Override
|
||||
protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
|
||||
@@ -326,6 +305,6 @@ public class ArtifactResolutionServlet extends HttpServlet {
|
||||
} catch (TransformerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
package no.steras.opensamlbook.idp;
|
||||
|
||||
import org.opensaml.xml.security.*;
|
||||
import org.opensaml.xml.security.credential.BasicCredential;
|
||||
import org.opensaml.xml.security.credential.Credential;
|
||||
import org.opensaml.xml.security.credential.KeyStoreCredentialResolver;
|
||||
import org.opensaml.xml.security.credential.UsageType;
|
||||
import org.opensaml.xml.security.criteria.EntityIDCriteria;
|
||||
import org.opensaml.xml.security.x509.X509Credential;
|
||||
import org.opensaml.security.credential.Credential;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -22,7 +16,7 @@ import java.util.Map;
|
||||
* Created by Privat on 13/05/14.
|
||||
*/
|
||||
public class IDPCredentials {
|
||||
private static final Credential credential;
|
||||
/* private static final Credential credential;
|
||||
|
||||
static {
|
||||
credential = generateCredential();
|
||||
@@ -30,6 +24,7 @@ public class IDPCredentials {
|
||||
|
||||
private static Credential generateCredential() {
|
||||
try {
|
||||
//KeySupport
|
||||
KeyPair keyPair = SecurityHelper.generateKeyPair("RSA", 1024, null);
|
||||
return SecurityHelper.getSimpleCredential(keyPair.getPublic(), keyPair.getPrivate());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
@@ -42,4 +37,5 @@ public class IDPCredentials {
|
||||
public static Credential getCredential() {
|
||||
return credential;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -4,25 +4,6 @@ import no.steras.opensamlbook.OpenSAMLUtils;
|
||||
import no.steras.opensamlbook.idp.IDPConstants;
|
||||
import no.steras.opensamlbook.idp.IDPCredentials;
|
||||
import org.joda.time.DateTime;
|
||||
import org.opensaml.saml2.core.*;
|
||||
import org.opensaml.saml2.encryption.Decrypter;
|
||||
import org.opensaml.security.SAMLSignatureProfileValidator;
|
||||
import org.opensaml.ws.soap.client.BasicSOAPMessageContext;
|
||||
import org.opensaml.ws.soap.client.http.HttpClientBuilder;
|
||||
import org.opensaml.ws.soap.client.http.HttpSOAPClient;
|
||||
import org.opensaml.ws.soap.common.SOAPException;
|
||||
import org.opensaml.ws.soap.soap11.Envelope;
|
||||
import org.opensaml.xml.Configuration;
|
||||
import org.opensaml.xml.XMLObject;
|
||||
import org.opensaml.xml.encryption.DecryptionException;
|
||||
import org.opensaml.xml.encryption.InlineEncryptedKeyResolver;
|
||||
import org.opensaml.xml.io.MarshallingException;
|
||||
import org.opensaml.xml.parse.BasicParserPool;
|
||||
import org.opensaml.xml.schema.XSString;
|
||||
import org.opensaml.xml.security.SecurityException;
|
||||
import org.opensaml.xml.security.keyinfo.StaticKeyInfoCredentialResolver;
|
||||
import org.opensaml.xml.signature.*;
|
||||
import org.opensaml.xml.validation.ValidationException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -36,7 +17,7 @@ import java.io.IOException;
|
||||
* Created by Privat on 4/6/14.
|
||||
*/
|
||||
public class ConsumerServlet extends HttpServlet {
|
||||
private static Logger logger = LoggerFactory.getLogger(ConsumerServlet.class);
|
||||
/* private static Logger logger = LoggerFactory.getLogger(ConsumerServlet.class);
|
||||
|
||||
@Override
|
||||
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
|
||||
@@ -206,5 +187,6 @@ public class ConsumerServlet extends HttpServlet {
|
||||
|
||||
return artifactResolve;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package no.steras.opensamlbook.sp;
|
||||
|
||||
import org.opensaml.xml.security.*;
|
||||
import org.opensaml.xml.security.credential.BasicCredential;
|
||||
import org.opensaml.xml.security.credential.Credential;
|
||||
import org.opensaml.xml.security.credential.KeyStoreCredentialResolver;
|
||||
import org.opensaml.xml.security.credential.UsageType;
|
||||
import org.opensaml.xml.security.criteria.EntityIDCriteria;
|
||||
import org.opensaml.xml.security.x509.X509Credential;
|
||||
import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
|
||||
import org.opensaml.security.credential.Credential;
|
||||
import org.opensaml.security.credential.impl.KeyStoreCredentialResolver;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -22,7 +18,7 @@ import java.util.Map;
|
||||
* Created by Privat on 13/05/14.
|
||||
*/
|
||||
public class SPCredentials {
|
||||
private static final String KEY_STORE_PASSWORD = "password";
|
||||
/* private static final String KEY_STORE_PASSWORD = "password";
|
||||
private static final String KEY_STORE_ENTRY_PASSWORD = "password";
|
||||
private static final String KEY_STORE_PATH = "/SPKeystore.jks";
|
||||
private static final String KEY_ENTRY_ID = "SPKey";
|
||||
@@ -60,4 +56,6 @@ public class SPCredentials {
|
||||
public static Credential getCredential() {
|
||||
return credential;
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user