예제 #1
0
 def _write_client_token(self, client_id, request_handler):
     expiry_time = date_utils.get_current_millis() + days_to_ms(
         self.EXPIRES_DAYS)
     new_token = client_id + '&' + str(expiry_time)
     request_handler.set_secure_cookie(self.COOKIE_KEY,
                                       new_token,
                                       expires_days=self.EXPIRES_DAYS)
    def test_refresh_old_cookie_with_same_id(self):
        request_handler = mock_request_handler(ip='192.168.21.13')

        identification = IpBasedIdentification([])

        id = '1234567'
        token_expiry = str(date_utils.get_current_millis() + date_utils.days_to_ms(2))
        old_token = id + '&' + token_expiry
        request_handler.set_secure_cookie(COOKIE_KEY, old_token)

        new_id = identification.identify(request_handler)
        new_token = request_handler.get_cookie(COOKIE_KEY)

        self.assertEqual(new_id, id)
        self.assertNotEqual(old_token, new_token)
예제 #3
0
 def _write_client_token(self, client_id, request_handler):
     expiry_time = date_utils.get_current_millis() + days_to_ms(self.EXPIRES_DAYS)
     new_token = client_id + '&' + str(expiry_time)
     request_handler.set_secure_cookie(self.COOKIE_KEY, new_token, expires_days=self.EXPIRES_DAYS)