GenAuth DocsDocuments
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Old version
Development Integration
  • API

  • SDK

    • Java

      • Installation and use
      • User authentication module

      • Management module

        • Manage users

        • Management Roles

        • Manage user groups

        • Manage custom fields

        • Manage Resources and Permissions

        • Manage data resources and permissions

        • Manage Applications

        • Manage Identity Sources

        • Manage security configuration

          • Get security configuration
          • Modify security configuration
          • Get global multi-factor authentication configuration
          • Modify global multi-factor authentication configuration
        • Manage message service

        • Manage Pipeline

        • Manage Webhook

        • Get audit log

        • Manage metering and billing

        • Events
    • Node.js

    • Python

  • Error Codes
  1. Development Integration
  2. /
  3. SDK
  4. /
  5. Java
  6. /
  7. Management module

  8. /
  9. Manage security configuration

  10. /
  11. Modify security configuration

¶ Modify security configuration

Update time: 2025-07-23 07:34:21
Edit

This document is automatically generated based on https://github.com/authing/authing-docs-factory based on https://api-explorer.genauth.ai V3 API, and is consistent with API parameters and return results. If the description of this document is incorrect, please refer to V3 API.

Optional security domain, GenAuth Token validity period (seconds), verification code length, verification code attempts, user mailbox modification security policy, user mobile phone number modification security policy, cookie expiration time setting, whether to prohibit user registration, frequent registration detection configuration, whether to require users to set passwords after verification code registration, whether to prohibit login and send authentication emails when logging in with unverified mailboxes, user self-service unlock configuration, whether to enable login account selection on the GenAuth login page, and APP scan code login security configuration to modify security configuration

¶ Method Name

ManagementClient.updateSecuritySettings

¶ Request Parameters

NameType
Is it required
Default Value
Description
Example Value
allowedOriginsstring[]No-Security domain (CORS)["https://example.com"]
authingTokenExpiresInnumberNo129600GenAuth Token validity period (seconds)1296000
verifyCodeLengthnumberNo6Verification code length. Includes SMS verification code, email verification code, and graphic verification code.6
verifyCodeMaxAttemptsnumberNo1Number of verification code attempts. Within a verification code validity period (default is 60 s), if the number of incorrect verification code input by the user exceeds this threshold, the current verification code will become invalid and need to be resent.1
changeEmailStrategyChangeEmailStrategyDtoNo-Security strategy for users to change their email addresses{"verifyOldEmail":true}
changePhoneStrategyChangePhoneStrategyDtoNo-Security strategy for users to change their phone numbers{"verifyOldPhone":true}
cookieSettingsCookieSettingsDtoNo-Cookie expiration time settings
registerDisabledbooleanNo-Whether to prohibit user registration. After enabling, users will not be able to register on their own and only administrators can create accounts for them. For B2B and B2E user pools, it is enabled by default.
registerAnomalyDetectionRegisterAnomalyDetectionConfigDtoNo-Frequent registration detection configuration
completePasswordAfterPassCodeLoginbooleanNo-Whether to require users to set a password after verification code registration (only valid for GenAuth login page and Guard, not for API calls).
loginAnomalyDetectionLoginAnomalyDetectionConfigDtoNo-Login anti-riot configuration
loginRequireEmailVerifiedbooleanNo-When logging in with an email, whether to prohibit login and send a verification email when logging in with an unverified email. The user can log in only after receiving the email and completing the verification.
selfUnlockAccountSelfUnlockAccountConfigDtoNo-User self-service unlock configuration. Note: Only users who have bound their mobile phone number/email can self-unlock
enableLoginAccountSwitchbooleanNo-Whether to enable login account selection on the GenAuth login page
qrcodeLoginStrategyQrcodeLoginStrategyDtoNo-APP scan code login security configuration

¶ Sample Code

package test.management;

import cn.authing.sdk.java.client.ManagementClient;
import cn.authing.sdk.java.dto.SecuritySettingsRespDto;
import cn.authing.sdk.java.dto.UpdateSecuritySettingsDto;
import cn.authing.sdk.java.model.ManagementClientOptions;
import cn.authing.sdk.java.util.JsonUtils;

