Beispiel #1
0
    def test_auth_request_token_encoding(self):
        auth_request = AuthRequest(self.private_key_hex, self.public_key_hex,
                                   self.domain, self.permissions)
        auth_request_token = auth_request.token()

        is_valid_token = AuthRequest.verify(auth_request_token, self.resolver)
        self.assertTrue(is_valid_token)

        decoded_token = AuthRequest.decode(auth_request_token)
        self.assertEqual(decoded_token['payload']['issuer']['publicKey'],
                         self.public_key_hex)
    def test_auth_request_token_encoding(self):
        auth_request = AuthRequest(
            self.private_key_hex, self.public_key_hex,
            self.domain, self.permissions)
        auth_request_token = auth_request.token()

        is_valid_token = AuthRequest.verify(auth_request_token, self.resolver)
        self.assertTrue(is_valid_token)

        decoded_token = AuthRequest.decode(auth_request_token)
        self.assertEqual(decoded_token['payload']['issuer']['publicKey'], self.public_key_hex)
    def test_auth_request_token_encoding(self):
        # valid AuthRequest
        auth_request = AuthRequest(self.private_key_hex, self.domain_name)
        auth_request_token = auth_request.token()

        decoded_token = AuthRequest.decode(auth_request_token)
        payload = decoded_token['payload']
        self.assertEqual(payload['public_keys'][0], self.public_key_hex)
        self.assertEqual(get_address_from_did(payload['iss']), self.public_key.address())
        self.assertEqual(payload['scopes'], [])
        self.assertEqual(payload['manifest_uri'], self.domain_name + '/manifest.json')

        self.assertTrue(AuthRequest.verify(auth_request_token))

        # invalid AuthRequest
        auth_request = AuthRequest(self.private_key_hex, self.domain_name)
        auth_request_token = auth_request.token()[:-1]

        self.assertFalse(AuthRequest.verify(auth_request_token))
Beispiel #4
0
 def test_auth_request_token_decoding(self):
     decoded_token = AuthRequest.decode(self.sample_encoded_token)
     decoded_token_payload = decoded_token['payload']
     self.assertEqual(decoded_token_payload,
                      self.sample_decoded_token_payload)
 def test_auth_request_token_decoding(self):
     decoded_token = AuthRequest.decode(self.sample_encoded_token)
     self.assertEqual(decoded_token, self.sample_decoded_token)
 def test_auth_request_token_decoding(self):
     decoded_token = AuthRequest.decode(self.sample_encoded_token)
     decoded_token_payload = decoded_token['payload']
     self.assertEqual(decoded_token_payload, self.sample_decoded_token_payload)