mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-15 01:08:31 +00:00
Added documentation comments to jwt.hpp
This commit is contained in:
parent
a5e18cc4f4
commit
3d9e15b5c8
5 changed files with 310 additions and 44 deletions
|
@ -1,8 +1,30 @@
|
|||
#include <iostream>
|
||||
#include <map>
|
||||
#include <chrono>
|
||||
#include "gtest/gtest.h"
|
||||
#include "jwt/jwt.hpp"
|
||||
|
||||
TEST (EncodeTest, TestRemoveClaim)
|
||||
{
|
||||
using namespace jwt::params;
|
||||
|
||||
jwt::jwt_object obj{algorithm("hs256"), secret("secret")};
|
||||
|
||||
obj.add_claim("iss", "arun.muralidharan")
|
||||
.add_claim("sub", "admin")
|
||||
.add_claim("id", "a-b-c-d-e-f-1-2-3")
|
||||
.add_claim("iat", 1513862371)
|
||||
.add_claim("exp", std::chrono::system_clock::now());
|
||||
|
||||
EXPECT_TRUE (obj.has_claim(jwt::registered_claims::expiration));
|
||||
|
||||
obj.remove_claim("exp");
|
||||
EXPECT_FALSE (obj.has_claim(jwt::registered_claims::expiration));
|
||||
|
||||
obj.remove_claim(jwt::registered_claims::subject);
|
||||
EXPECT_FALSE (obj.has_claim("sub"));
|
||||
}
|
||||
|
||||
TEST (EncodeTest, StrEncodeHS256_1)
|
||||
{
|
||||
using namespace jwt::params;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue