krill icon indicating copy to clipboard operation
krill copied to clipboard

Extract the OpenID Connect mock to its own crate or use something else instead

Open ximon18 opened this issue 4 years ago • 3 comments

We're increasingly finding it would be useful to be able to run the mock as a standalone binary, and as we improve the mock we risk adding more and more Cargo dependencies just for the mock. As the mock is not part of Krill at all, and could be beneficial outside the Krill project to others, it would be good to extract the mock to its own crate on crates.io and to use it as a dev dependency from Krill. We could do that as a first very rough effort, but for it to be useful to others the hard-coded configuration (e.g. various users with special properties) should perhaps be removed and made possible to configure on the fly by giving the mock its own HTTP API to be used by tests.

Alternatively, explore existing options out there for testing OpenID Connect instead of rolling our own.

ximon18 avatar Feb 08 '21 12:02 ximon18

@ramosbugs: What do you use for testing the openid-connect Rust crate?

ximon18 avatar Feb 08 '21 12:02 ximon18

most of the openidconnect crate's tests are related to serialization and deserialization. there was a test suite that used the public OpenID Connect conformance tests previously, but that testing system got decommissioned in favor of a newer one, and I haven't had time to rewrite the tests to use it.

in terms of mocking HTTP requests and responses, the oauth2 crate does most of that work, e.g.: https://github.com/ramosbugs/oauth2-rs/blob/30eaa50c2310614fa075e2e61c07533855715f92/src/tests.rs#L292-L310. that's probably too low level for testing applications that consume the crate though.

ramosbugs avatar Feb 08 '21 21:02 ramosbugs

Thanks @ramosbugs !

ximon18 avatar Feb 08 '21 21:02 ximon18