public class UpdateSecuritySettingsTest {
    // Need to be replaced with your GenAuth Access Key ID
    private static final String ACCESS_KEY_ID = "AUTHING_ACCESS_KEY_ID";
    // Need to be replaced with your GenAuth Access Key Secret
    private static final String ACCESS_KEY_SECRET = "AUTHING_ACCESS_KEY_SECRET";

    public static void main(String[] args) throws Throwable {
        ManagementClientOptions clientOptions = new ManagementClientOptions();
        clientOptions.setAccessKeyId(ACCESS_KEY_ID);
        clientOptions.setAccessKeySecret(ACCESS_KEY_SECRET);
        // If you are a private deployment customer, you need to set the GenAuth service domain name
        // clientOptions.setHost("https://api.your-authing-service.com");

        ManagementClient client = new ManagementClient(clientOptions);

        SecuritySettingsRespDto response = client.updateSecuritySettings(new UpdateSecuritySettingsDto());
        System.out.println(JsonUtils.serialize(response));
    }
}

¶ Request Response

Type: SecuritySettingsRespDto

NameTypeDescription
statusCodenumberBusiness status code, which can be used to determine whether the operation is successful. 200 means success.
messagestringDescription
apiCodenumberSegmented error code, which can be used to get the specific error type (successful requests are not returned). For a detailed list of error codes, see: API Code List (opens new window)
requestIdstringRequest ID. Returned when the request fails.
dataSecuritySettingsDtoResponse data

Example Results:

{
  "statusCode": 200,
  "message": "Operation successful",
  "requestId": "934108e5-9fbf-4d24-8da1-c330328abd6c",
  "data": {
    "allowedOrigins": "https://example.com \n https://example.com",
    "authingTokenExpiresIn": 1296000,
    "verifyCodeLength": 6,
    "verifyCodeMaxAttempts": 1,
    "changeEmailStrategy": {
      "verifyOldEmail": true
    },
    "changePhoneStrategy": {
      "verifyOldPhone": true
    },
    "cookieSettings": {
      "cookieExpiresIn": 1209600
    },
    "registerAnomalyDetection": {
      "limit": 50,
      "timeInterval": 300
    },
    "loginAnomalyDetection": {
      "loginFailStrategy": "captcha",
      "robotVerify": "condition_set",
      "accountLock": "condition_set",
      "loginFailCheck": {
        "limit": 50,
        "timeInterval": 300,
        "unit": "Second"
      },
      "loginPasswordFailCheck": {
        "limit": 50,
        "timeInterval": 300,
        "unit": "Second"
      },
      "accountLockLoginPasswordFailCheck": {
        "limit": 50,
        "timeInterval": 300,
        "unit": "Second"
      },
      "robotVerifyLoginPasswordFailCheck": {
        "limit": 50,
        "timeInterval": 300,
        "unit": "Second"
      },
      "robotVerifyLoginIpWhitelistCheck": {
        "ipWhitelist": "132.133.123.144,255.255.255.255"
      }
    },
    "selfUnlockAccount": {
      "strategy": "captcha"
    },
    "qrcodeLoginStrategy": {
      "qrcodeExpiresIn": 120,
      "qrcodeExpiresInUnit": "Second",
      "ticketExpiresIn": 300,
      "ticketExpiresInUnit": "Second",
      "allowExchangeUserInfoFromBrowser": true,
      "returnFullUserInfo": true
    }
  }
}

¶ Data Structure

¶ ChangeEmailStrategyDto

NameType
Is it required
Description
Example Value
verifyOldEmailbooleanyesWhether to verify the old email address when changing the email addresstrue

¶ ChangePhoneStrategyDto

NameType
Is it required
Description
Example Value
verifyOldPhonebooleanyesWhether to verify the old phone number when changing the phone numbertrue

¶ CookieSettingsDto

NameType
Is it required
Description
Example Value
cookieExpiresInnumberyesCookie validity period: the validity period of the user's login status (default is 1209600 seconds/14 days). After expiration, the user needs to log in again. For the application panel and applications that have been added to the application panel, this cookie expiration time will be used.1209600
cookieExpiresOnBrowserSessionbooleanyesCookie expiration time is based on the browser session: it expires immediately after the current browser is closed, and you need to log in again the next time you open it.

¶ RegisterAnomalyDetectionConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanyesWhether to enable frequent registration restriction
limitnumberyesWithin a certain time period, for the same IP, the maximum number of registrations can be made.50
timeIntervalnumberyesThe length of the limited period, in seconds.300

¶ LoginAnomalyDetectionConfigDto

NameType
Is it required
Description
Example Value
loginFailStrategystringYesLogin security strategy. When a user triggers login failure frequency detection, what strategy to use. Currently supports verification code and account lock strategies. When selecting the account lock strategy, only "Login password error limit" can be enabled. This field is marked as obsolete, but this field is still required. If you use the new version logic, you can write one by default. The new version uses accountLock for account locking and robotVerify for verification codecaptcha
robotVerifystringyesHuman-machine verification (verification code) strategy. Optional values: disable (not enabled)/condition_set (conditional enable)/always_enable (always enabled)condition_set
accountLockstringYesAccount lockout policy. Optional values: disable (disabled)/condition_set (conditional enabled)condition_set
loginFailCheckYesLimit of failed logins: When the user inputs incorrect login information, the corresponding policy will be triggered according to the "Login Security Policy" rule. Nested Type: LoginFailCheckConfigDto.
loginPasswordFailCheckYesLimit of incorrect login passwords: When the user inputs incorrect login password information, the corresponding policy will be triggered according to the "Login Security Policy" rule. This field is marked as obsolete, see accountLockLoginPasswordFailCheck/ robotVerifyLoginPasswordFailCheck Nested Type: LoginPassowrdFailCheckConfigDto.
accountLockLoginPasswordFailCheckNoAccount lock-login password error restriction: When the user logs in and enters the wrong password information, the corresponding policy will be triggered according to the "Login Security Policy" rule. Nested Type: LoginPassowrdFailCheckConfigDto.
robotVerifyLoginPasswordFailCheckYesHuman-machine verification (verification code)-login password error restriction: When the user logs in and enters the wrong password information, the corresponding policy will be triggered according to the "Login Security Policy" rule. Nested Type: LoginPassowrdFailCheckConfigDto.
robotVerifyLoginIpWhitelistCheckYesHuman-machine verification (verification code)-ip whitelist: When the login IP is not in the whitelist, human-machine verification will be triggered. Nested Type: LoginIpWhitelistCheckConfigDto.
robotVerifyLoginTimeCheckEnablebooleanyesWhether to enable login time limit
robotVerifyloginWeekStartEndTimearrayyesLogin time limit weekday + start time array

¶ LoginFailCheckConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanyesWhether to enable login failure limit.
limitnumberyesWithin a certain time period, for the same IP, the maximum number of failed logins before the security policy is triggered.50
timeIntervalnumberyesLimit the period time length, in seconds.300
unitstringnoTime length unit. Second/Minute/Hour/Day, only for display, the unit of timeInterval is still secondsSecond

¶ LoginPassowrdFailCheckConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanyesWhether to enable login password error limit
limitnumberyesMaximum limit on the number of password errors50
timeIntervalnumberyesLimits the duration of the period in seconds.300
unitstringnoThe unit of duration. Second/Minute/Hour/Day, only for display, the unit of timeInterval is still secondsSecond

¶ LoginIpWhitelistCheckConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanyesWhether to enable login ip whitelist verification
ipWhiteliststringyesHuman-machine verification ip whitelist132.133.123.144,255.255.255.255

¶ SelfUnlockAccountConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanyesWhether to allow users to unlock their accounts by themselves.
strategystringyesSelf-service unlocking method. Currently supports original password + verification code and verification code.captcha

¶ QrcodeLoginStrategyDto

