-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when connecting to PKI enabled server #169
Comments
This error occurs in network_manager.py and probably at line 56 with these lines of code:
I have been using QgsNetworkContentFetcher for these calls and it works beautifully because auth_cfg is integrated into it. The only problem is that it requires QGIS 3.10 and above. QgsBlockingNetworkRequest also works well and works with QGIS 3.6 and above. I made some attempt to fix the problem, but am not sure how to do it with a QNetworkRequest. |
The API for QgsAuthManager.instance() has changed QgsApplication.authManager() to address QGIS-Contribution#169
I also got the @ricardogsilva pointed out to me that I had a look and it seems the API changed. I have a draft pull request #170 which seemed to fix this for me but I think needs further testing. |
I have already tried this as a fix, but it is not sufficient. PKI authentication is quite complex and I tried at one time to implement it with QNetworkRequest, but there is much more to it then this. I never really got it working. The QGIS team put a lot of work into QgsNetworkContentFetcher and QgsBlockingNetworkRequest and made sure they work with PKI. I don't recommend that you use QNetworkRequest because it is going to continually cause problems. I recommend that you switch to one of these QGIS integrated calls. |
I have one other comment which is that QgsApplication.authManager() fixed the error I first reported, but it does not fix the PKI authentication. What fails now is the SSL handshake. |
@zacharlie QgsApplication.authManager().updateNetworkRequest( fixes this main problem and allows the directory of resources to be read; however, it appears that that the auth_cfg id is not being used when the actual resource is requested which results in an SSL error to download the resource. You can see this as follows: In the file basy.py around line 128 in fetch_metadata, NetworkManager is called network_manager = NetworkManager(self.metadata_url, self.auth_cfg) but when the resource is requested it is without auth_cfg (remote_zip_handler.py line 49) network_manager = NetworkManager(self.file_url(collection_path)) # No auth_cfg Also in repository_manager.py line 92 downloader = NetworkManager(self.Directory_URL) # No auth_cfg |
When I attempt to add a repository to a server that uses PKI authentication. I click on the "Add..." button and give it a name and url, then next to Authentication I click on Add to select my certificate token then click on "OK", I get this error message:
type object 'QgsAuthManager' has no attribute 'instance'
The text was updated successfully, but these errors were encountered: