playframework/playframework — pull request #2696 by wsargent (2014-04-20 23:24:34+00:00)
Title: Add configuration hooks into NettyServer createSSLEngine

This is needed for where the engine needs configuration (notably for client authentication) before being passed on to the SSLHandler. This could not happen previously under the old model. You'd think that sslContext.getDefaultParameters().setNeedClientAuth(true) would do this, but Netty uses the SSLEngine directly, whereas getDefaultParameters() acts on sockets.

So, added SSLEngineProvider with a default, following the SSLContextProvider model. This provides the normal behavior, but implementers can now do:

```
class NeedsClientAuthSSLEngineProvider extends SSLEngineProvider {
override def createSSLEngine(appProvider: ApplicationProvider, sslContext: SSLContext): SSLEngine = {
val engine = sslContext.createSSLEngine()
engine.setNeedClientAuth(true)
engine
}
}
```

Reference: https://stackoverflow.com/questions/9573894/set-up-netty-with-2-way-ssl-handsake-client-and-server-certificate