@Override
public SslHandler createSslHandler(final Set<String> allowedKeys) {
+ // FIXME: we are ignoring passed in keys?!
return createSslHandlerFilteredByKeys();
}
private SslHandler createSslHandlerFilteredByKeys() {
- if (allowedDevicesMonitor.findAllowedKeys().isEmpty()) {
+ final var allowedKeys = allowedDevicesMonitor.findAllowedKeys();
+ if (allowedKeys.isEmpty()) {
LOG.error("No associated keys for TLS authentication were found");
throw new IllegalStateException("No associated keys for TLS authentication were found");
}
- return sslHandlerFactory.createSslHandler(allowedDevicesMonitor.findAllowedKeys());
+ return sslHandlerFactory.createSslHandler(allowedKeys);
}
}
\ No newline at end of file
import java.security.cert.CertificateFactory;
import java.util.Base64;
import java.util.Collection;
-import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@Override
public Set<String> findAllowedKeys() {
- return new HashSet<>(deviceToPrivateKey.values());
+ return Set.copyOf(deviceToPrivateKey.values());
}
@Override