Closed iherbig closed 4 months ago
It's been awhile but you understanding seems correct, why not just move it? I guess my question is why do you need copies?
My expectations is that it would be saved in an object and you could move it to the member variable and just reference that?
Does that not fit you use case?
Copying can very often be a required thing to do (especially in multithreaded code), so it definitely should be possible.
Looking at the error it seems like it fails to copy the claims member in jwk_claims, which is of type map_of_claims
, which is really just a wrapper around the json_traits::object_type
however both picojson::value
and map_of_claims
have a copy constructor, so I don't quite get why msvc complains.
EDIT: I added a copy to one of the test cases and it compiles fine in both clang/gcc, so I am not sure what msvc is up to here.
I assume you solved this but there is some example code in https://github.com/Thalhammer/jwt-cpp/pull/345 about how this could be done
What's your question?
Is it expected that jwt::jwks can't be cached?
Additional Context
As far as I understand, relying parties are expected to cache retrieved key sets indefinitely (or until a
kid
is seen which is not present in the key set). I've been forced to cache the raw JSON and re-parse withjwt::parse_jwks
every time a request comes in because attempting to cache the parsedjwt::jwks
fails to compile with an error indicating that the underlyingjwt::jwk
is non-copyable.This:
Results in this:
Is this a case of me missing something obvious? Or is this actually an issue?