Example #1
0
 def clean_private_key(self):
     private_key = self.cleaned_data.get('private_key')
     try:
         sign_poet({'iat': 1}, self.cleaned_data.get('private_key'),
                   self.cleaned_data.get('exp'))
     except ValueError:
         raise forms.ValidationError("The private key is invalid.")
     return private_key
 def clean_private_key(self):
     private_key = self.cleaned_data.get('private_key')
     try:
         sign_poet({'iat': 1}, self.cleaned_data.get('private_key'),
                   self.cleaned_data.get('exp'))
     except ValueError:
         raise forms.ValidationError("The private key is invalid.")
     return private_key
Example #3
0
 def create_jwt(self):
     return sign_poet(self.create_payload(),
                      self.cleaned_data.get('private_key'),
                      self.cleaned_data.get('iss'),
                      int(self.cleaned_data.get('exp')))
    def test_sign_poet_happy(self):
        result = sign_poet({"sub":"someapp.foo.com"}, test_private_key, "tranparenthealth.org", 3600)

        """Test the POET JWT signing by ensuring exactly two periods in output."""
        self.assertEqual(result.count('.'), 2)
 def create_jwt(self):
     return sign_poet(self.create_payload(),
                      self.cleaned_data.get('private_key'),
                      self.cleaned_data.get('exp'))