mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-15 01:08:31 +00:00
Remove case insensitive compare for has_claim API
This commit is contained in:
parent
4a4217a9f4
commit
e813a75e27
5 changed files with 8 additions and 6 deletions
|
@ -563,7 +563,7 @@ public: // Exposed APIs
|
|||
/**
|
||||
* Checks whether a claim is present in the payload
|
||||
* or not.
|
||||
* @note: Claim name is case insensitive for this API.
|
||||
* @note: Claim name is case sensitive for this API.
|
||||
*/
|
||||
//TODO: Not all libc++ version agrees with this
|
||||
//because count() is not made const for is_transparent
|
||||
|
@ -659,25 +659,25 @@ private:
|
|||
|
||||
bool operator()(const std::string& lhs, const std::string& rhs) const
|
||||
{
|
||||
int ret = strcasecmp(lhs.c_str(), rhs.c_str());
|
||||
int ret = strcmp(lhs.c_str(), rhs.c_str());
|
||||
return (ret < 0);
|
||||
}
|
||||
|
||||
bool operator()(const jwt::string_view lhs, const jwt::string_view rhs) const
|
||||
{
|
||||
int ret = strcasecmp(lhs.data(), rhs.data());
|
||||
int ret = strcmp(lhs.data(), rhs.data());
|
||||
return (ret < 0);
|
||||
}
|
||||
|
||||
bool operator()(const std::string& lhs, const jwt::string_view rhs) const
|
||||
{
|
||||
int ret = strcasecmp(lhs.data(), rhs.data());
|
||||
int ret = strcmp(lhs.data(), rhs.data());
|
||||
return (ret < 0);
|
||||
}
|
||||
|
||||
bool operator()(const jwt::string_view lhs, const std::string& rhs) const
|
||||
{
|
||||
int ret = strcasecmp(lhs.data(), rhs.data());
|
||||
int ret = strcmp(lhs.data(), rhs.data());
|
||||
return (ret < 0);
|
||||
}
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -93,7 +93,9 @@ TEST (DecodeTest, DecodeHS256)
|
|||
|
||||
EXPECT_TRUE (obj.has_claim("iss"));
|
||||
EXPECT_TRUE (obj.payload().has_claim_with_value("iss", "arun.muralidharan"));
|
||||
EXPECT_TRUE (obj.has_claim("IAT"));
|
||||
|
||||
//Case sensitive search
|
||||
EXPECT_FALSE (obj.has_claim("IAT"));
|
||||
EXPECT_TRUE (obj.payload().has_claim_with_value(jwt::registered_claims::issued_at, 1513862371));
|
||||
|
||||
EXPECT_FALSE (obj.payload().has_claim_with_value(jwt::registered_claims::issued_at, 1513862372));
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue