Search in sources :

Example 1 with CertificateConstraintsType

use of org.apache.cxf.configuration.security.CertificateConstraintsType in project cxf by apache.

the class HTTPJettyTransportActivator method configureCertConstraints.

private void configureCertConstraints(TLSServerParameters p, String k, String v) {
    k = k.substring("certConstraints.".length());
    CertificateConstraintsType cct = p.getCertConstraints();
    if (cct == null) {
        cct = new CertificateConstraintsType();
        p.setCertConstraints(cct);
    }
    DNConstraintsType dnct = null;
    if (k.startsWith("SubjectDNConstraints.")) {
        dnct = cct.getSubjectDNConstraints();
        if (dnct == null) {
            dnct = new DNConstraintsType();
            cct.setSubjectDNConstraints(dnct);
        }
        k = k.substring("SubjectDNConstraints.".length());
    } else if (k.startsWith("IssuerDNConstraints.")) {
        dnct = cct.getIssuerDNConstraints();
        if (dnct == null) {
            dnct = new DNConstraintsType();
            cct.setIssuerDNConstraints(dnct);
        }
        k = k.substring("IssuerDNConstraints.".length());
    }
    if (dnct != null) {
        if ("combinator".equals(k)) {
            dnct.setCombinator(CombinatorType.fromValue(v));
        } else if ("RegularExpression".equals(k)) {
            dnct.getRegularExpression().add(k);
        }
    }
}
Also used : DNConstraintsType(org.apache.cxf.configuration.security.DNConstraintsType) CertificateConstraintsType(org.apache.cxf.configuration.security.CertificateConstraintsType)

Example 2 with CertificateConstraintsType

use of org.apache.cxf.configuration.security.CertificateConstraintsType in project cxf by apache.

the class HttpConduitConfigApplier method parseCertConstaints.

private void parseCertConstaints(TLSClientParameters p, String k, String v) {
    k = k.substring("certConstraints.".length());
    CertificateConstraintsType cct = p.getCertConstraints();
    if (cct == null) {
        cct = new CertificateConstraintsType();
        p.setCertConstraints(cct);
    }
    DNConstraintsType dnct = null;
    if (k.startsWith("SubjectDNConstraints.")) {
        dnct = cct.getSubjectDNConstraints();
        if (dnct == null) {
            dnct = new DNConstraintsType();
            cct.setSubjectDNConstraints(dnct);
        }
        k = k.substring("SubjectDNConstraints.".length());
    } else if (k.startsWith("IssuerDNConstraints.")) {
        dnct = cct.getIssuerDNConstraints();
        if (dnct == null) {
            dnct = new DNConstraintsType();
            cct.setIssuerDNConstraints(dnct);
        }
        k = k.substring("IssuerDNConstraints.".length());
    }
    if (dnct != null) {
        if ("combinator".equals(k)) {
            dnct.setCombinator(CombinatorType.fromValue(v));
        } else if ("RegularExpression".equals(k)) {
            dnct.getRegularExpression().add(k);
        }
    }
}
Also used : DNConstraintsType(org.apache.cxf.configuration.security.DNConstraintsType) CertificateConstraintsType(org.apache.cxf.configuration.security.CertificateConstraintsType)

Example 3 with CertificateConstraintsType

use of org.apache.cxf.configuration.security.CertificateConstraintsType in project cxf by apache.

the class HTTPUndertowTransportActivator method configureCertConstraints.

private void configureCertConstraints(TLSServerParameters p, String k, String v) {
    k = k.substring("certConstraints.".length());
    CertificateConstraintsType cct = p.getCertConstraints();
    if (cct == null) {
        cct = new CertificateConstraintsType();
        p.setCertConstraints(cct);
    }
    DNConstraintsType dnct = null;
    if (k.startsWith("SubjectDNConstraints.")) {
        dnct = cct.getSubjectDNConstraints();
        if (dnct == null) {
            dnct = new DNConstraintsType();
            cct.setSubjectDNConstraints(dnct);
        }
        k = k.substring("SubjectDNConstraints.".length());
    } else if (k.startsWith("IssuerDNConstraints.")) {
        dnct = cct.getIssuerDNConstraints();
        if (dnct == null) {
            dnct = new DNConstraintsType();
            cct.setIssuerDNConstraints(dnct);
        }
        k = k.substring("IssuerDNConstraints.".length());
    }
    if (dnct != null) {
        if ("combinator".equals(k)) {
            dnct.setCombinator(CombinatorType.fromValue(v));
        } else if ("RegularExpression".equals(k)) {
            dnct.getRegularExpression().add(k);
        }
    }
}
Also used : DNConstraintsType(org.apache.cxf.configuration.security.DNConstraintsType) CertificateConstraintsType(org.apache.cxf.configuration.security.CertificateConstraintsType)

Example 4 with CertificateConstraintsType

use of org.apache.cxf.configuration.security.CertificateConstraintsType in project cxf by apache.

the class JettyHTTPDestination method retrieveEngine.

/**
 * Post-configure retreival of server engine.
 */
protected void retrieveEngine() throws GeneralSecurityException, IOException {
    if (serverEngineFactory == null) {
        return;
    }
    engine = serverEngineFactory.retrieveJettyHTTPServerEngine(nurl.getPort());
    if (engine == null) {
        engine = serverEngineFactory.createJettyHTTPServerEngine(nurl.getHost(), nurl.getPort(), nurl.getProtocol());
    }
    assert engine != null;
    TLSServerParameters serverParameters = engine.getTlsServerParameters();
    if (serverParameters != null && serverParameters.getCertConstraints() != null) {
        CertificateConstraintsType constraints = serverParameters.getCertConstraints();
        if (constraints != null) {
            certConstraints = CertConstraintsJaxBUtils.createCertConstraints(constraints);
        }
    }
    // Spring configuration has configured the port for https.
    if (!nurl.getProtocol().equals(engine.getProtocol())) {
        throw new IllegalStateException("Port " + engine.getPort() + " is configured with wrong protocol \"" + engine.getProtocol() + "\" for \"" + nurl + "\"");
    }
}
Also used : CertificateConstraintsType(org.apache.cxf.configuration.security.CertificateConstraintsType) TLSServerParameters(org.apache.cxf.configuration.jsse.TLSServerParameters)

Aggregations

CertificateConstraintsType (org.apache.cxf.configuration.security.CertificateConstraintsType)4 DNConstraintsType (org.apache.cxf.configuration.security.DNConstraintsType)3 TLSServerParameters (org.apache.cxf.configuration.jsse.TLSServerParameters)1