Newer Version Available
SecuritySettings
In the package manifest, all organization settings metadata types are accessed using the Settings name. See Settings for more details.
File Suffix and Directory Location
SecuritySettings values are stored in a single file named Security.settings in the settings directory. The .settings files are different from other named components because there’s only one settings file for each settings component.
Version
Security settings are available in API version 27.0 and later. API versions 26 and earlier are no longer available.
Fields
| Field Name | Field Type | Description |
|---|---|---|
| canUsersGrantLoginAccess | boolean | If true, users can grant login access to Support. If false, only an admin can grant login access. |
| enableAdminLoginAsAnyUser | boolean | If true, the Administrators Can Log in as Any User field is enabled. The default isn’t enabled (false). |
| enableAuditFieldsInactiveOwner | boolean | If true, this setting enables audit fields and updating the owner for records that are owned by inactive users. The default value is false. This field is available in API version 47.0 and later. |
| enableAuraSecureEvalPref | boolean | If true, this setting prevents the creation of function expressions in dynamically created Aura components. The default is false. This field is available in API version 47.0 and later. |
| enableRequireHttpsConnection | boolean | Deprecated in API version 47.0 and later. |
| isTLSv12Required | boolean | Indicates whether connections to or from your Salesforce org must use TLS 1.2 or higher (true) or not (false). This field has a default value of false. Removed in API version 51.0 and later. |
| isTLSv12RequiredCommunities | boolean | Indicates whether connections with your Salesforce sites and portals or Experience Cloud sites must use TLS 1.2 or higher (true) or not (false). This field has a default value of false. Removed in API version 51.0 and later. |
| networkAccess | NetworkAccess | The trusted IP address ranges from which users can always log in without requiring computer activation. |
| passwordPolicies | PasswordPolicies | The requirements for passwords and logins, and assistance with retrieving forgotten passwords. |
| sessionSettings | SessionSettings | The settings for session expiration and security. |
| singleSignOnSettings | SingleSignOnSettings | The settings for single sign-on (SSO). |
NetworkAccess
Represents your org’s trusted IP address ranges for network access.
| Field | Field Type | Description |
|---|---|---|
| ipRanges | IpRange[] | The trusted IP address ranges from which users can always log in without requiring computer activation. |
IpRange
Defines a range of trusted IP addresses for network access.
PasswordPolicies
Represents your org’s password and login policies, which show up under .
| Field | Field Type | Description |
|---|---|---|
| apiOnlyUserHomePageURL | string | The URL to which users with the “API Only User” permission are redirected instead of the login page. |
| complexity | Complexity (enumeration of type string) |
The types of characters that must be used
in a user’s password. Valid values are:
|
| enableSetPasswordInApi | boolean | Deprecated in API version 51.0 and later. |
| expiration | Expiration (enumeration of type string) | |
| historyRestriction | string | The number of previous passwords saved for users so that they must always reset a new, unique password. Valid values are 0 through 24 passwords remembered. The maximum value of 24 applies to API version 31.0 and later. In earlier versions, the maximum value is 16. The default value is 3. |
| lockoutInterval | LockoutInterval (enumeration of type string) | |
| maxLoginAttempts | MaxLoginAttempts (enumeration of type string) | |
| minimumPasswordLength | string |
The minimum number of characters required for a password. The number can contain from 5 to 50 characters (default is 8). Available in API version 35.0 and later. Before API version 35.0, specify minimum password length with the enumeration minPasswordLength, with valid values FiveCharacters, EightCharacters (default), TenCharacters, TwelveCharacters (API version 31.0 and later), and FifteenCharacters (API version 34.0 and later). |
| minimumPasswordLifetime | boolean | If Require a minimum 1 day password lifetime is enabled (true), passwords can’t be changed more than one time during a 24-hour period. The default is false. Available in API version 31.0 and later. |
| obscureSecretAnswer | boolean | If enabled (true), hide answers to security questions as the user types. The default is false. |
| passwordAssistanceMessage | string | The text that appears in the Account Lockout email and at the bottom of the Confirm Identity screen for users resetting their passwords. |
| passwordAssistanceURL | string | The URL that users can click to retrieve forgotten passwords. |
| questionRestriction | QuestionRestriction (enumeration of type string) |
SessionSettings
Represents your org’s session expiration and security settings.
| Field | Field Type | Description |
|---|---|---|
| allowUserAuthenticationByCertificate | boolean | If enabled (true), users can authenticate with a PEM-encoded X.509 digital certificate. Not enabled by default. Available in API version 47.0 and later. |
| canConfirmEmailChangeInLightningCommunities | boolean | If Require email confirmations for email address changes is enabled (true), when users change their email address, they receive an email at the new address with a link. After they click the link, their new email address takes effect. For orgs created before Winter ‘20, the field isn’t enabled by default. For new orgs, this field is always enabled. To disable the field (not recommended), contact Salesforce Customer Support. Available in API version 47.0 and later. |
| canConfirmIdentityBySmsOnly | boolean | Prevents identity verification by email for users who have
registered other verification methods, such as SMS or Salesforce
Authenticator. If no other verification methods are configured,
users are verified by email. By default, this setting is disabled (false) for existing orgs. For new orgs, this setting is enabled (true) by default. Available in API version 48.0 and later. |
| disableTimeoutWarning | boolean | Indicates whether the session timeout warning popup is disabled (true) or enabled (false). |
| enableCSPOnEmail | boolean | Indicates whether a content security policy is enabled for the email template. A content security policy helps prevent cross-site scripting attacks by listing allowed sources of images and other content. |
| enableCSRFOnGet | boolean | Indicates whether Cross-Site Request Forgery (CSRF) protection on GET requests on non-setup pages is enabled (true) or disabled (false). |
| enableCSRFOnPost | boolean | Indicates whether Cross-Site Request Forgery (CSRF) protection on POST requests on non-setup pages is enabled (true) or disabled (false). |
| enableCacheAndAutocomplete | boolean | Indicates whether the user’s browser is allowed to store usernames and auto-fill the User Name field on the login page (true) or not (false). |
| enableClickjackNonsetupSFDC | boolean | Indicates whether clickjack protection for non-setup Salesforce pages is enabled (true) or disabled (false). |
| enableClickjackNonsetupUser | boolean | Indicates whether clickjack protection for customer Visualforce pages with standard headers turned on is enabled (true) or disabled (false). |
| enableClickjackNonsetupUserHeaderless | boolean | Indicates whether clickjack protection for customer Visualforce pages with standard headers turned off is enabled (true) or disabled (false). Available in API version 34.0 and later. |
| enableClickjackSetup | boolean | Indicates whether clickjack protection for setup pages is enabled (true) or disabled (false). |
| enableContentSniffingProtection | boolean |
Indicates if the browser is prevented from inferring the MIME type from the document content and from executing malicious files (JavaScript, Stylesheet) as dynamic content. This field is available in API version 39.0 and later. |
| enableLightningLogin | boolean | If enabled (true), users can use Lightning Login (Salesforce Authenticator) to log in instead of a password. Available in API Version 47.0 and later. |
| enableLightningLoginOnlyWithUserPerm | boolean | If enabled (true), only users with the Lightning Login User permission can log in with Salesforce Authenticator instead of a password. Available in API version 47.0 and later. |
| enableOauthCorsPolicy | boolean | If set to true, enables
Cross-Origin Resource Sharing (CORS) for these OAuth endpoints:
Default setting is false. Available in API version 50.0 and later. |
| enablePostForSessions | boolean | Indicates whether cross-domain session information is exchanged using a POST request instead of a GET request, such as when a user is using a Visualforce page. In this context, POST requests are more secure than GET requests. Available in API version 31.0 and later. |
| enableSMSIdentity | boolean | If enabled (true), the default, users can receive a one-time password in a text message (SMS) to verify their identity. Users must verify their mobile phone number before they can receive SMS messages. |
| enableU2F | boolean | If enabled (true), users can use a physical U2F-compatible security key for multi-factor authentication (MFA) and identity verification. The default is false. Available in API version 47.0 and later. |
| enableUpgradeInsecureRequests | boolean |
Indicates if HTTPS is required for connecting to third-party domains. This field is available in API version 42.0 and later. |
| enableXssProtection | boolean |
Indicates if protection against reflected cross-site scripting attacks is enabled. If a reflected cross-site scripting attack is detected and XSS protection is enabled, the browser shows a blank page with no content. This field is available in API version 39.0 and later. |
| enforceIpRangesEveryRequest | boolean | If true, the IP addresses in Login IP Ranges are enforced when a user accesses Salesforce (on every page request), including access from a client app. If false, the IP addresses in Login IP Ranges are enforced only when a user logs in. This field affects all user profiles that have login IP restrictions. Available in API version 34.0 and later. |
| enforceUserDeviceRevoked | boolean |
If enabled, and a UserDevice’s status is set to revoked, that device can’t log in from a Salesforce app. Logins from browsers aren’t affected. This field is available in API version 50.0 and later. |
| forceLogoutOnSessionTimeout | boolean | If enabled (true), the default, when sessions time out for inactive users, current sessions become invalid. The browser refreshes and returns to the login page. To access the org, the user must log in again. Available in API version 31.0 and later. |
| forceRelogin | boolean | If true, an admin who is logged in as another user must log in again to their original session, after logging out as the secondary user. If false, the admin isn’t required to log in again. |
| hasRetainedLoginHints | boolean | If you enable Remember me until logout (true), usernames (login hints) are cached until the user logs out. If a session times out, usernames appear on the Switcher as inactive. If false (default), usernames aren't cached for SSO sessions. |
| hasUserSwitching | boolean | If Enable user switching istrue (default), users can log in to
other orgs by selecting their profile picture and using the
Switcher. You must also enable the Enable caching and
autocomplete on login page setting. If false, the Switcher isn’t enabled and your org doesn’t appear in Switchers on other orgs. |
| hstsOnForcecomSites | boolean | Indicates whether Visualforce, Salesforce sites, or Experience Cloud sites must use HTTPS. Available in API version 41.0 and later. |
| identityConfirmationOnEmailChange | boolean |
Indicates if a user’s identity is confirmed when changing their email address, instead of requiring a relogin. This field is available in API version 42.0 and later. |
| identityConfirmationOnTwoFactorRegistrationEnabled | boolean |
Indicates if users are required to confirm their identities when adding a verification method such as Salesforce Authenticator for multi-factor authentication (MFA), instead of requiring a relogin. (Multi-factor authentication was formerly called two-factor authentication.) This field is available in API version 40.0 and later. |
| lockSessionsToDomain | boolean | Indicates whether the current UI session for a user is associated with a specific domain. This check helps prevent unauthorized use of the session ID in another domain. The value is true by default for orgs created with the Spring ’15 release or later. Available in API version 33.0 and later. |
| lockSessionsToIp | boolean | Indicates whether user sessions are locked to the IP address from which the user logged in (true) or not (false). |
| lockerServiceAPIVersion | string | The API version that Lightning Locker enforces for security of
custom Lightning components. The default value matches the
Salesforce API version of the current release. Only valid Salesforce
API versions between 46.0 and the current release can be specified.
The version must be a specified as a string in the format "nn.0", such as "48.0". This field is available in API version 47.0 and later. |
| logoutURL | string | The URL to which users are redirected when they log out of Salesforce. If no value is specified, the default is https://login.salesforce.com unless MyDomain is enabled. If My Domain is enabled, the default is https://customdomain.my.salesforce.com. Available in API version 34.0 and later. |
| redirectionWarning | boolean | Indicates whether users see an alert when they click a link in a web tab that redirects them outside the saleforce.com domain. Available in API version 42.0 and later. |
| referrerPolicy | boolean | Indicates whether the referrer header hides sensitive information that could be present in the full URL. If true, then the referrer header displays only salesforce.com. If false, then the header displays the entire URL. For a Visualforce user, if referrerPolicy is set to true, then the referrer header displays only force.com. If false, then the header displays the entire URL. Available in API version 42.0 and later. |
| requireHttpOnly | boolean | Sets the HttpOnly attribute on session cookies, making them inaccessible via JavaScript. If true, session ID cookie access is restricted. If false, access is restricted. This field is available in API version 40.0 and later. |
| requireHttps | boolean |
Determines whether HTTPS is required to log in to or access Salesforce. This option is enabled by default for security reasons and can’t be disabled. To change to HTTP, contact Salesforce Customer Support. This field is available in API version 40.0 and later. |
| securityCentralKillSession | boolean | Deprecated in API version 36.0 to 50.0. Removed in API version 51.0 and later. |
| sessionTimeout | SessionTimeout (enumeration of type string) |
SingleSignOnSettings
Represents your org’s single sign-on (SSO) settings. These settings are available API version 47.0 and later.
| Field Name | Field Type | Description |
|---|---|---|
| enableCaseInsensitiveFederationID | boolean | If you enable Make Federation ID case-insensitive (true), the Federation ID field on a user object isn’t case-sensitive. If disabled (false), the Federation ID field remains case-sensitive. The default is false. |
| enableForceDelegatedCallout | boolean | If you enable Force Delegated Authentication Callout (true), a callout to the SSO endpoint occurs regardless of login restriction failures. If disabled (false), the default, and if a user’s first login attempt fails due to login restrictions within the Salesforce org, a call isn’t made to the SSO endpoint. |
| enableMultipleSamlConfigs | boolean | If true (default), you can configure multiple SAML providers. After enabling the setting, it can’t be disabled. |
| enableSamlJitProvisn’tioning | boolean | If you enable User Provisioning Enabled (true), you can provision users through a SAML assertion (called just-in-time provisioning). Requires EnableSamlLogin to be true and enableMultipleSamlConfigs to be false. The default is enabled (false). |
| enableSamlLogin | boolean | If you enable SAML Enabled (true), users can SSO into Salesforce from providers via SAML. The default isn’t enabled (false). |
| isLoginWithSalesforceCredentialsDisabled | boolean | If Disable login with Salesforce credentials is true, users are redirected to third-party identity providers for authentication. The default is enabled (false). |
Declarative Metadata Sample Definition
The following is a sample security.settings metadata file.
1<?xml version="1.0" encoding="UTF-8"?>
2<SecuritySettings xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3 <enableAdminLoginAsAnyUser xsi:nil="true"/>
4 <enableAuraSecureEvalPref xsi:nil="true"/>
5 <enableAuditFieldsInactiveOwner xsi:nil="true"/>
6 <enableSetRequiredHttpsConnection xsi:nil="true"/>
7 <enableTurnTLSv11Off xsi:nil="true"/>
8 <enableTurnTLSv11OffSites xsi:nil="true"/>
9 <enableTurnTLSv1Off xsi:nil="true"/>
10 <networkAccess/>
11 <passwordPolicies>
12 <complexity>NoRestriction</complexity>
13 <expiration>Never</expiration>
14 <historyRestriction>0</historyRestriction>
15 <lockoutInterval>FifteenMinutes</lockoutInterval>
16 <maxLoginAttempts>TenAttempts</maxLoginAttempts>
17 <minimumPasswordLength>5</minimumPasswordLength>
18 <minimumPasswordLifetime>false</minimumPasswordLifetime>
19 <obscureSecretAnswer>false</obscureSecretAnswer>
20 <questionRestriction>DoesNotContainPassword</questionRestriction>
21 </passwordPolicies>
22 <sessionSettings>
23 <allowUserAuthenticationByCertificate>false</allowUserAuthenticationByCertificate>
24 <disableTimeoutWarning>false</disableTimeoutWarning>
25 <enableCSPOnEmail>true</enableCSPOnEmail>
26 <enableCSRFOnGet>true</enableCSRFOnGet>
27 <enableCSRFOnPost>true</enableCSRFOnPost>
28 <enableCacheAndAutocomplete>true</enableCacheAndAutocomplete>
29 <enableClickjackNonsetupSFDC>true</enableClickjackNonsetupSFDC>
30 <enableClickjackNonsetupUser>false</enableClickjackNonsetupUser>
31 <enableClickjackNonsetupUserHeaderless>false</enableClickjackNonsetupUserHeaderless>
32 <enableClickjackSetup>true</enableClickjackSetup>
33 <enableContentSniffingProtection>true</enableContentSniffingProtection>
34 <enableLightningLogin>true</enableLightningLogin>
35 <enableLightningLoginOnlyWithUserPerm>false</enableLightningLoginOnlyWithUserPerm>
36 <enablePostForSessions>false</enablePostForSessions>
37 <enableSMSIdentity>true</enableSMSIdentity>
38 <enableU2F>false</enableU2F>
39 <enableUpgradeInsecureRequests>true</enableUpgradeInsecureRequests>
40 <enableXssProtection>true</enableXssProtection>
41 <enforceIpRangesEveryRequest>false</enforceIpRangesEveryRequest>
42 <forceLogoutOnSessionTimeout>true</forceLogoutOnSessionTimeout>
43 <forceRelogin>true</forceRelogin>
44 <hasRetainedLoginHints>false</hasRetainedLoginHints>
45 <hasUserSwitching>true</hasUserSwitching>
46 <hstsOnForcecomSites>false</hstsOnForcecomSites>
47 <identityConfirmationOnEmailChange>true</identityConfirmationOnEmailChange>
48 <identityConfirmationOnTwoFactorRegistrationEnabled>true</identityConfirmationOnTwoFactorRegistrationEnabled>
49 <lockSessionsToDomain>true</lockSessionsToDomain>
50 <lockSessionsToIp>false</lockSessionsToIp>
51 <lockerServiceCSP>true</lockerServiceCSP>
52 <redirectionWarning>true</redirectionWarning>
53 <referrerPolicy>true</referrerPolicy>
54 <requireHttpOnly>false</requireHttpOnly>
55 <requireHttps>false</requireHttps>
56 <sessionTimeout>TwoHours</sessionTimeout>
57 </sessionSettings>
58 <singleSignOnSettings>
59
60 <enableCaseInsensitiveFederationID>false</enableCaseInsensitiveFederationID>
61 <enableForceDelegatedCallout>false</enableForceDelegatedCallout>
62 <enableMultipleSamlConfigs>true</enableMultipleSamlConfigs>
63 <enableSamlJitProvisioning>false</enableSamlJitProvisioning>
64 <enableSamlLogin>false</enableSamlLogin>
65 <isLoginWithSalesforceCredentialsDisabled>true</isLoginWithSalesforceCredentialsDisabled>
66
67 </singleSignOnSettings>
68</SecuritySettings>The following is an example package.xml manifest that references the previous definition.
1?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3 <types>
4 <members>Security</members>
5 <name>Settings</name>
6 </types>
7 <version>47.0</version>
8</Package>Wildcard Support in the Manifest File
The wildcard character * (asterisk) in the package.xml manifest file doesn’t apply to metadata types for feature settings. The wildcard applies only when retrieving all settings, not for an individual setting. For details, see Settings. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.