更新时间:2025-09-25 GMT+08:00
分享

查询账号密码策略

功能介绍

该接口可以用于查询账号密码策略。

URI

GET /v5/password-policy

请求参数

响应参数

状态码:200

表1 响应Body参数

参数

参数类型

描述

password_policy

PasswordPolicy object

密码策略。

表2 PasswordPolicy

参数

参数类型

描述

maximum_consecutive_identical_chars

Integer

同一字符连续出现的最大次数。

maximum_password_length

Integer

密码最大字符数。

minimum_password_age

Integer

密码最短使用时间(分钟)。

minimum_password_length

Integer

密码最小字符数。

password_reuse_prevention

Integer

密码不能与历史密码重复次数。

password_not_username_or_invert

Boolean

密码是否可以是用户名或用户名的反序。默认值为true,为true时表示密码不可以是用户名或用户名的反序。

password_requirements

String

设置密码必须包含的字符要求。

password_validity_period

Integer

密码有效期(天)。

password_char_combination

Integer

至少包含字符种类的个数。

allow_user_to_change_password

Boolean

是否允许IAM用户修改自己的密码,不适用于根用户。

状态码:403

表3 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误信息。

request_id

String

请求ID。

encoded_authorization_message

String

加密后的认证失败信息,可以通过STS5解密接口进行解密。

请求示例

查询账号密码策略。

GET https://{endpoint}/v5/password-policy

响应示例

状态码:200

请求成功。

{
  "password_policy" : {
    "maximum_consecutive_identical_chars" : 0,
    "maximum_password_length" : 32,
    "minimum_password_age" : 0,
    "minimum_password_length" : 8,
    "password_reuse_prevention" : 1,
    "password_not_username_or_invert" : true,
    "password_requirements" : "A password must contain at least two of the following: uppercase letters, lowercase letters, digits, and special characters.",
    "password_validity_period" : 180,
    "password_char_combination" : 2,
    "allow_user_to_change_password" : true
  }
}

状态码

状态码

描述

200

请求成功。

403

没有操作权限。

错误码

请参见错误码

相关文档