That does look a lot nicer, but (as is) it runs into type trouble:
- getMilliseconds() returns an Option, Duration requires a Long or Int
- flatMap requires a lambda that returns an option
- toSeconds returns a Long
- maxAge is an Option[Int]

(Basically the stuff my original patch was working around, albeit in a convoluted way.)

To make your proposal work we could switch to a map, and change maxAge to an Option[Long] i.e.

<pre><code>
override val maxAge = Play.maybeApplication.map(c => Duration(c.configuration.getMilliseconds("session.maxAge"), MILLISECONDS).toSeconds)
</code></pre>

I'll write that up as a patch (with corresponding fixes elsewhere) if there's no objection to changing the type of maxAge?