Authelia CLI 实战指南:authelia storage user 命令族——用户 TOTP、WebAuthn 与不透明标识符的存储级管理
Authelia CLI 实战指南authelia storage user 命令族——用户 TOTP、WebAuthn 与不透明标识符的存储级管理【免费下载链接】autheliaThe Single Sign-On Multi-Factor portal for web apps. OpenID Certified™ and Post-Quantum Cryptography Ready.项目地址: https://gitcode.com/GitHub_Trending/au/autheliaauthelia storage user是 Authelia CLI 中面向 SQL 存储层的管理命令组用于直接查看、生成、导入、导出和删除用户级安全配置TOTP、WebAuthn 凭据、不透明标识符。阅读本文后你将掌握该命令族完整的子命令树、全部命令行参数及其默认值、与配置文件键的一一映射关系以及一套可用于备份、迁移和批量运维的实战流程。命令定位与整体结构authelia storage user隶属于authelia storage命令组后者被定义为“Manage the Authelia storage”即通过一组高级操作与 Authelia 的 SQL 数据库直接交互——这些操作若手工执行会困难得多。authelia storage user本身的职责描述是Manages user settings. This subcommand allows modifying and exporting user settings. 管理用户设置。该子命令允许修改和导出用户设置。从源码结构看internal/commands/storage.go 中的newStorageUserCmd将该命令定义为不接受任何位置参数的纯分支节点Args: cobra.NoArgs并挂载了三个二级子命令子命令职责三级子命令identifiers管理用户不透明标识符opaque identifiersexport、import、generate、addtotp管理 TOTP 配置生成、删除、导入、导出generate、delete、import、export含csv/uri/pngwebauthn管理 WebAuthn 凭据列表、校验、删除、导入、导出list、verify、delete、export、import三个二级子命令的官方帮助示例均形如authelia storage user --help authelia storage user identifiers --help authelia storage user totp --help authelia storage user webauthn --help这些描述文本与示例字符串均定义在 internal/commands/const.gocmdAutheliaStorageUser*系列常量与仓库内的 CLI 参考文档 逐字对应。继承的全局选项存储连接参数运行authelia storage user --help时除自身的-h, --help外还会从父命令继承一组决定“连接到哪个存储”的选项-c, --config strings configuration files or directories to load, for more information run authelia -h authelia config (default [configuration.yml]) --config.experimental.filters strings list of filters to apply to all configuration files, for more information run authelia -h authelia filters --encryption-key string the storage encryption key to use --mysql.address string the MySQL server address (default tcp://127.0.0.1:3306) --mysql.database string the MySQL database name (default authelia) --mysql.password string the MySQL password --mysql.username string the MySQL username (default authelia) --postgres.address string the PostgreSQL server address (default tcp://127.0.0.1:5432) --postgres.database string the PostgreSQL database name (default authelia) --postgres.password string the PostgreSQL password --postgres.schema string the PostgreSQL schema name (default public) --postgres.username string the PostgreSQL username (default authelia) --sqlite.path string the SQLite database path这些选项支持三种主流后端SQLite--sqlite.path、MySQL--mysql.*、PostgreSQL--postgres.*另有--encryption-key提供存储加密密钥。典型的连接覆盖写法是authelia storage user --help --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 \ --postgres.address tcp://postgres:5432 --postgres.password autheliapw从源码结构看这些 CLI 选项并非各自为政而是被统一“翻译”为配置文件键。internal/commands/storage_run.go 中的ConfigStorageCommandLineConfigRunE维护了一张映射表例如--encryption-key → storage.encryption_key、--sqlite.path → storage.local.path、--mysql.address → storage.mysql.address、--postgres.address → storage.postgres.address等与 config.template.yml 中storage:段的键名一一对应。也就是说命令行参数本质上是临时注入配置树的 storage 配置优先级高于配置文件。此外internal/commands/storage_run.go 的LoadProvidersStorageRunE作为该命令族的 PreRunE 钩子会先加载受信证书链LoadTrustedCertificates再经getStorageProvider建立存储 Provider各*RunE执行函数如StorageUserWebAuthnExportRunE、StorageUserTOTPGenerateRunE等在执行结束时统一通过defer关闭 Provider保证连接被正确释放。identifiers用户不透明标识符管理不透明标识符opaque identifier用于以 UUID 形式指代用户典型场景是 OpenID Connect 的sub声明。identifiers子命令覆盖导出、导入、批量生成与手工添加四类任务。export —— 导出到 YAML 文件用于备份全部用户的不透明标识符。参数为-f, --file默认文件名authelia.export.opaque-identifiers.ymlauthelia storage user identifiers export authelia storage user identifiers export --file export.yml authelia storage user identifiers export --file export.yml --config config.yml authelia storage user identifiers export --file export.yml --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 --postgres.address tcp://postgres:5432 --postgres.password autheliapwimport —— 从 YAML 文件导入YAML 文件既可用export自动生成也可以手工提供需为相同格式。导入要求恰好一个位置参数文件名authelia storage user identifiers import authelia storage user identifiers import authelia.export.opaque-identifiers.yml authelia storage user identifiers import --config config.yml export.yml authelia storage user identifiers import --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 --postgres.address tcp://postgres:5432 --postgres.password autheliapw export.ymlgenerate —— 批量生成标识符参数包括--users要生成的用户列表逗号分隔、--services默认openid、--sectors默认空值即无扇区authelia storage user identifiers generate --users john,mary authelia storage user identifiers generate --users john,mary --services openid authelia storage user identifiers generate --users john,mary --services openid --sectors,example.com,test.com authelia storage user identifiers generate --users john,mary --services openid --sectors,example.com,test.com --config config.yml从源码结构看--sectors的默认值是包含一个空字符串的切片[]string{}表示“默认不按 sector 维度拆分标识符”--services的合法取值集合由validIdentifierServices定义openid是其中的缺省值。add —— 为单个用户手工添加add username需要恰好一个用户名参数并可指定标识符值、所属服务与扇区authelia storage user identifiers add john --identifier f0919359-9d15-4e15-bcba-83b41620a073 authelia storage user identifiers add john --identifier f0919359-9d15-4e15-bcba-83b41620a073 --config config.yml authelia storage user identifiers add john --identifier f0919359-9d15-4e15-bcba-83b41620a073 --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 --postgres.address tcp://postgres:5432 --postgres.password autheliapw参数说明来自 internal/commands/storage.go 中的 flag 定义参数默认值说明--identifier空随机生成要使用的 version 4 UUID不设置则随机生成--serviceopenid标识符所属服务--sector空扇区标识符通常留空totpTOTP 配置管理totp子命令覆盖 TOTP 配置的生成、删除、导入与多种格式的导出。generate —— 为用户生成 TOTP 配置generate username需要恰好一个用户名参数可覆盖全部 TOTP 参数若配置已存在则默认不覆盖需--force显式强制authelia storage user totp generate john authelia storage user totp generate john --period 90 authelia storage user totp generate john --digits 8 authelia storage user totp generate john --algorithm SHA512 authelia storage user totp generate john --algorithm SHA512 --config config.yml authelia storage user totp generate john --algorithm SHA512 --config config.yml --path john.png参数默认值说明--secret空随机生成base32 编码无填充的共享密钥源码注释建议仅在恢复既有配置时使用--secret-sizeschema.TOTPSecretSizeDefault密钥长度--period30验证码轮换周期秒--digits6验证码位数--algorithmSHA1哈希算法可选SHA1多数应用支持、SHA256、SHA512--issuerAuthelia签发方描述-f, --forcefalse即使已存在配置也强制重新生成-p, --path空额外生成包含二维码的 PNG 文件路径可选从源码结构看--period、--digits、--algorithm、--issuer、--secret-size会被映射为totp.period、totp.digits、totp.algorithm、totp.issuer、totp.secret_size等配置键见ConfigStorageCommandLineConfigRunE的 flagsMap即 CLI 上的取值与全局totp:配置段走同一套校验逻辑。delete —— 删除用户的 TOTP 配置authelia storage user totp delete john authelia storage user totp delete john --config config.yml authelia storage user totp delete john --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 --postgres.address tcp://postgres:5432 --postgres.password autheliapwexport / import —— YAML 往返导出默认文件名为authelia.export.totp.ymlauthelia storage user totp export --file example.yml authelia storage user totp export --config config.yml authelia storage user totp export --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 --postgres.address tcp://postgres:5432 --postgres.password autheliapw导入要求恰好一个位置参数YAML 文件名authelia storage user totp import authelia.export.totp.yml authelia storage user totp import --config config.yml authelia.export.totp.yml authelia storage user totp import --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 --postgres.address tcp://postgres:5432 --postgres.password autheliapw authelia.export.totp.ymlexport 的三种附加格式export本身可再展开三个子命令分别输出不可回导的派生格式export csv导出为 CSV默认文件authelia.export.totp.csvexport uri输出 TOTP URIexport png为每个用户生成包含二维码的 PNG 图片可用--directory指定保存目录默认为当前目录。authelia storage user totp export csv --file users.csv authelia storage user totp export uri authelia storage user totp export png authelia storage user totp export png --directory example/dirwebauthnWebAuthn 凭据管理webauthn子命令面向 Passkey/WebAuthn 场景提供查询、校验、删除与导入导出能力。list —— 列出用户的 WebAuthn 凭据list [username]接受至多一个用户名参数。从源码结构看其底层调用存储 Provider 的LoadWebAuthnCredentialsByUsername输出为ID、KID、Description三列的表格text/tabwriter排版若用户无凭据会返回明确的错误提示user name has no WebAuthn credentialsauthelia storage user webauthn list authelia storage user webauthn list john authelia storage user webauthn list john --config config.yml authelia storage user webauthn list john --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 --postgres.address tcp://postgres:5432 --postgres.password autheliapwverify —— 校验已注册的凭据对全部已注册的 WebAuthn 凭据做一致性校验可用--verbose打开详细输出authelia storage user webauthn verify authelia storage user webauthn verify --verbosedelete —— 删除凭据delete [username]支持三种定位方式可组合使用参数说明--all删除该用户的全部 WebAuthn 凭据--description按凭据描述定位--kid按 key ID 定位此时用户名可省略authelia storage user webauthn delete john --all authelia storage user webauthn delete john --description Primary authelia storage user webauthn delete --kid abc123 authelia storage user webauthn delete john --all --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 --postgres.address tcp://postgres:5432 --postgres.password autheliapwexport / import —— YAML 往返导出默认文件名为authelia.export.webauthn.ymlauthelia storage user webauthn export authelia storage user webauthn export --file authelia.export.webauthn.yml authelia storage user webauthn export --file authelia.export.webauthn.yml --config config.yml导入要求恰好一个位置参数YAML 文件名执行成功后会在 stdout 打印导入数量、类型与文件名的确认信息authelia storage user webauthn import authelia.export.webauthn.yml authelia storage user webauthn import --file authelia.export.webauthn.yml --encryption-key b3453fde-ecc2-4a1f-9422-2707ddbed495 --postgres.address tcp://postgres:5432 --postgres.password autheliapw实战组合一次完整的备份-迁移演练综合以上能力一套不中断服务、仅依赖 CLI 的备份与迁移流程如下以 PostgreSQL 源库为例参数均沿用官方示例格式# 1. 备份三类用户级配置 authelia storage user identifiers export --file authelia.export.opaque-identifiers.yml \ --encryption-key key --postgres.address tcp://postgres:5432 --postgres.password pw authelia storage user totp export --file authelia.export.totp.yml \ --encryption-key key --postgres.address tcp://postgres:5432 --postgres.password pw authelia storage user webauthn export --file authelia.export.webauthn.yml \ --encryption-key key --postgres.address tcp://postgres:5432 --postgres.password pw # 2. 在目标库例如换库后的 MySQL上逐一导入 authelia storage user identifiers import authelia.export.opaque-identifiers.yml \ --encryption-key key --mysql.address tcp://mysql:3306 --mysql.password pw authelia storage user totp import authelia.export.totp.yml \ --encryption-key key --mysql.address tcp://mysql:3306 --mysql.password pw authelia storage user webauthn import authelia.export.webauthn.yml \ --encryption-key key --mysql.address tcp://mysql:3306 --mysql.password pw需要强调的适用前提上述命令要求目标数据库已完成 schema 迁移可配合authelia storage migrate up使用且导入的 YAML 必须与导出版本的格式一致--encryption-key必须与存储加密配置匹配否则无法解密字段。此外totp generate/identifiers add等写入类操作会直接修改数据库中的用户安全配置生产环境执行前建议先执行对应export留存现场。相关文档authelia storage —— storage 命令组总览含bans、cache、encryption、migrate、schema-infoauthelia storage user identifiers —— 不透明标识符子命令参考authelia storage user totp —— TOTP 子命令参考authelia storage user webauthn —— WebAuthn 子命令参考主要源码参考命令定义见 internal/commands/storage.go帮助文案与示例见 internal/commands/const.go执行逻辑与参数-配置键映射见 internal/commands/storage_run.go。【免费下载链接】autheliaThe Single Sign-On Multi-Factor portal for web apps. OpenID Certified™ and Post-Quantum Cryptography Ready.项目地址: https://gitcode.com/GitHub_Trending/au/authelia创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

