# get the config id as a string
auth_method_id = self.parameterAsString(
parameters,
self.AUTH_CONFIG,
context
)
# get the application's authenticaion manager
auth_mgr = QgsApplication.authManager()
# create an empty authmethodconfig object
auth_cfg = QgsAuthMethodConfig()
# load config from manager to the new config instance and decrypt sensitive data
auth_mgr.loadAuthenticationConfig(auth_method_id, auth_cfg, True)
# get the configuration information (including username and password)
auth_cfg.configMap()
因此,您似乎对字符串(id)执行了以下操作:
我从文件中的不同地方得到这个:
https://qgis.org/pyqgis/master/core/QgsAuthManager.html
https://qgis.org/pyqgis/master/core/QgsAuthMethodConfig.html
https://qgis.org/pyqgis/master/core/QgsProcessingParameterAuthConfig.html
相关问题 更多 >
编程相关推荐