Пример #1
0
def cleanup_dummy_tokens():
    yield
    tokens = ipa_admin.otptoken_find("dummy")
    if tokens is None:
        return
    for token in [OTPToken(t) for t in tokens]:
        ipa_admin.otptoken_del(token.uniqueid)
Пример #2
0
def dummy_user_with_2_otp(client, logged_in_dummy_user, dummy_user_with_otp):
    ipa = logged_in_dummy_user
    result = ipa.otptoken_add(
        o_ipatokenowner="dummy",
        o_ipatokenotpalgorithm="sha512",
        o_description="dummy's other token",
    )['result']
    token = OTPToken(result)
    yield dummy_user_with_otp, token
    try:
        ipa_admin.otptoken_del(token.uniqueid)
    except python_freeipa.exceptions.NotFound:
        pass  # already deleted, it's fine.
Пример #3
0
def dummy_user_with_otp(client, logged_in_dummy_user):
    ipa = logged_in_dummy_user
    result = ipa.otptoken_add(
        ipatokenowner="dummy",
        ipatokenotpalgorithm='sha512',
        description="dummy's token",
    )
    token = OTPToken(result)
    yield token
    # Deletion needs to be done as admin to remove the last token
    try:
        ipa_admin.otptoken_del(token.uniqueid)
    except python_freeipa.exceptions.NotFound:
        pass  # Already deleted
Пример #4
0
def cleanup_dummy_tokens():
    yield
    tokens = ipa_admin.otptoken_find(a_criteria="dummy")
    for token in [OTPToken(t) for t in tokens["result"]]:
        ipa_admin.otptoken_del(a_ipatokenuniqueid=token.uniqueid)