Skip to content

Commit

Permalink
Small fix for last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kürzeder committed Jul 24, 2019
1 parent af0aaec commit eda8b36
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions module/CFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,13 @@ int CFunctions::sign_jwt_token(lua_State* lua_vm)
}

// sign the token
std::string token;
if (std::strcmp(algorithm, "HS256") == 0)
token = jwt.sign(jwt::algorithm::hs256{ public_key });
else if (std::strcmp(algorithm, "RS256") == 0)
token = jwt.sign(jwt::algorithm::rs256{ public_key, private_key });
else
pModuleManager->ErrorPrintf("Error @ jwtSign, invalid algorithm has been passed.");

return token;
return jwt.sign(jwt::algorithm::hs256{ public_key });
if (std::strcmp(algorithm, "RS256") == 0)
return jwt.sign(jwt::algorithm::rs256{ public_key, private_key });

pModuleManager->ErrorPrintf("Error @ jwtSign, invalid algorithm has been passed.");
return {};
} catch(exception& e)
{
std::stringstream ss;
Expand Down

0 comments on commit eda8b36

Please sign in to comment.