@@ -3862,7 +3862,8 @@ namespace jwt {
38623862 using iterator = typename jwt_vector_t ::iterator;
38633863 using const_iterator = typename jwt_vector_t ::const_iterator;
38643864
3865- JWT_CLAIM_EXPLICIT jwks (const typename json_traits::string_type& str) {
3865+ template <typename Decode>
3866+ jwks (const typename json_traits::string_type& str, Decode decode) {
38663867 typename json_traits::value_type parsed_val;
38673868 if (!json_traits::parse (parsed_val, str)) throw error::invalid_json_exception ();
38683869
@@ -3871,9 +3872,16 @@ namespace jwt {
38713872
38723873 auto jwk_list = jwks_json.get_claim (" keys" ).as_array ();
38733874 std::transform (jwk_list.begin (), jwk_list.end (), std::back_inserter (jwk_claims),
3874- [](const typename json_traits::value_type& val) { return jwk_t { val} ; });
3875+ [& ](const typename json_traits::value_type& val) { return jwk_t ( val, decode) ; });
38753876 }
38763877
3878+ #ifndef JWT_DISABLE_BASE64
3879+ JWT_CLAIM_EXPLICIT jwks (const typename json_traits::string_type& str)
3880+ : jwks(str, [](const typename json_traits::string_type& str) {
3881+ return base::decode<alphabet::base64url>(base::pad<alphabet::base64url>(str));
3882+ }) {}
3883+ #endif
3884+
38773885 iterator begin () { return jwk_claims.begin (); }
38783886 iterator end () { return jwk_claims.end (); }
38793887 const_iterator cbegin () const { return jwk_claims.begin (); }
0 commit comments