Get status of a scan (checks memory first, then database)
(self, scan_id: str)
| 5834 | 'password': password, |
| 5835 | }) |
| 5836 | }) |
| 5837 | except Exception as e: |
| 5838 | return (False, f"Failed to set user credentials: {str(e)}") |
| 5839 | |
| 5840 | # Enable user |
| 5841 | try: |
| 5842 | self._zap_api_call('JSON/users/action/setUserEnabled', { |
| 5843 | 'contextId': context_id, |
| 5844 | 'userId': user_id, |
| 5845 | 'enabled': 'true' |
| 5846 | }) |
| 5847 | except Exception as e: |
| 5848 | return (False, f"Failed to enable user: {str(e)}") |
| 5849 | |
| 5850 | logger.info(f"ZAP form authentication configured for context {context_name}") |
| 5851 | return (True, None) |
| 5852 | |
| 5853 | elif auth_type == 'http_basic': |
| 5854 | # Validate required parameters |
| 5855 | hostname = auth_params.get('hostname', '').strip() |
| 5856 | if not hostname: |
| 5857 | return (False, "Hostname is required for HTTP Basic authentication") |
| 5858 | |
| 5859 | # HTTP Basic authentication |
| 5860 | try: |
| 5861 | self._zap_api_call('JSON/authentication/action/setAuthenticationMethod', { |
| 5862 | 'contextId': context_id, |
| 5863 | 'authMethodName': 'httpAuthentication', |
| 5864 | 'authMethodConfigParams': urllib.parse.urlencode({ |
| 5865 | 'hostname': hostname, |
| 5866 | 'realm': auth_params.get('realm', ''), |
| 5867 | }) |
no test coverage detected