Search in sources :

Example 1 with XMLObjectProviderRegistry

use of org.opensaml.core.xml.config.XMLObjectProviderRegistry in project ddf by codice.

the class IdpEndpoint method init.

public void init() {
    try (InputStream indexStream = IdpEndpoint.class.getResourceAsStream("/html/index.html");
        InputStream submitFormStream = IdpEndpoint.class.getResourceAsStream("/templates/submitForm.handlebars");
        InputStream redirectPageStream = IdpEndpoint.class.getResourceAsStream("/templates/redirect.handlebars");
        InputStream soapMessageStream = IdpEndpoint.class.getResourceAsStream("/templates/soap.handlebars")) {
        indexHtml = IOUtils.toString(indexStream);
        submitForm = IOUtils.toString(submitFormStream);
        redirectPage = IOUtils.toString(redirectPageStream);
        soapMessage = IOUtils.toString(soapMessageStream);
    } catch (Exception e) {
        LOGGER.info("Unable to load index page for IDP.", e);
    }
    OpenSAMLUtil.initSamlEngine();
    XMLObjectProviderRegistry xmlObjectProviderRegistry = ConfigurationService.get(XMLObjectProviderRegistry.class);
    xmlObjectProviderRegistry.registerObjectProvider(Request.DEFAULT_ELEMENT_NAME, new RequestBuilder(), new RequestMarshaller(), new RequestUnmarshaller());
    xmlObjectProviderRegistry.registerObjectProvider(ddf.security.liberty.paos.Response.DEFAULT_ELEMENT_NAME, new ResponseBuilder(), new ResponseMarshaller(), new ResponseUnmarshaller());
}
Also used : ResponseMarshaller(ddf.security.liberty.paos.impl.ResponseMarshaller) RequestUnmarshaller(ddf.security.liberty.paos.impl.RequestUnmarshaller) RequestBuilder(ddf.security.liberty.paos.impl.RequestBuilder) InputStream(java.io.InputStream) XMLObjectProviderRegistry(org.opensaml.core.xml.config.XMLObjectProviderRegistry) ResponseBuilder(ddf.security.liberty.paos.impl.ResponseBuilder) SOAPException(javax.xml.soap.SOAPException) ConstraintViolationException(net.shibboleth.utilities.java.support.logic.ConstraintViolationException) WSSecurityException(org.apache.wss4j.common.ext.WSSecurityException) XMLStreamException(javax.xml.stream.XMLStreamException) CertificateEncodingException(java.security.cert.CertificateEncodingException) SecurityServiceException(ddf.security.service.SecurityServiceException) IOException(java.io.IOException) ServletException(javax.servlet.ServletException) ValidationException(ddf.security.samlp.ValidationException) MalformedURLException(java.net.MalformedURLException) ResponseUnmarshaller(ddf.security.liberty.paos.impl.ResponseUnmarshaller) RequestMarshaller(ddf.security.liberty.paos.impl.RequestMarshaller)

Example 2 with XMLObjectProviderRegistry

use of org.opensaml.core.xml.config.XMLObjectProviderRegistry in project cas by apereo.

the class OpenSamlConfigBean method init.

/**
     * Initialize opensaml.
     */
@PostConstruct
public void init() {
    LOGGER.info("Initializing OpenSaml configuration...");
    Assert.notNull(this.parserPool, "parserPool must not be null");
    try {
        InitializationService.initialize();
    } catch (final InitializationException e) {
        throw new RuntimeException("Exception initializing OpenSAML", e);
    }
    XMLObjectProviderRegistry registry;
    synchronized (ConfigurationService.class) {
        registry = ConfigurationService.get(XMLObjectProviderRegistry.class);
        if (registry == null) {
            LOGGER.debug("XMLObjectProviderRegistry did not exist in ConfigurationService, will be created");
            registry = new XMLObjectProviderRegistry();
            ConfigurationService.register(XMLObjectProviderRegistry.class, registry);
        }
    }
    registry.setParserPool(this.parserPool);
    this.builderFactory = registry.getBuilderFactory();
    Assert.notNull(this.builderFactory, "parserPool cannot be null");
    this.marshallerFactory = registry.getMarshallerFactory();
    Assert.notNull(this.marshallerFactory, "marshallerFactory cannot be null");
    this.unmarshallerFactory = registry.getUnmarshallerFactory();
    Assert.notNull(this.unmarshallerFactory, "unmarshallerFactory cannot be null");
    LOGGER.debug("Initialized OpenSaml successfully.");
}
Also used : XMLObjectProviderRegistry(org.opensaml.core.xml.config.XMLObjectProviderRegistry) ConfigurationService(org.opensaml.core.config.ConfigurationService) InitializationException(org.opensaml.core.config.InitializationException) PostConstruct(javax.annotation.PostConstruct)

Example 3 with XMLObjectProviderRegistry

use of org.opensaml.core.xml.config.XMLObjectProviderRegistry in project ddf by codice.

the class PaosInInterceptorTest method setup.

@Before
public void setup() {
    OpenSAMLUtil.initSamlEngine();
    XMLObjectProviderRegistry xmlObjectProviderRegistry = ConfigurationService.get(XMLObjectProviderRegistry.class);
    xmlObjectProviderRegistry.registerObjectProvider(Request.DEFAULT_ELEMENT_NAME, new RequestBuilder(), new RequestMarshaller(), new RequestUnmarshaller());
    xmlObjectProviderRegistry.registerObjectProvider(Response.DEFAULT_ELEMENT_NAME, new ResponseBuilder(), new ResponseMarshaller(), new ResponseUnmarshaller());
}
Also used : ResponseMarshaller(ddf.security.liberty.paos.impl.ResponseMarshaller) RequestUnmarshaller(ddf.security.liberty.paos.impl.RequestUnmarshaller) RequestBuilder(ddf.security.liberty.paos.impl.RequestBuilder) XMLObjectProviderRegistry(org.opensaml.core.xml.config.XMLObjectProviderRegistry) ResponseBuilder(ddf.security.liberty.paos.impl.ResponseBuilder) ResponseUnmarshaller(ddf.security.liberty.paos.impl.ResponseUnmarshaller) RequestMarshaller(ddf.security.liberty.paos.impl.RequestMarshaller) Before(org.junit.Before)

Aggregations

XMLObjectProviderRegistry (org.opensaml.core.xml.config.XMLObjectProviderRegistry)3 RequestBuilder (ddf.security.liberty.paos.impl.RequestBuilder)2 RequestMarshaller (ddf.security.liberty.paos.impl.RequestMarshaller)2 RequestUnmarshaller (ddf.security.liberty.paos.impl.RequestUnmarshaller)2 ResponseBuilder (ddf.security.liberty.paos.impl.ResponseBuilder)2 ResponseMarshaller (ddf.security.liberty.paos.impl.ResponseMarshaller)2 ResponseUnmarshaller (ddf.security.liberty.paos.impl.ResponseUnmarshaller)2 ValidationException (ddf.security.samlp.ValidationException)1 SecurityServiceException (ddf.security.service.SecurityServiceException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 MalformedURLException (java.net.MalformedURLException)1 CertificateEncodingException (java.security.cert.CertificateEncodingException)1 PostConstruct (javax.annotation.PostConstruct)1 ServletException (javax.servlet.ServletException)1 SOAPException (javax.xml.soap.SOAPException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 ConstraintViolationException (net.shibboleth.utilities.java.support.logic.ConstraintViolationException)1 WSSecurityException (org.apache.wss4j.common.ext.WSSecurityException)1 Before (org.junit.Before)1