Remove the use of static deletors

This commit is contained in:
Arun M 2017-11-23 15:10:35 +05:30
parent 53a281640f
commit 0751d033dc
4 changed files with 79 additions and 54 deletions

View file

@ -304,14 +304,17 @@ jwt_object jwt_decode(const string_view encoded_str, const string_view key, bool
auto parts = jwt_object::three_parts(encoded_str);
//throws verification error
jobj.header(jwt_header{parts[0]});
//throws verification error
jobj.payload(jwt_payload{parts[1]});
jwt_signature jsign{key};
//length of the encoded header and payload only.
//Addition of '1' to account for the '.' character.
auto l = parts[0].length() + 1 + parts[1].length();
jsign.verify(jobj.header(), encoded_str.substr(0, l), encoded_str);
jsign.verify(jobj.header(), encoded_str.substr(0, l), parts[2]);
return jobj;
}