Help Center> Identity and Access Management> API Reference> API> Security Settings> Modifying the Login Protection Configuration of an IAM User
Updated on 2023-07-18 GMT+08:00

Modifying the Login Protection Configuration of an IAM User

Function

This API is provided for the administrator to modify the login protection configuration of an IAM user.

The API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.

URI

PUT /v3.0/OS-USER/users/{user_id}/login-protect

Table 1 URI parameters

Parameter

Mandatory

Type

Description

user_id

Yes

String

ID of the IAM user whose login protection configuration is to be modified. For details about how to obtain a user ID, see Obtaining Account, IAM User, Group, Project, Region, and Agency Information.

Request Parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

X-Auth-token

Yes

String

Token with Security Administrator permissions.

Table 3 Parameter in the request body

Parameter

Mandatory

Type

Description

login_protect

Yes

object

Login protection configuration.

Table 4 Login_project

Parameter

Mandatory

Type

Description

enabled

Yes

Boolean

Indicates whether login protection has been enabled for an IAM user. The value can be true or false.

verification_method

Yes

String

Login authentication method of the IAM user. Options: sms, email, and vmfa.

Response Parameters

Status code: 200

Table 5 Parameters in the response body

Parameter

Type

Description

login_protect

object

Login protection configuration.

Table 6 login_protect

Parameter

Type

Description

user_id

String

ID of the user whose login protection configuration is to be modified.

enabled

Boolean

Whether login protection has been enabled for the user. The value can be true or false.

verification_method

String

Login authentication method of the IAM user. Options: sms, email, and vmfa.

Example Request

Request for enabling login protection and setting the login authentication method to MFA authentication

PUT https://iam.myhuaweicloud.com/v3.0/OS-USER/users/{user_id}/login-protect
 
{ 
  "login_protect" : { 
    "enabled" : true, 
    "verification_method" : "vmfa" 
  } 
}

Example Response

Status code: 200

The request is successful.

{ 
  "login_protect" : { 
    "user_id": "16b26081f43d4c628c4bb88cf32e9...", 
    "enabled" : true, 
    "verification_method" : "vmfa" 
  } 
}

Status Codes

Status Code

Description

200

The request is successful.

400

The request is invalid.

401

Authentication failed.

403

You do not have permission to perform this action.

404

The requested resource cannot be found.

500

A system error occurred.

Error Codes

For details, see Error Codes.