調用SetSecurityPreference介面設定全域安全喜好設定。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

請求參數

名稱 類型 是否必選 樣本值 描述
Action String SetSecurityPreference

要執行的操作。取值:SetSecurityPreference。

EnableSaveMFATicket Boolean true

是否允許RAM使用者在登入時儲存多因素裝置認證狀態,有效期間為7天。取值:

  • true:允許。
  • false(預設值):不允許。
AllowUserToChangePassword Boolean true

是否允許RAM使用者自主管理密碼。取值:

  • true(預設值):允許。
  • false:不允許。
AllowUserToManageAccessKeys Boolean false

是否允許RAM使用者自主管理存取金鑰。取值:

  • true:允許。
  • false(預設值):不允許。
AllowUserToManagePublicKeys Boolean false

是否允許RAM使用者自主管理公開金鑰。取值:

  • true:允許。
  • false(預設值):不允許。
说明 該參數僅在日本站有效。
AllowUserToManageMFADevices Boolean true

是否允許RAM使用者自主管理多因素認證裝置。取值:

  • true(預設值):允許。
  • false:不允許。
LoginSessionDuration Integer 6

RAM使用者登入有效期間。

取值範圍:6~24。預設值:6。單位:小時。

LoginNetworkMasks String 10.0.0.0/8

登入掩碼。登入掩碼決定哪些IP地址會受到登入控制台的影響,包括密碼登入和單點登入(SSO),但使用存取金鑰發起的API調用並不受影響。

  • 如果指定掩碼,RAM使用者只能從指定的IP地址進行登入。
  • 如果不指定任何掩碼,登入控制台功能將適用於整個網路。

當需要配置多個登入掩碼時,請使用分號(;)來分隔,例如:192.168.0.0/16;10.0.0.0/8。

最多配置25個登入掩碼,總長度最大512個字元。

返回資料

名稱 類型 樣本值 描述
RequestId String A978915D-F279-4CA0-A89B-9A71219FFB3E

請求ID。

SecurityPreference Struct

安全喜好設定。

AccessKeyPreference Struct

存取金鑰喜好設定。

AllowUserToManageAccessKeys Boolean false

是否允許RAM使用者自主管理存取金鑰。

LoginProfilePreference Struct

登入喜好設定。

AllowUserToChangePassword Boolean true

是否允許RAM使用者自主管理密碼。

EnableSaveMFATicket Boolean false

是否允許RAM使用者在登入時儲存多因素認證裝置安全碼。

LoginNetworkMasks String 10.0.0.0/8

登入掩碼。

LoginSessionDuration Integer 6

RAM使用者登入有效期間。

MFAPreference Struct

多因素認證喜好設定。

AllowUserToManageMFADevices Boolean false

是否允許RAM使用者自主管理多因素認證裝置。

PublicKeyPreference Struct

公開金鑰喜好設定。

说明 該參數僅在日本站有效。
AllowUserToManagePublicKeys Boolean false

是否允許RAM使用者自主管理公開金鑰。

樣本

請求樣本

https://ram.aliyuncs.com/?Action=SetSecurityPreference
&<公用請求參數>

正常返回樣本

XML 格式

<SetSecurityPreferenceResponse>
	  <SecurityPreference>
		    <LoginProfilePreference>
			      <LoginSessionDuration>6</LoginSessionDuration>
			      <LoginNetworkMasks></LoginNetworkMasks>
			      <AllowUserToChangePassword>true</AllowUserToChangePassword>
			      <EnableSaveMFATicket>false</EnableSaveMFATicket>
		    </LoginProfilePreference>
		    <AccessKeyPreference>
			      <AllowUserToManageAccessKeys>false</AllowUserToManageAccessKeys>
		    </AccessKeyPreference>
		    <PublicKeyPreference>
			      <AllowUserToManagePublicKeys>false</AllowUserToManagePublicKeys>
		    </PublicKeyPreference>
		    <MFAPreference>
			      <AllowUserToManageMFADevices>true</AllowUserToManageMFADevices>
		    </MFAPreference>
	  </SecurityPreference>
	  <RequestId>A978915D-F279-4CA0-A89B-9A71219FFB3E</RequestId>
</SetSecurityPreferenceResponse>

JSON 格式

{
	"SecurityPreference": {
		"LoginProfilePreference": {
			"LoginSessionDuration": 6,
			"LoginNetworkMasks": "",
			"AllowUserToChangePassword": true,
			"EnableSaveMFATicket": false
		},
		"AccessKeyPreference": {
			"AllowUserToManageAccessKeys": false
		},
		"PublicKeyPreference": {
			"AllowUserToManagePublicKeys": false
		},
		"MFAPreference": {
			"AllowUserToManageMFADevices": true
		}
	},
	"RequestId": "A978915D-F279-4CA0-A89B-9A71219FFB3E"
}

錯誤碼

訪問錯誤中心查看更多錯誤碼。