NameType
Is it required
Description
Example Value
qrcodeExpiresInnumberYesQR code validity period, in seconds120
qrcodeExpiresInUnitstringNoTime unit, Second/Minute/Hour/Day, for display onlySecond
ticketExpiresInnumberYesTicket validity period, in seconds300
ticketExpiresInUnitstringNoTime unit, Second/Minute/Hour/Day, for display onlySecond
allowExchangeUserInfoFromBrowserbooleanyesThe Web polling interface returns complete user information, see this document for details: Web polling interface returns complete user informationtrue
returnFullUserInfobooleanyesAllow using ticket to exchange user information in the browser, see this document for details: Web polling interface returns complete user informationtrue

¶ SecuritySettingsDto

NameType
Is it required
Description
Example Value
allowedOriginsstringNoSecurity domain (CORS)`https://example.com
https://example.com`
authingTokenExpiresInnumberYesGenAuth Token validity period (seconds)1296000
verifyCodeLengthnumberYesVerification code length. Includes SMS verification code, email verification code, and graphic verification code.6
verifyCodeMaxAttemptsnumberYesNumber of verification code attempts. Within a verification code validity period (default is 60 s), if the number of incorrect verification code input by the user exceeds this threshold, the current verification code will become invalid and need to be resent.1
changeEmailStrategyYesUser changes the security strategy of the mailbox Nested Type: ChangeEmailStrategyDto.{"verifyOldEmail":true}
changePhoneStrategyYesSecurity strategy for users to change their phone numbers Nested Type: ChangePhoneStrategyDto.{"verifyOldPhone":true}
cookieSettingsNoCookie expiration time settings Nested Type: CookieSettingsDto.
registerDisabledbooleanYesWhether to prohibit user registration. After enabling, users will not be able to register on their own, and only administrators can create accounts for them. For B2B and B2E user pools, it is enabled by default.
registerAnomalyDetectionYesFrequent registration detection configuration Nested Type: RegisterAnomalyDetectionConfigDto.
completePasswordAfterPassCodeLoginbooleanyesWhether to require users to set a password after verification code registration (valid only for GenAuth login page and Guard, not for API calls).
loginAnomalyDetectionyesLogin anti-violent configuration Nested Type: LoginAnomalyDetectionConfigDto.
loginRequireEmailVerifiedbooleanyesWhen logging in with an email, whether to prohibit login and send a verification email when logging in with an unverified email. The user can only log in after receiving the email and completing the verification.
selfUnlockAccountyesUser self-service unlock configuration. Note: Only users who have bound their mobile phone number/email address can self-unlock Nested Type: SelfUnlockAccountConfigDto.
enableLoginAccountSwitchbooleanYesGenAuth Whether to enable login account selection on the login page
qrcodeLoginStrategyYesAPP scan code login security configuration Nested Type: QrcodeLoginStrategyDto.
verifyOldPhonebooleanyesWhether to verify the old phone number when changing the phone numbertrue

¶ CookieSettingsDto

NameType
Is it required
Description
Example Value
cookieExpiresInnumberyesCookie validity period: the validity period of the user's login status (default is 1209600 seconds/14 days). After expiration, the user needs to log in again. For the application panel and applications that have been added to the application panel, this cookie expiration time will be used.1209600
cookieExpiresOnBrowserSessionbooleanyesCookie expiration time is based on browser session: it expires immediately after the current browser is closed, and you need to log in again the next time you open it.

¶ RegisterAnomalyDetectionConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanyesWhether to enable frequent registration limit
limitnumberyesWithin a certain period of time, for the same IP, the maximum number of registrations can be limited.50
timeIntervalnumberyesspecifies the duration of the period in seconds.300

¶ LoginAnomalyDetectionConfigDto

