Fork me on GitHub
#pedestal
<
2021-01-15
>
orestis10:01:39

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

jkxyz11:01:29

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

orestis11:01:33

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

jkxyz11:01:57

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

orestis11:01:12

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

jkxyz11:01:40

You’re right 😛

orestis11:01:36

Don’t mind us we work together!

ddeaguiar14:01:26

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

orestis15:01:21

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?

orestis15:01:48

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

ddeaguiar15:01:36

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.

ddeaguiar15:01:09

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