您在此处:
验证 OAuth 策略和设置生成
部署 OAuth 插件时,会生成几个外部客户端应用程序组件。您可以检查一些地方来验证部署是否成功。
查找消费者密钥和密码
打开外部客户端应用程序全局 OAuth 设置文件。文件名是 [ECAPP_OAUTH_SETTINGS].ecaGlblOauth-meta.xml,例如,myecasettings.ecameta.xml,它位于名为 extlClntAppGlobalOauthSets 的目录中。验证 consumerKey 和 consumerSecret 字段是否有值。
<?xml version="1.0" encoding="UTF-8"?>
<ExtlClntAppGlobalOauthSettings xmlns="http://soap.sforce.com/2006/04/metadata">
<callbackUrl>https://www.example.com</callbackUrl>
<consumerKey>YOUR_EXTERNAL_CLIENT_APP_OAUTH_CONSUMER_KEY</consumerKey>
<consumerSecret>YOUR_EXTERNAL_CLIENT_APP_OAUTH_CONSUMER_SECRET</consumerSecret>
<externalClientApplication>myeca</externalClientApplication>
<idTokenConfig>
<idTokenAudience>SalesforceAudience</idTokenAudience>
<idTokenIncludeStandardClaims>true</idTokenIncludeStandardClaims>
<idTokenValidityInMinutes>0</idTokenValidityInMinutes>
</idTokenConfig>
<isClientCredentialEnabled>false</isClientCredentialEnabled>
<isConsumerSecretOptional>false</isConsumerSecretOptional>
<isIntrospectAllTokens>false</isIntrospectAllTokens>
<isSecretRequiredForRefreshToken>false</isSecretRequiredForRefreshToken>
<label>myecaglobalset</label>
<singleLogoutUrl>https://www.example.com</singleLogoutUrl>
</ExtlClntAppGlobalOauthSettings>查找 Oauth 链接字段
在外部客户端应用程序 OAuth 设置文件中,验证 oauthlink 字段现在是否拥有将组织 ID 与 OAuth 使用者 ID 组合的自动生成值。
<?xml version="1.0" encoding="UTF-8"?>
<ExtlClntAppOauthSettings xmlns="http://soap.sforce.com/2006/04/metadata">
<externalClientApplication>myeca</externalClientApplication>
<label>myecaset</label>
<trustedIpRanges>
<startIpAddress>10.55.2.0</startIpAddress>
<endIpAddress>10.55.2.255</endIpAddress>
<description>IP range A</description>
</trustedIpRanges>
<trustedIpRanges>
<startIpAddress>10.55.12.0</startIpAddress>
<endIpAddress>10.55.12.255</endIpAddress>
</trustedIpRanges>
<commaSeparatedOauthScopes>Basic, Web, RefreshToken</commaSeparatedOauthScopes>
<oauthLink>00Bxx0000006JuB:888xx0000004CQ4</oauthLink>
</ExtlClntAppOauthSettings>查找 OAuth 策略文件
部署外部客户端应用程序 OAuth 设置和全局 OAuth 设置文件更改时,外部客户端应用程序会在 oauthPolicies 文件夹中生成名为 [ECAPP_OAUTH_POLICY].ecaOauthPlcy-meta.xml 的 OAuth 策略文件。自动生成的文件包括这些值。
| 字段 | 描述 |
|---|---|
| 标签 | 此字段是必填字段。类型:字符串。默认值:SpecificLifetime.外部客户端应用程序 OAuth 策略的名称。 |
| refreshTokenPolicyType | 此字段是可选项。类型:字符串。值:Infinite、Zero、SpecificLifetime、SpecificInactivity |
| refreshTokenValidityPeriod | 此字段是可选项。类型:整型 |
| refreshTokenValidityUnit | 此字段是可选项。类型:字符串。值:Days、Hours、Months |
| ipRelaxationPolicyType | 此字段是可选项。类型:字符串。确定 IP 限制的策略。值:Enforce、Bypass、Bypass_2factor、Enforce_RelaxRefresh |
| PermittedUsersPolicyType | 此字段是可选项。类型:字符串。值:AllSelfAuthorized、AdminApprovedPreAuthorized |
| commaSeparatedPermissionSet | 此字段是可选项。类型:字符串。逗号分隔的权限集 ID。 |
| externalClientApplication | 此字段是必填字段。类型:字符串。外部客户端应用程序的名称。 |
| sessionTimeoutInMinutes | 此字段是可选项。类型:整数。外部客户端应用程序会话的持续时间 |
| requiredSessionLevel | 此字段是可选项。类型:值:LOW、STANDARD、HIGH_ASSURANCE |
| policyAction | 此字段是可选项。类型:字符串。值:Block、RaiseSessionLevel |
| singleLogoutUrl | 此字段是可选项。类型:字符串。用户注销 Salesforce 时 Salesforce 发送注销请求的 URL。 |
| startUrl | 此字段是可选项。类型:字符串。如果应用程序不是从移动设备访问的,用户在验证后会被定向到此 URL。 |
OAuth 设置和策略详细信息与连接的应用程序相似。此示例显示了 OAuth 策略文件。
<?xml version="1.0" encoding="UTF-8"?>
<ExtlClntAppOauthConfigurablePolicies xmlns="http://soap.sforce.com/2006/04/metadata">
<externalClientApplication>myeca</externalClientApplication>
<label>myecapolicy</label>
<refreshTokenPolicyType>SpecificLifetime</refreshTokenPolicyType>
<refreshTokenValidityPeriod>1</refreshTokenValidityPeriod>
<refreshTokenValidityUnit>Days</refreshTokenValidityUnit>
<ipRelaxationPolicyType>Enforce</ipRelaxationPolicyType>
<permittedUsersPolicyType>AdminApprovedPreAuthorized</permittedUsersPolicyType>
<commaSeparatedPermissionSet></commaSeparatedPermissionSet>
<sessionTimeoutInMinutes>1</sessionTimeoutInMinutes>
<requiredSessionLevel>HIGH_ASSURANCE</requiredSessionLevel>
<policyAction>RaiseSessionLevel</policyAction>
<singleLogoutUrl>https://www.example.com</singleLogoutUrl>
<startUrl>https://www.example.com</startUrl>
</ExtlClntAppOauthConfigurablePolicies>