相关新闻

MIMO后向投影成像:虚拟阵列建模与噪声鲁棒性实战

MIMO后向投影成像:虚拟阵列建模与噪声鲁棒性实战

简介:本资源是一份面向雷达/声纳成像、无线通信与信号处理方向初学者及进阶研究者的MIMO后向投影(MIMO-BP)算法MATLAB实现,聚焦于多天线系统下的空间目标成像与噪声鲁棒性建模。核心解决MIMO阵列接收信号如何通过反向投影重建高分…

2026/9/13 16:48:54 阅读更多 →
Java桌面开发新选择:QtJambi环境配置、Maven集成与源码编译实战

Java桌面开发新选择:QtJambi环境配置、Maven集成与源码编译实战

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/9/13 16:48:54 阅读更多 →
小米Home Assistant集成浴霸模式控制丢失:原因、5步修复与验收方法

小米Home Assistant集成浴霸模式控制丢失:原因、5步修复与验收方法

小米Home Assistant集成浴霸模式控制丢失:原因、5步修复与验收方法 【免费下载链接】ha_xiaomi_home Xiaomi Home Integration for Home Assistant 项目地址: https://gitcode.com/GitHub_Trending/ha/ha_xiaomi_home TL;DR:问题、影响与修复成本…

2026/9/13 16:48:54 阅读更多 →

