Fork me on GitHub
#pedestal
<
2020-04-01
>
Ben Hammond21:04:48

I am trying to hook pedestal up to auth0 authentication using their `

com.auth0/mvc-auth-commons {:mvn/version "1.2.0"}
client library, and it expects to use a SessionManager to store nonce, etc whilst awaiting the authentication to return Vanilla pedestal throws me a
Caused by: java.lang.IllegalStateException: No SessionManager
	at org.eclipse.jetty.server.Request.getSession(Request.java:1568)
Is there any received wisdom around Session Managers or Auth0 in Pedestal? should I just apply https://stackoverflow.com/questions/19718159/java-lang-illegalstateexception-no-sessionmanager and hope for the best?

Ben Hammond22:04:16

which is passing a (SessionHandler)null to the ServletContextHandler

Ben Hammond22:04:18

but perhaps I get the chance to reshape that context a few lines further down at

(when context-configurator
  (context-configurator context))

Ben Hammond22:04:56

I might be able to abuse the options

{:context-configurator
      (fn [^ServletContextHandler sch]
          (set! (.-_options sch) ServletContextHandler/SESSIONS)

Ben Hammond22:04:27

although (set! (.-_options is looking a bit hacky...

Ben Hammond22:04:59

:io.pedestal.http/container-options
{:context-configurator
 (fn [^ServletContextHandler sch]
     (.insertHandler sch (SessionHandler.))
seems to do the trick though