Added checks and tests for iat/jti/sub

This commit is contained in:
Arun M 2017-12-29 01:10:41 +05:30
parent babdd4f0a6
commit 7ddf7ec3e9
9 changed files with 284 additions and 3 deletions

View file

@ -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