from rest_framework.views import APIView from rest_framework.response import Response from django.http import JsonResponse from .services import LdapConnectManager class LdapTestConnection(APIView): def get(self, request): ldap_connector = LdapConnectManager("astra.epp.ru", "wscusers.local") return JsonResponse({"ldap_status": ldap_connector.establish_ldap_connection()}) class LdapTestAuth(APIView): def get(self, request, username, password): ldap_connector = LdapConnectManager("astra.epp.ru", "wscusers") return JsonResponse({"ldap_status": ldap_connector.user_authentication(username, password)})