juxt

2020-04-16T09:09:04.033600Z

@malcolmsparks A first question around the OpenId code: https://github.com/juxt/apex/issues/3 . So far it’s pretty solid! I think I have some suggestions for extracting it into a seperate library, but the core looks good.

malcolmsparks 2020-04-16T09:13:56.035Z

Hi @jeroenvandijk - thanks - actually it's intended to be in a separate lib/jar so it can be used independently, but the idea is that all these components work well together and support the OpenAPI standard. There are OpenID-Connect declarations in OpenAPI.

2020-04-16T09:16:24.036900Z

Yes that’s great and how I understood it. I’m using it now partially as a library. I only had to hack in oic.clj. In order to use my own http client and some other things

malcolmsparks 2020-04-16T09:16:32.037100Z

(I've commented on your issue to keep the discussion there)

2020-04-16T09:16:44.037300Z

Thank you!

malcolmsparks 2020-04-16T09:17:29.038100Z

Thanks for engaging with this - it's new code and hasn't had a lot of exposure yet - but I'm really trying hard to code against the standards and go the extra mile to implement the security stuff

2020-04-16T09:17:45.038300Z

Yeah that’s great!

2020-04-16T09:18:51.039600Z

I’ve dealt with openid in a different way, so it’s not all new, but you did a great job in actually checking the specs 🙂 I’m looking forward to use it and contribute back. Hope I can help you make it into a standard clojure library that is well tested and secure

dominicm 2020-04-16T10:30:39.040400Z

@jeroenvandijk any reason to change the http client other than personal preference?

2020-04-16T10:30:57.040700Z

yes, to be able to mock request, record request

2020-04-16T10:31:07.041Z

also for the nonce generation i want to do the same

2020-04-16T10:31:43.041700Z

And another reason, the chosen http client doesn’t exist on java 8

2020-04-16T10:31:58.042100Z

So I my suggestion would be to choose a protocol that can be implemented

2020-04-16T10:32:23.042600Z

Hopefully we can choose/create a protocol that can be supported by the greater clojure community

2020-04-16T10:32:54.043300Z

That is also something that is missing. Too much code that cannot be reused because of this missing abstraction

2020-04-16T10:34:27.044200Z

I will do a proposal later of how I think this could be solved

malcolmsparks 2020-04-16T14:11:12.045900Z

That's useful to know. I've been trying to reduce the number of dependencies necessary, hence the design decision to use internal JDK packages wherever possible, and http://java.net.http struck me as a very nice http client - sad that it isn't available in Java 8 though. My plan for Apex is rather long-term so I expect the adoption of JDK 11+ will increase.

malcolmsparks 2020-04-16T14:11:45.046500Z

That said, there's no reason there can't be an option map with a callback function for nonce creation and http code exchange.

malcolmsparks 2020-04-16T14:12:18.047100Z

And yes, for testing, that would make sense too. You don't want to have a auth server in your testing setup.

dominicm 2020-04-16T14:23:43.048100Z

The hard part is defining that interface really. Eg aws api takes a particular map and returns a channel.

2020-04-16T15:00:19.048700Z

I think the hardest part is the response body? Maybe inspiration could be taken from https://github.com/ring-clojure/ring/blob/6a1c7a17f9d1979ac00e3cb689ba0c1f61fe716b/ring-core/src/ring/core/protocols.clj#L19

2020-04-16T15:03:14.050800Z

I don’t have an opinion on the jdk client. I can imagine it’s a very well tested client. In order to create testable distributed architectures I always try to abstract the http layer (up until the level of dns). This makes tests less fragile as you don’t have start (and stop) servers

2020-04-16T15:04:03.051600Z

Ideally, the whole Clojure community would do this and we could be able to mock all external requests (like how you can do this in Ruby with https://github.com/vcr/vcr)