()
| 51 | |
| 52 | @server.route('/validate', methods=['POST']) |
| 53 | def validate(): |
| 54 | encoded_jwt = request.headers['Authorization'] |
| 55 | |
| 56 | if not encoded_jwt: |
| 57 | return 'Unauthorized', 401, {'WWW-Authenticate': 'Basic realm="Login required!"'} |
| 58 | |
| 59 | encoded_jwt = encoded_jwt.split(' ')[1] |
| 60 | try: |
| 61 | decoded_jwt = jwt.decode(encoded_jwt, os.environ['JWT_SECRET'], algorithms=["HS256"]) |
| 62 | except: |
| 63 | return 'Unauthorized', 401, {'WWW-Authenticate': 'Basic realm="Login required!"'} |
| 64 | |
| 65 | return decoded_jwt, 200 |
| 66 | |
| 67 | if __name__ == '__main__': |
| 68 | server.run(host='0.0.0.0', port=5000) |
nothing calls this directly
no outgoing calls
no test coverage detected