I’m looking into PAC4J as a possible authentication solution for our pedestal app. It claims: > Available for most frameworks/tools (implementations): > https://github.com/pac4j/spring-webmvc-pac4j • https://github.com/pac4j/j2e-pac4j • https://github.com/pac4j/pac4j-springboot • https://github.com/bujiio/buji-pac4j • https://github.com/pac4j/spring-security-pac4j • https://github.com/pac4j/play-pac4j • https://github.com/pac4j/vertx-pac4j > https://github.com/pac4j/spark-pac4j • https://github.com/pac4j/javalin-pac4j • http://ratpack.io/manual/current/pac4j.html#pac4j • http://www.pippo.ro/doc/security.html#pac4j-integration • https://github.com/pac4j/undertow-pac4j • http://jooby.org/doc/pac4j > https://apereo.github.io/cas/6.2.x/integration/Delegate-Authentication.html • https://github.com/pac4j/jax-rs-pac4j • https://github.com/pac4j/dropwizard-pac4j • https://github.com/pac4j/lagom-pac4j • https://github.com/StackVista/akka-http-pac4j • http://knox.apache.org/books/knox-1-1-0/user-guide.html#Pac4j+Provider+-+CAS+/+OAuth+/+SAML+/+OpenID+Connect
Is one of those (e.g. JEE) something I could use in combination with pedestal?
@orestis I imagine you could use the Undertow adapter with pedestal’s :context-configurator
option
That’s assuming I use the undertow pedestal adapter, right?
We already use Undertow through immutant 🙂 immutant.web/run
can take an Undertow handler. But I’m not sure how you would then get the authenticated user from the pedestal request context
I’m pretty sure we’re using jetty ;)
You’re right 😛
Don’t mind us we work together!
@orestis I’m not familiar with pac4j but I suspect that the jee-pac4j would work. Based on the https://github.com/pac4j/jee-pac4j/wiki/Get-the-authenticated-user-profiles, you can get the authenticated user profile info of the servlet request which will be available in Pedestal’s Context Map. I’ve not gone through the pac4j docs in detail though so can’t say for certain.
Thanks @ddeaguiar - I guess then my question is how do I get hold of the servlet so I can bolt other things in top of it?
Although after looking deeper into pac4j I think it would make more sense to make a ring adapter or something similar so it can be made into something that integrates with the pedestals router
You can add servlet filters through a function specified in the :context-configurator
container option. We have a https://github.com/pedestal/pedestal/blob/master/samples/servlet-filters-gzip/src/gzip/service.clj#L61-L71 that demonstrates this.
An interceptor-based approach would be more idiomatic but I’m not sure what work is involved there