@@ -2102,10 +2102,6 @@ namespace jwt {
21022102 is_count_signature<object_type, string_type>::value &&
21032103 is_subcription_operator_signature<object_type, value_type, string_type>::value &&
21042104 is_at_const_signature<object_type, value_type, string_type>::value;
2105-
2106- static constexpr auto supports_claims_transform =
2107- value && is_detected<has_value_type, object_type>::value &&
2108- std::is_same<typename object_type::value_type, std::pair<const string_type, value_type>>::value;
21092105 };
21102106
21112107 template <typename value_type, typename array_type>
@@ -2329,10 +2325,8 @@ namespace jwt {
23292325
23302326 namespace details {
23312327 template <typename json_traits>
2332- class map_of_claims {
2328+ struct map_of_claims {
23332329 typename json_traits::object_type claims;
2334-
2335- public:
23362330 using basic_claim_t = basic_claim<json_traits>;
23372331 using iterator = typename json_traits::object_type::iterator;
23382332 using const_iterator = typename json_traits::object_type::const_iterator;
@@ -2386,21 +2380,6 @@ namespace jwt {
23862380 if (!has_claim (name)) throw error::claim_not_present_exception ();
23872381 return basic_claim_t {claims.at (name)};
23882382 }
2389-
2390- std::unordered_map<typename json_traits::string_type, basic_claim_t > get_claims () const {
2391- static_assert (
2392- details::is_valid_json_object<typename json_traits::value_type, typename json_traits::string_type,
2393- typename json_traits::object_type>::supports_claims_transform,
2394- " currently there is a limitation on the internal implemantation of the `object_type` to have an "
2395- " `std::pair` like `value_type`" );
2396-
2397- std::unordered_map<typename json_traits::string_type, basic_claim_t > res;
2398- std::transform (claims.begin (), claims.end (), std::inserter (res, res.end ()),
2399- [](const typename json_traits::object_type::value_type& val) {
2400- return std::make_pair (val.first , basic_claim_t {val.second });
2401- });
2402- return res;
2403- }
24042383 };
24052384 } // namespace details
24062385
@@ -2701,19 +2680,15 @@ namespace jwt {
27012680 */
27022681 const typename json_traits::string_type& get_signature_base64 () const noexcept { return signature_base64; }
27032682 /* *
2704- * Get all payload claims
2683+ * Get all payload as JSON object
27052684 * \return map of claims
27062685 */
2707- std::unordered_map<typename json_traits::string_type, basic_claim_t > get_payload_claims () const {
2708- return this ->payload_claims .get_claims ();
2709- }
2686+ typename json_traits::object_type get_payload_json () const { return this ->payload_claims .claims ; }
27102687 /* *
2711- * Get all header claims
2688+ * Get all header as JSON object
27122689 * \return map of claims
27132690 */
2714- std::unordered_map<typename json_traits::string_type, basic_claim_t > get_header_claims () const {
2715- return this ->header_claims .get_claims ();
2716- }
2691+ typename json_traits::object_type get_header_json () const { return this ->header_claims .claims ; }
27172692 /* *
27182693 * Get a payload claim by name
27192694 *
@@ -3588,9 +3563,7 @@ namespace jwt {
35883563 * Get all jwk claims
35893564 * \return Map of claims
35903565 */
3591- std::unordered_map<typename json_traits::string_type, basic_claim_t > get_claims () const {
3592- return this ->jwk_claims .get_claims ();
3593- }
3566+ typename json_traits::object_type get_claims () const { return this ->jwk_claims .claims ; }
35943567 };
35953568
35963569 /* *
0 commit comments