Search in sources :

Example 1 with RequestBuilder

use of ddf.security.liberty.paos.impl.RequestBuilder 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 RequestBuilder

use of ddf.security.liberty.paos.impl.RequestBuilder in project ddf by codice.

the class IdpHandler method createPaosRequest.

private String createPaosRequest(HttpServletRequest request) throws WSSecurityException {
    String spIssuerId = getSpIssuerId();
    String spAssertionConsumerServiceUrl = getSpAssertionConsumerServiceUrl(spIssuerId);
    RequestBuilder requestBuilder = new RequestBuilder();
    Request paosRequest = requestBuilder.buildObject();
    paosRequest.setResponseConsumerURL(spAssertionConsumerServiceUrl);
    paosRequest.setMessageID(createRelayState(request));
    paosRequest.setService(Request.ECP_SERVICE);
    paosRequest.setSOAP11MustUnderstand(true);
    paosRequest.setSOAP11Actor(HTTP_SCHEMAS_XMLSOAP_ORG_SOAP_ACTOR_NEXT);
    return convertXmlObjectToString(paosRequest);
}
Also used : RequestBuilder(ddf.security.liberty.paos.impl.RequestBuilder) AuthnRequest(org.opensaml.saml.saml2.core.AuthnRequest) HttpServletRequest(javax.servlet.http.HttpServletRequest) ServletRequest(javax.servlet.ServletRequest) Request(ddf.security.liberty.paos.Request)

Example 3 with RequestBuilder

use of ddf.security.liberty.paos.impl.RequestBuilder 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)

Example 4 with RequestBuilder

use of ddf.security.liberty.paos.impl.RequestBuilder in project ddf by codice.

the class IdpHandler method createEcpRequest.

private String createEcpRequest() throws WSSecurityException {
    org.opensaml.saml.saml2.ecp.impl.RequestBuilder requestBuilder = new org.opensaml.saml.saml2.ecp.impl.RequestBuilder();
    org.opensaml.saml.saml2.ecp.Request ecpRequest = requestBuilder.buildObject();
    ecpRequest.setSOAP11MustUnderstand(true);
    ecpRequest.setSOAP11Actor(HTTP_SCHEMAS_XMLSOAP_ORG_SOAP_ACTOR_NEXT);
    Issuer issuer = issuerBuilder.buildObject();
    issuer.setValue(getSpIssuerId());
    ecpRequest.setIssuer(issuer);
    IDPListBuilder idpListBuilder = new IDPListBuilder();
    IDPList idpList = idpListBuilder.buildObject();
    IDPEntryBuilder idpEntryBuilder = new IDPEntryBuilder();
    IDPEntry idpEntry = idpEntryBuilder.buildObject();
    idpEntry.setProviderID(idpMetadata.getEntityId());
    idpEntry.setName(idpMetadata.getSingleSignOnLocation());
    idpEntry.setLoc(idpMetadata.getSingleSignOnLocation());
    idpList.getIDPEntrys().add(idpEntry);
    ecpRequest.setIDPList(idpList);
    return convertXmlObjectToString(ecpRequest);
}
Also used : IDPEntryBuilder(org.opensaml.saml.saml2.core.impl.IDPEntryBuilder) RequestBuilder(ddf.security.liberty.paos.impl.RequestBuilder) Issuer(org.opensaml.saml.saml2.core.Issuer) IDPList(org.opensaml.saml.saml2.core.IDPList) IDPEntry(org.opensaml.saml.saml2.core.IDPEntry) IDPListBuilder(org.opensaml.saml.saml2.core.impl.IDPListBuilder)

Aggregations

RequestBuilder (ddf.security.liberty.paos.impl.RequestBuilder)4 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 XMLObjectProviderRegistry (org.opensaml.core.xml.config.XMLObjectProviderRegistry)2 Request (ddf.security.liberty.paos.Request)1 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 ServletException (javax.servlet.ServletException)1 ServletRequest (javax.servlet.ServletRequest)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 SOAPException (javax.xml.soap.SOAPException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 ConstraintViolationException (net.shibboleth.utilities.java.support.logic.ConstraintViolationException)1