# Path: tests/util.py
# def _support(filename):
# def _config(name):
# def needs_builtin(name):
#         def __init__(self):
#         def setUpClass(cls):
#         def tearDownClass(cls):
#             def setUpClass(cls):
# def update_env(testcase, mapping, env=os.environ):
#     def replace(target, source):
# def k5shell(args=None):
# def is_low_entropy():
#     class DummyK5Realm(object):
#     class KerberosTestCase(unittest.TestCase):
#         class KerberosTestCase(unittest.TestCase):
# 
# Path: tests/test_client.py
# FINGERPRINTS = {
#     "ssh-dss": b"\x44\x78\xf0\xb9\xa2\x3c\xc5\x18\x20\x09\xff\x75\x5b\xc1\xd2\x6c",  # noqa
#     "ssh-rsa": b"\x60\x73\x38\x44\xcb\x51\x86\x65\x7f\xde\xda\xa2\x2b\x5a\x57\xd5",  # noqa
#     "ecdsa-sha2-nistp256": b"\x25\x19\xeb\x55\xe6\xa1\x47\xff\x4f\x38\xd2\x75\x6f\xa5\xd5\x60",  # noqa
#     "ssh-ed25519": b'\xb3\xd5"\xaa\xf9u^\xe8\xcd\x0e\xea\x02\xb9)\xa2\x80',
# }


import socket
import threading
import paramiko
from .util import _support, needs_gssapi, KerberosTestCase, update_env
from .test_client import FINGERPRINTS
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.

"""
Unit Tests for the GSS-API / SSPI SSHv2 Authentication (gssapi-with-mic)
"""





class NullServer(paramiko.ServerInterface):
    def get_allowed_auths(self, username):
        return "gssapi-with-mic,publickey"

    def check_auth_gssapi_with_mic(
        self, username, gss_authenticated=paramiko.AUTH_FAILED, cc_file=None
    ):
        if gss_authenticated == paramiko.AUTH_SUCCESSFUL:
            return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED

    def enable_auth_gssapi(self):
        return True

    def check_auth_publickey(self, username, key):
        try:

# Path: tests/util.py
# def _support(filename):
# def _config(name):
# def needs_builtin(name):
#         def __init__(self):
#         def setUpClass(cls):
#         def tearDownClass(cls):
#             def setUpClass(cls):
# def update_env(testcase, mapping, env=os.environ):
#     def replace(target, source):
# def k5shell(args=None):
# def is_low_entropy():
#     class DummyK5Realm(object):
#     class KerberosTestCase(unittest.TestCase):
#         class KerberosTestCase(unittest.TestCase):
# 
# Path: tests/test_client.py
# FINGERPRINTS = {
#     "ssh-dss": b"\x44\x78\xf0\xb9\xa2\x3c\xc5\x18\x20\x09\xff\x75\x5b\xc1\xd2\x6c",  # noqa
#     "ssh-rsa": b"\x60\x73\x38\x44\xcb\x51\x86\x65\x7f\xde\xda\xa2\x2b\x5a\x57\xd5",  # noqa
#     "ecdsa-sha2-nistp256": b"\x25\x19\xeb\x55\xe6\xa1\x47\xff\x4f\x38\xd2\x75\x6f\xa5\xd5\x60",  # noqa
#     "ssh-ed25519": b'\xb3\xd5"\xaa\xf9u^\xe8\xcd\x0e\xea\x02\xb9)\xa2\x80',
# }


# Path: tests/test_ssh_gss.py
import socket
import threading
import paramiko
from .util import _support, needs_gssapi, KerberosTestCase, update_env
from .test_client import FINGERPRINTS

# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.

"""
Unit Tests for the GSS-API / SSPI SSHv2 Authentication (gssapi-with-mic)
"""





class NullServer(paramiko.ServerInterface):
    def get_allowed_auths(self, username):
        return "gssapi-with-mic,publickey"

    def check_auth_gssapi_with_mic(
        self, username, gss_authenticated=paramiko.AUTH_FAILED, cc_file=None
    ):
        if gss_authenticated == paramiko.AUTH_SUCCESSFUL:
            return paramiko.AUTH_SUCCESSFUL
        return paramiko.AUTH_FAILED

    def enable_auth_gssapi(self):
        return True

    def check_auth_publickey(self, username, key):
        try:

            expected = FINGERPRINTS[key.get_name()]