@@ -808,7 +808,7 @@ namespace jwt {
808
808
* \brief Load a public key from a string.
809
809
*
810
810
* The string should contain a pem encoded certificate or public key
811
- *
811
+ *
812
812
* \deprecated Use the templated version helper::load_private_key_from_string with error::ecdsa_error
813
813
*
814
814
* \param key String containing the certificate encoded as pem
@@ -872,7 +872,7 @@ namespace jwt {
872
872
* The string should contain a pem encoded certificate or public key
873
873
*
874
874
* \deprecated Use the templated version helper::load_private_key_from_string with error::ecdsa_error
875
- *
875
+ *
876
876
* \param key String containing the certificate or key encoded as pem
877
877
* \param password Password used to decrypt certificate or key (leave empty if not encrypted)
878
878
* \throw ecdsa_exception if an error occurred
@@ -887,7 +887,7 @@ namespace jwt {
887
887
888
888
/* *
889
889
* \brief Load a private key from a string.
890
- *
890
+ *
891
891
* \deprecated Use the templated version helper::load_private_key_from_string with error::ecdsa_error
892
892
*
893
893
* \param key String containing a private key as pem
@@ -1077,7 +1077,7 @@ namespace jwt {
1077
1077
* \brief Load a private key from a string.
1078
1078
*
1079
1079
* \deprecated Use the templated version helper::load_private_key_from_string with error::ecdsa_error
1080
- *
1080
+ *
1081
1081
* \param key String containing a private key as pem
1082
1082
* \param password Password used to decrypt key (leave empty if not encrypted)
1083
1083
* \throw ecdsa_exception if an error occurred
@@ -1372,7 +1372,7 @@ namespace jwt {
1372
1372
struct hmacsha {
1373
1373
/* *
1374
1374
* Construct new hmac algorithm
1375
- *
1375
+ *
1376
1376
* \param key Key to use for HMAC
1377
1377
* \param md Pointer to hash function
1378
1378
* \param name Name of the algorithm
@@ -1381,7 +1381,7 @@ namespace jwt {
1381
1381
: secret(std::move(key)), md(md), alg_name(std::move(name)) {}
1382
1382
/* *
1383
1383
* Sign jwt data
1384
- *
1384
+ *
1385
1385
* \param data The data to sign
1386
1386
* \param ec error_code filled with details on error
1387
1387
* \return HMAC signature for the given data
@@ -1402,7 +1402,7 @@ namespace jwt {
1402
1402
}
1403
1403
/* *
1404
1404
* Check if signature is valid
1405
- *
1405
+ *
1406
1406
* \param data The data to check signature against
1407
1407
* \param signature Signature provided by the jwt
1408
1408
* \param ec Filled with details about failure.
@@ -1423,7 +1423,7 @@ namespace jwt {
1423
1423
}
1424
1424
/* *
1425
1425
* Returns the algorithm name provided to the constructor
1426
- *
1426
+ *
1427
1427
* \return algorithm's name
1428
1428
*/
1429
1429
std::string name () const { return alg_name; }
@@ -1442,7 +1442,7 @@ namespace jwt {
1442
1442
struct rsa {
1443
1443
/* *
1444
1444
* Construct new rsa algorithm
1445
- *
1445
+ *
1446
1446
* \param public_key RSA public key in PEM format
1447
1447
* \param private_key RSA private key or empty string if not available. If empty, signing will always fail.
1448
1448
* \param public_key_password Password to decrypt public key pem.
@@ -1495,7 +1495,7 @@ namespace jwt {
1495
1495
}
1496
1496
/* *
1497
1497
* Check if signature is valid
1498
- *
1498
+ *
1499
1499
* \param data The data to check signature against
1500
1500
* \param signature Signature provided by the jwt
1501
1501
* \param ec Filled with details on failure
@@ -2053,13 +2053,13 @@ namespace jwt {
2053
2053
};
2054
2054
/* *
2055
2055
* RS256 algorithm.
2056
- *
2056
+ *
2057
2057
* This data structure is used to describe the RSA256 and can be used to verify JWTs
2058
2058
*/
2059
2059
struct rs256 : public rsa {
2060
2060
/* *
2061
2061
* \brief Construct new instance of algorithm
2062
- *
2062
+ *
2063
2063
* \param public_key RSA public key in PEM format
2064
2064
* \param private_key RSA private key or empty string if not available. If empty, signing will always fail.
2065
2065
* \param public_key_password Password to decrypt public key pem.
@@ -2459,11 +2459,13 @@ namespace jwt {
2459
2459
struct is_valid_json_array {
2460
2460
template <typename T>
2461
2461
using value_type_t = typename T::value_type;
2462
+ using front_base_type = typename std::decay<decltype(std::declval<array_type>().front())>::type;
2462
2463
2463
2464
static constexpr auto value = std::is_constructible<value_type, array_type>::value &&
2464
2465
is_iterable<array_type>::value &&
2465
2466
is_detected<value_type_t , array_type>::value &&
2466
- std::is_same<typename array_type::value_type, value_type>::value;
2467
+ std::is_same<typename array_type::value_type, value_type>::value &&
2468
+ std::is_same<front_base_type, value_type>::value;
2467
2469
};
2468
2470
2469
2471
template <typename string_type, typename integer_type>
@@ -3728,9 +3730,9 @@ namespace jwt {
3728
3730
* Specify a claim to check for using the specified operation.
3729
3731
* This is helpful for implementating application specific authentication checks
3730
3732
* such as the one seen in partial-claim-verifier.cpp
3731
- *
3733
+ *
3732
3734
* \snippet{trimleft} partial-claim-verifier.cpp verifier check custom claim
3733
- *
3735
+ *
3734
3736
* \param name Name of the claim to check for
3735
3737
* \param fn Function to use for verifying the claim
3736
3738
* \return *this to allow chaining
@@ -3743,9 +3745,9 @@ namespace jwt {
3743
3745
/* *
3744
3746
* Specify a claim to check for equality (both type & value).
3745
3747
* See the private-claims.cpp example.
3746
- *
3748
+ *
3747
3749
* \snippet{trimleft} private-claims.cpp verify exact claim
3748
- *
3750
+ *
3749
3751
* \param name Name of the claim to check for
3750
3752
* \param c Claim to check for
3751
3753
* \return *this to allow chaining
@@ -3756,13 +3758,13 @@ namespace jwt {
3756
3758
3757
3759
/* *
3758
3760
* \brief Add an algorithm available for checking.
3759
- *
3761
+ *
3760
3762
* This is used to handle incomming tokens for predefined algorithms
3761
3763
* which the authorization server is provided. For example a small system
3762
3764
* where only a single RSA key-pair is used to sign tokens
3763
- *
3765
+ *
3764
3766
* \snippet{trimleft} example/rsa-verify.cpp allow rsa algorithm
3765
- *
3767
+ *
3766
3768
* \tparam Algorithm any algorithm such as those provided by jwt::algorithm
3767
3769
* \param alg Algorithm to allow
3768
3770
* \return *this to allow chaining
@@ -4122,18 +4124,18 @@ namespace jwt {
4122
4124
* Default clock class using std::chrono::system_clock as a backend.
4123
4125
*/
4124
4126
struct default_clock {
4125
- /* *
4127
+ /* *
4126
4128
* Gets the current system time
4127
- * \return time_point of the host system
4129
+ * \return time_point of the host system
4128
4130
*/
4129
4131
date now () const { return date::clock::now (); }
4130
4132
};
4131
4133
4132
4134
/* *
4133
4135
* Create a verifier using the default_clock.
4134
- *
4135
- *
4136
- *
4136
+ *
4137
+ *
4138
+ *
4137
4139
* \param c Clock instance to use
4138
4140
* \return verifier instance
4139
4141
*/
@@ -4153,7 +4155,7 @@ namespace jwt {
4153
4155
/* *
4154
4156
* \brief Decode a token. This can be used to to help access important feild like 'x5c'
4155
4157
* for verifying tokens. See associated example rsa-verify.cpp for more details.
4156
- *
4158
+ *
4157
4159
* \tparam json_traits JSON implementation traits
4158
4160
* \tparam Decode is callable, taking a string_type and returns a string_type.
4159
4161
* It should ensure the padding of the input and then base64url decode and
@@ -4172,7 +4174,7 @@ namespace jwt {
4172
4174
/* *
4173
4175
* Decode a token. This can be used to to help access important feild like 'x5c'
4174
4176
* for verifying tokens. See associated example rsa-verify.cpp for more details.
4175
- *
4177
+ *
4176
4178
* \tparam json_traits JSON implementation traits
4177
4179
* \param token Token to decode
4178
4180
* \return Decoded token
@@ -4194,10 +4196,10 @@ namespace jwt {
4194
4196
return jwk<json_traits>(jwk_);
4195
4197
}
4196
4198
/* *
4197
- * Parse a JSON Web Key Set. This can be used to to help access
4199
+ * Parse a JSON Web Key Set. This can be used to to help access
4198
4200
* important feild like 'x5c' for verifying tokens. See example
4199
4201
* jwks-verify.cpp for more information.
4200
- *
4202
+ *
4201
4203
* \tparam json_traits JSON implementation traits
4202
4204
* \param jwks_ string buffer containing the JSON object
4203
4205
* \return Parsed JSON object containing the data of the JWK SET string
0 commit comments