NameType
Is it required
Description
Example Value
loginFailStrategystringYesLogin security strategy. When a user triggers login failure frequency detection, what strategy is used? Currently, two strategies are supported: verification code and account lock. When selecting the account lock strategy, only "Login password error limit" can be enabled. This field is marked as obsolete, but this field is still required. If you use the new version logic, you can write one by default. The new version uses accountLock for account lock and robotVerify for verification codecaptcha
robotVerifystringYesHuman-machine verification (verification code) strategy. Optional values, disable (not enabled)/condition_set (conditional enable)/always_enable (always enabled)condition_set
accountLockstringYesAccount lock strategy. Optional values, disable (not enabled)/condition_set (conditional enable)condition_set
loginFailCheckYesLogin failure limit: When the user enters incorrect information during login, the corresponding strategy will be triggered according to the "Login Security Strategy" rules. Nested Type: LoginFailCheckConfigDto.
loginPasswordFailCheckYesLogin password error restriction: When the user logs in and enters the wrong password information, the corresponding policy will be triggered according to the "Login Security Policy" rule. This field is marked as obsolete, see accountLockLoginPasswordFailCheck/ robotVerifyLoginPasswordFailCheck Nested Type: LoginPassowrdFailCheckConfigDto.
accountLockLoginPasswordFailCheckNoAccount lock-login password error restriction: When the user logs in and enters the wrong password information, the corresponding policy will be triggered according to the "Login Security Policy" rule. Nested Type: LoginPassowrdFailCheckConfigDto.
robotVerifyLoginPasswordFailCheckYesHuman-machine verification (verification code) - Login password error restriction: When the user logs in and enters the wrong password information, the corresponding policy will be triggered according to the "Login Security Policy" rule. Nested Type: LoginPassowrdFailCheckConfigDto.
robotVerifyLoginIpWhitelistCheckYesHuman-machine verification (verification code) - IP whitelist: When the login IP is not in the whitelist, human-machine verification will be triggered. Nested Type: LoginIpWhitelistCheckConfigDto.
robotVerifyLoginTimeCheckEnablebooleanyesWhether to enable login time limit
robotVerifyloginWeekStartEndTimearrayyesLogin time limit weekday + start time array

¶ LoginFailCheckConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanyesWhether to enable login failure limit.
limitnumberyesWithin a certain period of time, for the same IP, the maximum number of login failures before the security policy is triggered.50
timeIntervalnumberyesspecifies the duration of the period in seconds.300
unitstringNoTime unit. Second/Minute/Hour/Day, for display only, the unit of timeInterval is still secondSecond

¶ LoginPassowrdFailCheckConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanYesWhether to enable login password error limit
limitnumberYesMaximum number of password errors50
timeIntervalnumberYesLimit the period time length, in seconds.300
unitstringNoThe unit of time length. Second/Minute/Hour/Day, only for display, the unit of timeInterval is still secondsSecond

¶ LoginIpWhitelistCheckConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanyesWhether to enable login ip whitelist verification
ipWhiteliststringyesHuman-machine verification ip whitelist132.133.123.144,255.255.255.255

¶ SelfUnlockAccountConfigDto

NameType
Is it required
Description
Example Value
enabledbooleanyesWhether to allow users to unlock their accounts by themselves.
strategystringyesSelf-service unlocking method. Currently supports original password + verification code and verification code.captcha

¶ QrcodeLoginStrategyDto

NameType
Is it required
Description
Example Value
qrcodeExpiresInnumberYesQR code validity period, in seconds120
qrcodeExpiresInUnitstringNoTime unit, Second/Minute/Hour/Day, for display onlySecond
ticketExpiresInnumberYesTicket validity period, in seconds300
ticketExpiresInUnitstringNoTime unit, Second/Minute/Hour/Day, for display onlySecond
allowExchangeUserInfoFromBrowserbooleanyesThe Web polling interface returns complete user information, see this document for details: Web polling interface returns complete user informationtrue
returnFullUserInfobooleanyesAllow using ticket to exchange user information in the browser, see this document for details: Web polling interface returns complete user informationtrue
Previous article: Get security configuration Next article: Get global multi-factor authentication configuration
  • Method Name
  • Request Parameters
  • Sample Code
  • Request Response
  • Data Structure

User identity management

Integrated third-party login
Customized authentication process

Enterprise internal management

Single sign-on
Multi-factor authentication
Permission management

Developer

Development Documentation
GitHub (opens new window)

Company

official@genauth.ai
16th Floor, Building B, Beichen Century Center, Chaoyang District, Beijing (Total)
Room 406, 4th Floor, Block B, No. 200, Tianfu Fifth Street, High-tech Zone, Chengdu (Branch)

© Beijing Steamory Technology Co., Ltd.