mirror of
https://github.com/allankoechke/jwt-cpp.git
synced 2026-11-30 10:18:40 +00:00
adding stream operators to claims
easier to parse and output claims
This commit is contained in:
@@ -803,6 +803,15 @@ namespace jwt {
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse input stream into wrapped json object
|
||||
* \return input stream
|
||||
*/
|
||||
inline std::istream& operator>>(std::istream& is)
|
||||
{
|
||||
return is >> val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type of contained object
|
||||
* \return Type
|
||||
@@ -1588,3 +1597,14 @@ namespace jwt {
|
||||
return decoded_jwt(token);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline std::istream& operator>>(std::istream& is, jwt::claim c)
|
||||
{
|
||||
return c.operator>>(is);
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, jwt::claim c)
|
||||
{
|
||||
return os << c.to_json();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user