def update(self, param):
     """
     This method is called during the initialization process.
     :param param: parameters from the token init
     :type param: dict
     :return: None
     """
     param["otpkey"] = generate_password(size=self.otp_len)
     PasswordTokenClass.update(self, param)
Exemple #2
0
 def update(self, param):
     """
     This method is called during the initialization process.
     :param param: parameters from the token init
     :type param: dict
     :return: None
     """
     # We always generate the registration code, so we need to set this parameter
     param["genkey"] = 1
     PasswordTokenClass.update(self, param)
 def test_01_create_token(self):
     db_token = Token(self.serial1, tokentype="pw")
     db_token.save()
     token = PasswordTokenClass(db_token)
     token.update({"otpkey": self.password})
     self.assertTrue(token.token.serial == self.serial1, token)
     self.assertTrue(token.token.tokentype == "pw", token.token.tokentype)
     self.assertTrue(token.type == "pw", token)
     class_prefix = token.get_class_prefix()
     self.assertTrue(class_prefix == "PW", class_prefix)
     self.assertTrue(token.get_class_type() == "pw", token)
 def test_01_create_token(self):
     db_token = Token(self.serial1, tokentype="pw")
     db_token.save()
     token = PasswordTokenClass(db_token)
     token.update({"otpkey": self.password})
     self.assertTrue(token.token.serial == self.serial1, token)
     self.assertTrue(token.token.tokentype == "pw", token.token.tokentype)
     self.assertTrue(token.type == "pw", token)
     class_prefix = token.get_class_prefix()
     self.assertTrue(class_prefix == "PW", class_prefix)
     self.assertTrue(token.get_class_type() == "pw", token)
 def update(self, param):
     """
     This method is called during the initialization process.
     :param param: parameters from the token init
     :type param: dict
     :return: None
     """
     if "genkey" in param:
         # We do not need the genkey! We generate anyway.
         # Otherwise genkey and otpkey will raise an exception in
         # PasswordTokenClass
         del param["genkey"]
     param["otpkey"] = generate_password(size=self.otp_len)
     PasswordTokenClass.update(self, param)
Exemple #6
0
 def update(self, param):
     """
     This method is called during the initialization process.
     :param param: parameters from the token init
     :type param: dict
     :return: None
     """
     if "genkey" in param:
         # We do not need the genkey! We generate anyway.
         # Otherwise genkey and otpkey will raise an exception in
         # PasswordTokenClass
         del param["genkey"]
     param["otpkey"] = generate_password(size=self.otp_len)
     PasswordTokenClass.update(self, param)
 def update(self, param):
     """
     This method is called during the initialization process.
     :param param: parameters from the token init
     :type param: dict
     :return: None
     """
     if "genkey" in param:
         # We do not need the genkey! We generate anyway.
         # Otherwise genkey and otpkey will raise an exception in
         # PasswordTokenClass
         del param["genkey"]
     if "registration.length" in param:
         size = param["registration.length"]
         del param["registration.length"]
     else:
         size = self.otp_len
     if "registration.contents" in param:
         contents = param["registration.contents"]
         del param["registration.contents"]
     else:
         contents = self.otp_contents
     param["otpkey"] = _generate_pin_from_policy(contents, size=int(size))
     PasswordTokenClass.update(self, param)