Modifying the Account Login Policy
Function
This API is used to modify the account login policy.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
| Action | Access Level | Resource Type (*: required) | Condition Key | Alias | Dependencies |
|---|---|---|---|---|---|
| iam:securitypolicies:updateLoginPolicyV5 | Write | - | - | - | - |
URI
PUT /v5/login-policy
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| user_validity_period | No | Integer | Definition: If an IAM user does not log in within the validity period (days) specified by this parameter, the user will be disabled. Constraints: This parameter is not applicable to the root user. Range: The value ranges from 0 to 240. Default Value: N/A |
| custom_info_for_login | No | String | Definition: Login information. Constraints: The value cannot contain the following characters: "@", "#", "%", "&", "<", ">", "\", "$", "^", and "*". The value contains 0 to 64 characters. Range: N/A Default Value: N/A |
| lockout_duration | No | Integer | Definition: Account lockout duration (minute) for IAM users. Constraints: N/A Range: The value ranges from 15 to 1440. Default Value: N/A |
| login_failed_times | No | Integer | Definition: Maximum number of invalid login attempts. Constraints: N/A Range: The value ranges from 3 to 10. Default Value: N/A |
| period_with_login_failures | No | Integer | Definition: Time limit (minutes). Constraints: N/A Range: The value ranges from 15 to 60. Default Value: N/A |
| session_timeout | No | Integer | Definition: Login session expiration time. Constraints: N/A Range: The value ranges from 15 to 1440. Default Value: N/A |
| show_recent_login_info | No | Boolean | Definition: Whether to display the latest login information. Constraints: N/A Range: The value can be true or false. Default Value: N/A |
| allow_address_netmasks | No | Array of AllowAddressNetmask objects | Definition: IP address or network segment that can be accessed, for example, xxx.xxx.xxx.xxx/24. Constraints: N/A Range: N/A Default Value: N/A |
| allow_ip_ranges | No | Array of AllowIpRange objects | Definition: IP address range that is allowed to access, for example, 0.0.0.0-255.255.255.255. Constraints: N/A Range: N/A Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| address_netmask | Yes | String | Definition: IP address or CIDR block, for example, 192.168.0.1/24. Constraints: N/A Range: N/A Default Value: N/A |
| description | No | String | Definition: Description. Constraints: The value cannot contain the following characters: "@", "#", "%", "&", "<", ">", "\", "$", "^", and "*". The value contains 0 to 255 characters. Range: N/A Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| ip_range | Yes | String | Definition: IP address range, for example, 0.0.0.0-255.255.255.255. Constraints: N/A Range: N/A Default Value: N/A |
| description | No | String | Definition: Description. Constraints: The value cannot contain the following characters: "@", "#", "%", "&", "<", ">", "\", "$", "^", and "*". The value contains 0 to 255 characters. Range: N/A Default Value: N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| login_policy | login_policy object | Definition: Login authentication policy Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| user_validity_period | Integer | Definition: If an IAM user does not log in within the validity period (days) specified by this parameter, the user will be disabled. Range: N/A |
| custom_info_for_login | String | Definition: Login information. Range: N/A |
| lockout_duration | Integer | Definition: Account lockout duration (minute) for IAM users. Range: N/A |
| login_failed_times | Integer | Definition: Maximum number of invalid login attempts. Range: N/A |
| period_with_login_failures | Integer | Definition: Time limit (minutes). Range: N/A |
| session_timeout | Integer | Definition: Login session expiration time. Range: N/A |
| show_recent_login_info | Boolean | Definition: Whether to display the latest login information. Range: N/A |
| allow_address_netmasks | Array of allow_address_netmasks objects | Definition: IP address or network segment that can be accessed. Range: N/A |
| allow_ip_ranges | Array of allow_ip_ranges objects | Definition: IP address range from which access is allowed. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| address_netmask | String | Definition: IP address or CIDR block, for example, 192.168.0.1/24. Range: N/A |
| description | String | Definition: Description. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| ip_range | String | Definition: IP address range, for example, 0.0.0.0-255.255.255.255. Range: N/A |
| description | String | Definition: Description. Range: N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition : Error code. For details, see Error Code. Range: The format is PAP5.XXXX, for example, PAP5.0012. |
| error_msg | String | Definition : Error message. For details, see Error Message. Range: N/A. |
| request_id | String | Definition: Unique identifier of an API request, which is used to locate API calling exceptions. Range: N/A |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition : Error code. For details, see Error Code. Range: The format is PAP5.XXXX, for example, PAP5.0012. |
| error_msg | String | Definition : Error message. For details, see Error Message. Range: N/A. |
| request_id | String | Definition: Unique identifier of an API request, which is used to locate API calling exceptions. Range: N/A |
| encoded_authorization_message | String | Definition : Encrypted details returned when the authentication fails, which are used to locate authentication problems. The STS5 decryption API can be used for decryption. For details, see API link. Range: N/A. |
Example Requests
Modifying the account login policy
PUT https://{endpoint}/v5/login-policy
{
"user_validity_period" : 0,
"custom_info_for_login" : "info",
"lockout_duration" : 15,
"login_failed_times" : 5,
"period_with_login_failures" : 15,
"session_timeout" : 60,
"show_recent_login_info" : false,
"allow_sms_login" : "true",
"allow_address_netmasks" : [ {
"address_netmask" : "192.168.0.1/24",
"description" : "description"
} ],
"allow_ip_ranges" : [ {
"ip_range" : "0.0.0.0-255.255.255.255",
"description" : "description"
} ]
} Example Responses
Status code: 200
Successful
{
"login_policy" : {
"user_validity_period" : 0,
"custom_info_for_login" : "info",
"lockout_duration" : 15,
"login_failed_times" : 5,
"period_with_login_failures" : 15,
"session_timeout" : 60,
"show_recent_login_info" : false,
"allow_address_netmasks" : [ {
"address_netmask" : "192.168.0.1/24",
"description" : "description"
} ],
"allow_ip_ranges" : [ {
"ip_range" : "0.0.0.0-255.255.255.255",
"description" : "description"
} ]
}
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Successful |
| 400 | Bad request |
| 403 | Forbidden |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot