Skip to content

Commit 7ca3101

Browse files
committed
Add welcome discovery flag instead of having hardcoded consumer keys
1 parent f8a40a6 commit 7ca3101

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Common/SalesforceSDKManager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ NS_SWIFT_NAME(SalesforceManager)
237237
*/
238238
@property (nonatomic, assign) BOOL useWebServerAuthentication;
239239

240+
/** Whether or not the app should use welcome discovery. This should only be enabled if the connected app is supported.
241+
*/
242+
@property (nonatomic, assign) BOOL useWelcomeDiscovery;
243+
240244
/** Whether hybrid authentication flow should be used. Defaults to YES.
241245
*/
242246
@property (nonatomic, assign) BOOL useHybridAuthentication;

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Common/SalesforceSDKManager.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ - (instancetype)init {
315315
self.useWebServerAuthentication = YES;
316316
self.blockSalesforceIntegrationUser = NO;
317317
self.useHybridAuthentication = YES;
318+
self.useWelcomeDiscovery = NO;
318319
[self setupServiceConfiguration];
319320
_snapshotViewControllers = [SFSDKSafeMutableDictionary new];
320321
_nativeLoginViewControllers = [SFSDKSafeMutableDictionary new];

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/OAuth/DomainDiscoveryCoordinator.swift

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ enum DomainDiscovery: String {
1515
case callbackURL = "callback_url"
1616
}
1717
}
18-
19-
/* TODO: Keep this list of client ids up to date with those
20-
* supported by Salesforce Welcome Discovery or remove it
21-
* when no longer required.
22-
*/
23-
static let supportedClientIds: Set<String> = [
24-
"SfdcMobileChatterAndroid",
25-
"SfdcMobileChatteriOS"
26-
]
2718
}
2819

2920
/// Represents the result of a domain discovery operation.
@@ -88,13 +79,13 @@ public class DomainDiscoveryCoordinator: NSObject {
8879

8980
@objc
9081
public func isDiscoveryDomain(_ domain: String?, clientId: String?) -> Bool {
91-
guard let domain = domain, let clientId = clientId else { return false }
82+
guard let domain = domain else { return false }
9283
let isDiscovery = domain.lowercased().contains(DomainDiscovery.URLComponent.path.rawValue)
93-
let isSupportedClient = DomainDiscovery.supportedClientIds.contains(clientId)
94-
if isDiscovery && !isSupportedClient {
95-
SFSDKCoreLogger.e(classForCoder, message: "\(domain) is a discovery domain, but client ID '\(clientId)' is not supported.")
84+
let discoveryEnabled = SalesforceManager.shared.useWelcomeDiscovery
85+
if isDiscovery && !discoveryEnabled {
86+
SFSDKCoreLogger.w(classForCoder, message: "\(domain) is a discovery domain, but welcome discovery isn't enabled.")
9687
}
97-
return isDiscovery && isSupportedClient
88+
return isDiscovery && discoveryEnabled
9889
}
9990
}
10091

0 commit comments

Comments
 (0)