def test_02_get_auth_item(self):
        serial = "UBOM12345"
        # create realm
        self.setUp_user_realms()
        user = User("cornelius", realm=self.realm1)
        # create ssh token
        init_token({"serial": serial, "type": "totp", "otpkey": OTPKEY},
                   user=user)

        auth_item = LUKSApplication.get_authentication_item("totp", serial)
        self.assertEqual(len(auth_item.get("challenge")), 64)
        self.assertEqual(len(auth_item.get("response")), 40)

        auth_item = LUKSApplication.get_authentication_item("totp", serial,
                                                            challenge="123456")
        self.assertEqual(auth_item.get("challenge"), "123456")
        self.assertEqual(auth_item.get("response"),
                         "76d624a5fdf8d84f3d19e781f0313e48c1e69165")
    def test_02_get_auth_item(self):
        serial = "UBOM12345"
        # create realm
        self.setUp_user_realms()
        user = User("cornelius", realm=self.realm1)
        # create ssh token
        init_token({"serial": serial, "type": "totp", "otpkey": OTPKEY},
                   user=user)

        auth_item = LUKSApplication.get_authentication_item("totp", serial)
        self.assertEqual(len(auth_item.get("challenge")), 64)
        self.assertEqual(len(auth_item.get("response")), 40)

        auth_item = LUKSApplication.get_authentication_item("totp", serial,
                                                            challenge="123456")
        self.assertEqual(auth_item.get("challenge"), "123456")
        self.assertEqual(auth_item.get("response"),
                         "76d624a5fdf8d84f3d19e781f0313e48c1e69165")
Esempio n. 3
0
 def test_03_get_auth_item_unsupported(self):
     # unsupported token type
     auth_item = LUKSApplication.get_authentication_item("unsupported", "s")
     self.assertEqual(auth_item, {})
Esempio n. 4
0
 def test_01_get_options(self):
     # Can run as class
     options = LUKSApplication.get_options()
     self.assertEqual(options["required"], [])
     self.assertEqual(options["optional"], ['slot', 'partition'])