Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP#secure(...) doesn't allow null for truststore parameters #13

Open
sibwaf opened this issue Jun 24, 2017 · 2 comments
Open

HTTP#secure(...) doesn't allow null for truststore parameters #13

sibwaf opened this issue Jun 24, 2017 · 2 comments

Comments

@sibwaf
Copy link

sibwaf commented Jun 24, 2017

Spark for Java allows passing nulls for truststoreFile and truststorePassword, while Spark for Kotlin for some reason doesn't, because these parameters are specified as non-nullable.

Possible solutions:

  1. Just specify them as nullable
  2. Specify them as nullable and add a default value
  3. Add an overloading function which doesn't take truststore parameters at all
@perwendel
Copy link
Owner

perwendel commented Nov 20, 2017

Hmm, this should be fixed by the latest push to master. Please try it out!
Edit: this response was a bit stressed, I might be totally wrong

@sibwaf
Copy link
Author

sibwaf commented Nov 20, 2017

Nope, still no good.
There is still no Http#secure(...) overload that takes no truststore parameters. What I mean is there should be a method like Http#secure(keystoreFile, keystorePassword). Though I'm not completely sure this is valid, but it doesn't seem that truststore is required for SSL to work (I might be completely wrong).

Also DSL works kind of bad.

  1. When truststore parameters are not provided, it just crashes with this exception:
    java.lang.IllegalStateException: no valid keystore at org.eclipse.jetty.util.security.CertificateUtils.getKeyStore(CertificateUtils.java:48) at org.eclipse.jetty.util.ssl.SslContextFactory.loadTrustStore(SslContextFactory.java:1043) at org.eclipse.jetty.util.ssl.SslContextFactory.load(SslContextFactory.java:255) at org.eclipse.jetty.util.ssl.SslContextFactory.doStart(SslContextFactory.java:220) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113) at org.eclipse.jetty.server.SslConnectionFactory.doStart(SslConnectionFactory.java:72) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113) at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:270) at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:81) at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at org.eclipse.jetty.server.Server.doStart(Server.java:431) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at spark.embeddedserver.jetty.EmbeddedJettyServer.ignite(EmbeddedJettyServer.java:130) at spark.Service.lambda$init$2(Service.java:504) at java.lang.Thread.run(Thread.java:748)
  2. If route mappings are provided inside DSL configuration, HTTPS is ignored for them completely.
    ignite { secure { ... } get("/") { "Hey" } }
  3. Following code crashes, as it seems Spark is trying to create multiple servers for whatever reason:
    ignite { get("/") { "Hey1" } }.get("/") { "Hey2" }
  4. Stdout-debugging when igniting with DSL. Not good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants