use of org.apache.cxf.configuration.security.ClientAuthentication in project cxf by apache.
the class HTTPUndertowTransportActivator method createTlsServerParameters.
private TLSServerParameters createTlsServerParameters(Dictionary<String, ?> d) {
Enumeration<String> keys = d.keys();
TLSServerParameters p = null;
SecureRandomParameters srp = null;
KeyManagersType kmt = null;
TrustManagersType tmt = null;
boolean enableRevocation = false;
while (keys.hasMoreElements()) {
String k = keys.nextElement();
if (k.startsWith("tlsServerParameters.")) {
if (p == null) {
p = new TLSServerParameters();
}
String v = (String) d.get(k);
k = k.substring("tlsServerParameters.".length());
if ("secureSocketProtocol".equals(k)) {
p.setSecureSocketProtocol(v);
} else if ("jsseProvider".equals(k)) {
p.setJsseProvider(v);
} else if ("certAlias".equals(k)) {
p.setCertAlias(v);
} else if ("enableRevocation".equals(k)) {
enableRevocation = Boolean.parseBoolean(v);
} else if ("clientAuthentication.want".equals(k)) {
if (p.getClientAuthentication() == null) {
p.setClientAuthentication(new ClientAuthentication());
}
p.getClientAuthentication().setWant(Boolean.parseBoolean(v));
} else if ("clientAuthentication.required".equals(k)) {
if (p.getClientAuthentication() == null) {
p.setClientAuthentication(new ClientAuthentication());
}
p.getClientAuthentication().setRequired(Boolean.parseBoolean(v));
} else if (k.startsWith("certConstraints.")) {
configureCertConstraints(p, k, v);
} else if (k.startsWith("secureRandomParameters.")) {
srp = configureSecureRandom(srp, k, v);
} else if (k.startsWith("cipherSuitesFilter.")) {
configureCipherSuitesFilter(p, k, v);
} else if (k.startsWith("cipherSuites")) {
StringTokenizer st = new StringTokenizer(v, ",");
while (st.hasMoreTokens()) {
p.getCipherSuites().add(st.nextToken());
}
} else if (k.startsWith("excludeProtocols")) {
StringTokenizer st = new StringTokenizer(v, ",");
while (st.hasMoreTokens()) {
p.getExcludeProtocols().add(st.nextToken());
}
} else if (k.startsWith("trustManagers.")) {
tmt = getTrustManagers(tmt, k.substring("trustManagers.".length()), v);
} else if (k.startsWith("keyManagers.")) {
kmt = getKeyManagers(kmt, k.substring("keyManagers.".length()), v);
}
}
}
try {
if (srp != null) {
p.setSecureRandom(TLSParameterJaxBUtils.getSecureRandom(srp));
}
if (kmt != null) {
p.setKeyManagers(TLSParameterJaxBUtils.getKeyManagers(kmt));
}
if (tmt != null) {
p.setTrustManagers(TLSParameterJaxBUtils.getTrustManagers(tmt, enableRevocation));
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
return p;
}
Aggregations