def authBasicAuthRequest(self, environ, start_response): realmname = self._domaincontroller.getDomainRealm( environ["PATH_INFO"], environ) authheader = environ["HTTP_AUTHORIZATION"] authvalue = "" try: authvalue = authheader[len("Basic "):].strip() except Exception: authvalue = "" # authvalue = authvalue.strip().decode("base64") authvalue = compat.base64_decodebytes(compat.to_bytes(authvalue)) authvalue = compat.to_native(authvalue) username, password = authvalue.split(":", 1) if self._domaincontroller.authDomainUser(realmname, username, password, environ): environ["http_authenticator.realm"] = realmname environ["http_authenticator.username"] = username return self._application(environ, start_response) return self.sendBasicAuthResponse(environ, start_response)
def handle_basic_auth_request(self, environ, start_response): realm = self.domain_controller.get_domain_realm(environ["PATH_INFO"], environ) auth_header = environ["HTTP_AUTHORIZATION"] auth_value = "" try: auth_value = auth_header[len("Basic ") :].strip() except Exception: auth_value = "" auth_value = compat.base64_decodebytes(compat.to_bytes(auth_value)) auth_value = compat.to_native(auth_value) user_name, password = auth_value.split(":", 1) if self.domain_controller.basic_auth_user(realm, user_name, password, environ): environ["wsgidav.auth.realm"] = realm environ["wsgidav.auth.user_name"] = user_name return self.next_app(environ, start_response) _logger.warning( "Authentication (basic) failed for user '{}', realm '{}'.".format( user_name, realm ) ) return self.send_basic_auth_response(environ, start_response)
def handle_basic_auth_request(self, environ, start_response): realm = self.domain_controller.get_domain_realm(environ["PATH_INFO"], environ) auth_header = environ["HTTP_AUTHORIZATION"] auth_value = "" try: auth_value = auth_header[len("Basic ") :].strip() except Exception: auth_value = "" auth_value = compat.base64_decodebytes(compat.to_bytes(auth_value)) auth_value = compat.to_native(auth_value) user_name, password = auth_value.split(":", 1) if self.domain_controller.basic_auth_user(realm, user_name, password, environ): environ["wsgidav.auth.realm"] = realm environ["wsgidav.auth.user_name"] = user_name return self.next_app(environ, start_response) _logger.warning( "Authentication (basic) failed for user '{}', realm '{}'.".format( user_name, realm ) ) return self.send_basic_auth_response(environ, start_response)