最新新闻

PaddlePaddle 代码评审规则体系解析:ai-review Skill 与 base-rules 基础评审规则

PaddlePaddle 代码评审规则体系解析:ai-review Skill 与 base-rules 基础评审规则

PaddlePaddle 代码评审规则体系解析:ai-review Skill 与 base-rules 基础评审规则 【免费下载链接】Paddle PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器…

2026/9/13 17:41:16 阅读更多 →
飞桨(PaddlePaddle)Python API 封装实战指南:从参数检查到算子调用的完整规范

飞桨(PaddlePaddle)Python API 封装实战指南:从参数检查到算子调用的完整规范

飞桨(PaddlePaddle)Python API 封装实战指南:从参数检查到算子调用的完整规范 【免费下载链接】Paddle PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架&#xff0c…

2026/9/13 17:41:16 阅读更多 →
YOLOv5实战:替换主干网络与注意力机制部署全攻略

YOLOv5实战:替换主干网络与注意力机制部署全攻略

简介:面向计算机、电子信息工程及数学等专业学生,这份压缩包提供了基于YOLOv5的主干网络改进与部署参考资料,涵盖ResNet、ShuffleNet、MobileNet、EfficientNet、HRNet、CBAM、DCN以及TensorRT/Triton/TF Serving等方向,适合课程设…

2026/9/13 17:41:15 阅读更多 →
STM32无感FOC驱动器实战:从I/F强拖到SMO闭环调试指南

STM32无感FOC驱动器实战:从I/F强拖到SMO闭环调试指南

1. 项目概述与版本定位解析FOC-P2-DRAFT_V2.0,这个工程名刚看到的时候可能有点劝退,实际上这是我手头一个无感FOC驱动器项目的第二阶段草案第二版。拆开看就清楚了:FOC是磁场定向控制;P2代表这个项目走到了第二阶段,也就是从有霍尔…

2026/9/13 17:41:15 阅读更多 →
嵌入式软硬件协同的四大断点与破局机制

嵌入式软硬件协同的四大断点与破局机制

1. 这不是甩锅,是嵌入式开发里最真实的“时间差”现象 “嵌入式项目里,硬件工程师和软件工程师为什么经常‘互相等’?”——这句话在研发例会上出现的频率,可能比BOM清单更新还高。我干嵌入式这行十二年,带过三十多个量…

2026/9/13 17:41:15 阅读更多 →
基于MSP430小型货运机器人设计:从原理图到PCB打样全流程

基于MSP430小型货运机器人设计:从原理图到PCB打样全流程

简介:面向物流自动化与嵌入式学习者的MSP430小型货运机器人完整设计资料,涵盖设计论文、Protel99SE硬件原理图/PCB以及C语言软件源码,适用于机场行李运输、仓库货物转运等场景,可作为高校单片机/嵌入式课程设计、毕业设计或机器人…

2026/9/13 17:40:15 阅读更多 →

日新闻

