mirror of
https://github.com/arun11299/cpp-jwt.git
synced 2025-05-15 01:08:31 +00:00
Added checks and tests for iat/jti/sub
This commit is contained in:
parent
babdd4f0a6
commit
7ddf7ec3e9
9 changed files with 284 additions and 3 deletions
|
@ -194,6 +194,54 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Derived from VerificationError.
|
||||
* Thrown when the subject claim does not match
|
||||
* with the one provided as part of decode argument.
|
||||
*/
|
||||
class InvalidSubjectError final: public VerificationError
|
||||
{
|
||||
public:
|
||||
/**
|
||||
*/
|
||||
InvalidSubjectError(std::string msg)
|
||||
: VerificationError(std::move(msg))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Derived from VerificationError.
|
||||
* Thrown when verify_iat parameter is passed to
|
||||
* decode and IAT is not present.
|
||||
*/
|
||||
class InvalidIATError final: public VerificationError
|
||||
{
|
||||
public:
|
||||
/**
|
||||
*/
|
||||
InvalidIATError(std::string msg)
|
||||
: VerificationError(std::move(msg))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Derived from VerificationError.
|
||||
* Thrown when validate_jti is asked for
|
||||
* in decode and jti claim is not present.
|
||||
*/
|
||||
class InvalidJTIError final: public VerificationError
|
||||
{
|
||||
public:
|
||||
/**
|
||||
*/
|
||||
InvalidJTIError(std::string msg)
|
||||
: VerificationError(std::move(msg))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Derived from VerificationError.
|
||||
* Thrown when the token is decoded at a time before
|
||||
|
@ -225,6 +273,22 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Derived from VerificationError.
|
||||
* Thrown when there type expectation mismatch
|
||||
* while verifying the values of registered claim names.
|
||||
*/
|
||||
class TypeConversionError final: public VerificationError
|
||||
{
|
||||
public:
|
||||
/**
|
||||
*/
|
||||
TypeConversionError(std::string msg)
|
||||
: VerificationError(std::move(msg))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // END namespace jwt
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue