pedestal

orestis 2021-01-15T10:43:39.002100Z

Is one of those (e.g. JEE) something I could use in combination with pedestal?

jkxyz 2021-01-15T11:07:29.004300Z

@orestis I imagine you could use the Undertow adapter with pedestal’s :context-configurator option

orestis 2021-01-15T11:10:33.004900Z

That’s assuming I use the undertow pedestal adapter, right?

jkxyz 2021-01-15T11:17:57.007200Z

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

orestis 2021-01-15T11:21:12.007800Z

I’m pretty sure we’re using jetty ;)

jkxyz 2021-01-15T11:28:40.008500Z

You’re right 😛

orestis 2021-01-15T11:31:36.008900Z

Don’t mind us we work together!

2021-01-15T14:52:26.011900Z

@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.

orestis 2021-01-15T15:17:21.013200Z

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?

orestis 2021-01-15T15:18:48.014600Z

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

2021-01-15T15:22:36.016100Z

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.

2021-01-15T15:23:09.016700Z

An interceptor-based approach would be more idiomatic but I’m not sure what work is involved there