AI SDK Harness 依赖更新指南:掌握 harness 包 SDK 依赖的升级、桥接同步与一致性校验

AI SDK Harness 依赖更新指南:掌握 harness 包 SDK 依赖的升级、桥接同步与一致性校验

AI SDK Harness 依赖更新指南:掌握 harness 包 SDK 依赖的升级、桥接同步与一致性校验 【免费下载链接】ai The AI Toolkit for TypeScript. From the creators of Next.js, the AI SDK is a free open-source library for building AI-powered applications and ag…

2026/9/13 0:00:24 阅读更多 →
Refine v5 Ant Design NumberField 组件实战:基于 Intl 的本地化数字格式化

Refine v5 Ant Design NumberField 组件实战:基于 Intl 的本地化数字格式化

Refine v5 Ant Design NumberField 组件实战:基于 Intl 的本地化数字格式化 【免费下载链接】refine A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility. 项目地址: https://gitcode.com/GitH…

2026/9/13 0:00:24 阅读更多 →
Flutter应用改名全指南:从Android到iOS的配置与工具实践

Flutter应用改名全指南:从Android到iOS的配置与工具实践

刚接一个外包项目时,甲方要求把工程里临时用的应用名改成正式产品名。我本来觉得“改名”这种小事,打开配置文件改一行不就完了?结果真动手才发现,Flutter项目里“应用名称”根本不是一处配置,而是一整套散落在 Androi…

2026/9/13 0:00:24 阅读更多 →

周新闻

AI SDK Harness 依赖更新指南:掌握 harness 包 SDK 依赖的升级、桥接同步与一致性校验

AI SDK Harness 依赖更新指南:掌握 harness 包 SDK 依赖的升级、桥接同步与一致性校验

AI SDK Harness 依赖更新指南:掌握 harness 包 SDK 依赖的升级、桥接同步与一致性校验 【免费下载链接】ai The AI Toolkit for TypeScript. From the creators of Next.js, the AI SDK is a free open-source library for building AI-powered applications and ag…

2026/9/13 0:00:24 阅读更多 →
Refine v5 Ant Design NumberField 组件实战:基于 Intl 的本地化数字格式化

Refine v5 Ant Design NumberField 组件实战:基于 Intl 的本地化数字格式化

Refine v5 Ant Design NumberField 组件实战:基于 Intl 的本地化数字格式化 【免费下载链接】refine A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility. 项目地址: https://gitcode.com/GitH…

2026/9/13 0:00:24 阅读更多 →
Flutter应用改名全指南:从Android到iOS的配置与工具实践

Flutter应用改名全指南:从Android到iOS的配置与工具实践

刚接一个外包项目时,甲方要求把工程里临时用的应用名改成正式产品名。我本来觉得“改名”这种小事,打开配置文件改一行不就完了?结果真动手才发现,Flutter项目里“应用名称”根本不是一处配置,而是一整套散落在 Androi…

2026/9/13 0:00:24 阅读更多 →

月新闻

持续集成 流水线自动化与 声明式交付 实践:原型怎样变成可用功能

持续集成 流水线自动化与 声明式交付 实践:原型怎样变成可用功能

持续集成 流水线自动化与 声明式交付 实践:原型怎样变成可用功能分类:[AI/大模型]细分主题:AI 增强型 CI/CD 流水线自动化与 GitOps 实践:Agent 工作流、工具调用与任务拆解:从原型到生产的验收清单很多团队在尝试用大…

2026/9/13 16:51:11 阅读更多 →
容器编排 生产环境运维与排障实战:复盘记录怎样真正派上用场

容器编排 生产环境运维与排障实战:复盘记录怎样真正派上用场

容器编排 生产环境运维与排障实战:复盘记录怎样真正派上用场分类:[工程技术]细分主题:Kubernetes 生产环境运维与排障实战:可复制的项目复盘模板与决策记录大部分团队的事故复盘报告,最后都变成了躺在 Confluence 或钉…

2026/9/12 18:29:34 阅读更多 →
容器 容器化技术与镜像安全管理:核心链路应该先拆哪一步

容器 容器化技术与镜像安全管理:核心链路应该先拆哪一步

容器 容器化技术与镜像安全管理:核心链路应该先拆哪一步分类:[工程技术]细分主题:Docker 容器化技术与镜像安全管理:核心链路的逐步实现与关键代码取舍面对一个积累了五六年历史包袱的单体架构应用(包含 Web 接口、后台…

2026/9/12 19:02:44 阅读更多 →