Qt Network 授权
Qt Network 授权提供了一组 API,使 Qt 应用程序能实施常见的授权和验证协议。例如,应用程序可以实施访问控制,如在不暴露用户密码的情况下提供对在线账户和 HTTP 服务的有限访问。
本模块侧重于OAuth 2.0,并对OpenID 提供有限支持。请参阅下面有关支持协议的部分。
使用模块
使用 Qt 模块需要直接或通过其他依赖关系链接模块库。一些构建工具为此提供了专门支持,包括 CMake 和 qmake。
使用 CMake 构建
使用find_package()
命令在 Qt6 软件包中找到所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS NetworkAuth) target_link_libraries(mytarget PRIVATE Qt6::NetworkAuth)
另请参阅使用 CMake 构建概述。
使用 qmake 构建
要配置模块以便用 qmake 构建,请在项目的 .pro 文件中将模块添加为 QT 变量的值:
QT += networkauth
支持的授权和身份验证协议
Qt Network 授权模块支持以下功能
这些系统使用受信任的授权服务器发送访问令牌,因此用户无需向资源发送凭据,资源所有者也无需直接管理用户凭据。例如,云相册网站的用户不必担心将凭据传递给网站。相反,凭据由受信任的授权服务通过网络界面进行管理。
文章和指南
许可证
Qt Network 授权可从Qt 公司获得商业许可。此外,它还受GNU 通用公共许可证第 3 版的保护。有关详细信息,请参阅Qt Licensing。
示例
API 参考
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.