搜索

18.14. 身份验证操作

download PDF

设置密码策略

  1. 将 realm 的 passwordPolicy 属性设置为 enumeration 表达式,其中包含特定的策略提供程序 ID 和可选配置。
  2. 使用以下示例将密码策略设置为默认值。默认值包括:

    • 27,500 个哈希迭代
    • 至少一个特殊字符
    • 至少一个大写字母字符
    • 至少一个数字字符
    • 不等于 用户的用户名
    • 至少 8 个字符

      $ kcadm.sh update realms/demorealm -s 'passwordPolicy="hashIterations and specialChars and upperCase and digits and notUsername and length"'
  3. 要使用与默认值不同的值,请在括号中传递配置。
  4. 使用以下示例将密码策略设置为:

    • 25,000 个哈希迭代
    • 至少两个特殊字符
    • 至少两个大写字符
    • 至少两个小写字母字符
    • 至少两个数字
    • 至少 9 个字符
    • 不等于 用户的用户名
    • 不对至少四个更改重复

      $ kcadm.sh update realms/demorealm -s 'passwordPolicy="hashIterations(25000) and specialChars(2) and upperCase(2) and lowerCase(2) and digits(2) and length(9) and notUsername and passwordHistory(4)"'

获取当前密码策略

您可以通过过滤除 passwordPolicy 属性以外的所有输出来获取当前的域配置。

例如,显示 demorealmpasswordPolicy

$ kcadm.sh get realms/demorealm --fields passwordPolicy

列出验证流

authentication/flows 端点上运行 get 命令。

例如:

$ kcadm.sh get authentication/flows -r demorealm

获取特定的身份验证流程

authentication/flows/FLOW_ID 端点上运行 get 命令。

例如:

$ kcadm.sh get authentication/flows/febfd772-e1a1-42fb-b8ae-00c0566fafb8 -r demorealm

列出流的执行

authentication/flows/FLOW_ALIAS/executions 端点上运行 get 命令。

例如:

$ kcadm.sh get authentication/flows/Copy%20of%20browser/executions -r demorealm

在执行中添加配置

  1. 获取流程的执行。
  2. 记下流的 ID。
  3. authentication/executions/{executionId}/config 端点运行 create 命令。

例如:

$ kcadm create "authentication/executions/a3147129-c402-4760-86d9-3f2345e401c7/config" -r examplerealm -b '{"config":{"x509-cert-auth.mapping-source-selection":"Match SubjectDN using regular expression","x509-cert-auth.regular-expression":"(.*?)(?:$)","x509-cert-auth.mapper-selection":"Custom Attribute Mapper","x509-cert-auth.mapper-selection.user-attribute-name":"usercertificate","x509-cert-auth.crl-checking-enabled":"","x509-cert-auth.crldp-checking-enabled":false,"x509-cert-auth.crl-relative-path":"crl.pem","x509-cert-auth.ocsp-checking-enabled":"","x509-cert-auth.ocsp-responder-uri":"","x509-cert-auth.keyusage":"","x509-cert-auth.extendedkeyusage":"","x509-cert-auth.confirmation-page-disallowed":""},"alias":"my_otp_config"}'

获取执行配置

  1. 获取流程的执行。
  2. 请注意其 authenticationConfig 属性,其中包含配置 ID。
  3. authentication/config/ID 端点上运行 get 命令。

例如:

$ kcadm get "authentication/config/dd91611a-d25c-421a-87e2-227c18421833" -r examplerealm

更新执行的配置

  1. 获取流程的执行。
  2. 获取流程的 authenticationConfig 属性。
  3. 请注意属性中的配置 ID。
  4. authentication/config/ID 端点上运行 update 命令。

例如:

$ kcadm update "authentication/config/dd91611a-d25c-421a-87e2-227c18421833" -r examplerealm -b '{"id":"dd91611a-d25c-421a-87e2-227c18421833","alias":"my_otp_config","config":{"x509-cert-auth.extendedkeyusage":"","x509-cert-auth.mapper-selection.user-attribute-name":"usercertificate","x509-cert-auth.ocsp-responder-uri":"","x509-cert-auth.regular-expression":"(.*?)(?:$)","x509-cert-auth.crl-checking-enabled":"true","x509-cert-auth.confirmation-page-disallowed":"","x509-cert-auth.keyusage":"","x509-cert-auth.mapper-selection":"Custom Attribute Mapper","x509-cert-auth.crl-relative-path":"crl.pem","x509-cert-auth.crldp-checking-enabled":"false","x509-cert-auth.mapping-source-selection":"Match SubjectDN using regular expression","x509-cert-auth.ocsp-checking-enabled":""}}'

删除执行的配置

  1. 获取流程的执行。
  2. 获取 flows authenticationConfig 属性。
  3. 请注意属性中的配置 ID。
  4. authentication/config/ID 端点上运行 delete 命令。

例如:

$ kcadm delete "authentication/config/dd91611a-d25c-421a-87e2-227c18421833" -r examplerealm
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.