Monday, 22 April 2019

Check the Integrity of Message to an API Response message using JWT-extended in Flask

Assuming that I have an API endpoint api.example.com/v1/data and a GET method with @jwt-required similar to this:

from flask_jwt_extended import jwt_required
from flask_restful import Resource

class Data(Resource):
    @jwt_required
    def get(self):
        """
        GET Response message.
        """
        return {"message":"important-info", "ts":datetime}, 200

So to GET this message you need to authenticate yourself with a Bearer "access_token" in the request's header.

How could I create an HMAC for this message. Ideally I would like to add the access token, so to check the integrity of the whole message.

So I would like to have an extra field in the returned JSON called checksum with a value hash(whole_message).



from Check the Integrity of Message to an API Response message using JWT-extended in Flask

No comments:

Post a Comment