Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
23CAB0F92DCBE51F00B8929B /* MockRestClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23CAB0F72DCBE51F00B8929B /* MockRestClient.swift */; };
23CAB1312DD515B500B8929B /* SFLoginViewController+Deep-Linking.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23CAB1302DD515B500B8929B /* SFLoginViewController+Deep-Linking.swift */; };
23CE44212DEE258800ADC770 /* RestClient+WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23CE44202DEE257900ADC770 /* RestClient+WebSocket.swift */; };
23D206052E578E5D000AF5E3 /* AuthInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23D206042E578E5D000AF5E3 /* AuthInfo.swift */; };
23D626992DF9DF2D00B898D0 /* URLSessionWebSocketTask+WebSocketClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23D626982DF9DF1E00B898D0 /* URLSessionWebSocketTask+WebSocketClient.swift */; };
23D96B6F2E145AC20004B06A /* DomainDiscoveryCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23D96B6E2E145AC20004B06A /* DomainDiscoveryCoordinator.swift */; };
23D96B762E145B400004B06A /* DomainDiscoveryCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23D96B752E145B400004B06A /* DomainDiscoveryCoordinatorTests.swift */; };
Expand Down Expand Up @@ -320,8 +321,6 @@
CE4CE3451C0E5252009F6029 /* SFOAuthCredentials+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F96FCC81BFD32130022F021 /* SFOAuthCredentials+Internal.h */; };
CE4CE3461C0E5252009F6029 /* SFOAuthCredentials.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F96FCC91BFD32130022F021 /* SFOAuthCredentials.h */; settings = {ATTRIBUTES = (Public, ); }; };
CE4CE3471C0E5252009F6029 /* SFOAuthCredentials.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F96FCCA1BFD32130022F021 /* SFOAuthCredentials.m */; };
CE4CE34A1C0E5252009F6029 /* SFOAuthInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F96FCCD1BFD32130022F021 /* SFOAuthInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
CE4CE34B1C0E5252009F6029 /* SFOAuthInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F96FCCE1BFD32130022F021 /* SFOAuthInfo.m */; };
CE4CE34C1C0E5252009F6029 /* SFOAuthKeychainCredentials.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F96FCCF1BFD32130022F021 /* SFOAuthKeychainCredentials.h */; };
CE4CE34D1C0E5252009F6029 /* SFOAuthKeychainCredentials.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F96FCD01BFD32130022F021 /* SFOAuthKeychainCredentials.m */; };
CE4CE34E1C0E5252009F6029 /* SFOAuthOrgAuthConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F96FCD11BFD32130022F021 /* SFOAuthOrgAuthConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -567,6 +566,7 @@
23CAB0F72DCBE51F00B8929B /* MockRestClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockRestClient.swift; sourceTree = "<group>"; };
23CAB1302DD515B500B8929B /* SFLoginViewController+Deep-Linking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "SFLoginViewController+Deep-Linking.swift"; path = "Login/SFLoginViewController+Deep-Linking.swift"; sourceTree = "<group>"; };
23CE44202DEE257900ADC770 /* RestClient+WebSocket.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RestClient+WebSocket.swift"; sourceTree = "<group>"; };
23D206042E578E5D000AF5E3 /* AuthInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthInfo.swift; sourceTree = "<group>"; };
23D626982DF9DF1E00B898D0 /* URLSessionWebSocketTask+WebSocketClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLSessionWebSocketTask+WebSocketClient.swift"; sourceTree = "<group>"; };
23D96B6E2E145AC20004B06A /* DomainDiscoveryCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DomainDiscoveryCoordinator.swift; sourceTree = "<group>"; };
23D96B752E145B400004B06A /* DomainDiscoveryCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DomainDiscoveryCoordinatorTests.swift; path = SalesforceSDKCoreTests/DomainDiscoveryCoordinatorTests.swift; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -639,8 +639,6 @@
4F96FCC81BFD32130022F021 /* SFOAuthCredentials+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SFOAuthCredentials+Internal.h"; sourceTree = "<group>"; };
4F96FCC91BFD32130022F021 /* SFOAuthCredentials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SFOAuthCredentials.h; sourceTree = "<group>"; };
4F96FCCA1BFD32130022F021 /* SFOAuthCredentials.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SFOAuthCredentials.m; sourceTree = "<group>"; };
4F96FCCD1BFD32130022F021 /* SFOAuthInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SFOAuthInfo.h; sourceTree = "<group>"; };
4F96FCCE1BFD32130022F021 /* SFOAuthInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SFOAuthInfo.m; sourceTree = "<group>"; };
4F96FCCF1BFD32130022F021 /* SFOAuthKeychainCredentials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SFOAuthKeychainCredentials.h; sourceTree = "<group>"; };
4F96FCD01BFD32130022F021 /* SFOAuthKeychainCredentials.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SFOAuthKeychainCredentials.m; sourceTree = "<group>"; };
4F96FCD11BFD32130022F021 /* SFOAuthOrgAuthConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SFOAuthOrgAuthConfiguration.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1207,6 +1205,7 @@
4F96FCC41BFD32130022F021 /* OAuth */ = {
isa = PBXGroup;
children = (
23D206042E578E5D000AF5E3 /* AuthInfo.swift */,
23D96B6E2E145AC20004B06A /* DomainDiscoveryCoordinator.swift */,
4F8A3B002CEC202F00ECDC76 /* JwtAccessToken.swift */,
4F96FCC61BFD32130022F021 /* SFOAuthCoordinator.h */,
Expand All @@ -1216,8 +1215,6 @@
4F96FCC91BFD32130022F021 /* SFOAuthCredentials.h */,
4F96FCCA1BFD32130022F021 /* SFOAuthCredentials.m */,
4F96FCC81BFD32130022F021 /* SFOAuthCredentials+Internal.h */,
4F96FCCD1BFD32130022F021 /* SFOAuthInfo.h */,
4F96FCCE1BFD32130022F021 /* SFOAuthInfo.m */,
4F96FCCF1BFD32130022F021 /* SFOAuthKeychainCredentials.h */,
4F96FCD01BFD32130022F021 /* SFOAuthKeychainCredentials.m */,
4F96FCD11BFD32130022F021 /* SFOAuthOrgAuthConfiguration.h */,
Expand Down Expand Up @@ -1919,7 +1916,6 @@
B711290F1F8A780800436CFB /* SFSDKAlertView.h in Headers */,
CE4CE32B1C0E523B009F6029 /* SalesforceSDKManager+Internal.h in Headers */,
6931E954248B5C7100417362 /* SFDirectoryManager+Internal.h in Headers */,
CE4CE34A1C0E5252009F6029 /* SFOAuthInfo.h in Headers */,
B72171522353BFD90022510F /* SFSDKAuthSession.h in Headers */,
CE4CE36A1C0E526A009F6029 /* SFDefaultUserManagementViewController.h in Headers */,
4F06AF7A1C49A16A00F70798 /* SalesforceSDKIdentityTests.h in Headers */,
Expand Down Expand Up @@ -2390,7 +2386,6 @@
A3C7475C29F7047400D72B7F /* ScreenLockManager.swift in Sources */,
B75233E01F4DF0B700040B6E /* SFSDKAuthPreferences.m in Sources */,
B767369320A4AB0200F04103 /* SFSDKNavigationController.m in Sources */,
CE4CE34B1C0E5252009F6029 /* SFOAuthInfo.m in Sources */,
69B36F492D30C34F00EFF84A /* ColorExtension.swift in Sources */,
23B2FDEC2DB03496006ADC07 /* NotificationCategoryFactory.swift in Sources */,
69EA56CC264B1FAA007FE339 /* SFSDKMacDetectUtil.m in Sources */,
Expand Down Expand Up @@ -2453,6 +2448,7 @@
B7677051223AE5E400545C90 /* SFUserAccountManager+Instrumentation.m in Sources */,
E1C80CF01C5AEE31001B3A21 /* SFSDKLoginHostListViewController.m in Sources */,
B773CCF81F8200BD00D2D1B2 /* SFSDKIDPLoginRequestCommand.m in Sources */,
23D206052E578E5D000AF5E3 /* AuthInfo.swift in Sources */,
CE4CE3931C0E526A009F6029 /* SFUserAccountIdentity.m in Sources */,
23945B712D78E4A60060B195 /* NotificationType.swift in Sources */,
D3B1519F2E1DA6EB00914EF1 /* AuthCoordinatorFrontdoorBridgeLoginOverride.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#import "SFSDKLoginFlowSelectionView.h"
#import "SFSDKLoginFlowSelectionViewController.h"
#import "SFSDKAuthRequest.h"
#import <SalesforceSDKCore/SalesforceSDKCore-Swift.h>

@implementation SFUserAccountManager (URLHandlers)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#import <Foundation/Foundation.h>
#import "SFIdentityCoordinator.h"
#import "SFSDKAuthSession.h"
#import "SFOAuthInfo.h"

@class SFIdentityData;
@class SFOAuthSessionRefresher;
NS_ASSUME_NONNULL_BEGIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#import "SFSDKResourceUtils.h"
#import "SFUserAccountManager+Internal.h"
#import "SFSDKLoginViewControllerConfig.h"
#import "SFOAuthInfo.h"
#import "SFSDKWindowManager.h"
#import "SFSDKNavigationController.h"
#import "SFSDKViewUtils.h"
Expand Down
104 changes: 104 additions & 0 deletions libs/SalesforceSDKCore/SalesforceSDKCore/Classes/OAuth/AuthInfo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//
// AuthInfo.swift
// SalesforceSDKCore
//
// Copyright (c) 2012-present, salesforce.com, inc. All rights reserved.
//
// Redistribution and use of this software in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice, this list of conditions
// and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this list of
// conditions and the following disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of salesforce.com, inc. nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission of salesforce.com, inc.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
// WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

import Foundation

@objc(SFOAuthType)
public enum AuthType: Int {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a breaking change because a case in Swift would currently be AuthInfo.AuthType.IDP vs AuthType.IDP, but maybe we could do it in 14.0 as in-place change instead of having a deprecation path since it's more of a straight forward rename?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that’s why we have the static constants below, from line 55 to 63. In Objective-C, they can still call SFOAuthTypeIDP. But yeah, not a 13.x change for sure.

case unknown = 0
case userAgent
case refresh
case advancedBrowser
case jwtTokenExchange
case IDP
case webServer
case native

public var description: String {
switch self {
case .userAgent: return "SFOAuthTypeUserAgent"
case .webServer: return "SFOAuthTypeWebServer"
case .refresh: return "SFOAuthTypeRefresh"
case .advancedBrowser: return "SFOAuthTypeAdvancedBrowser"
case .jwtTokenExchange: return "SFOAuthTypeJwtTokenExchange"
case .native: return "SFOAuthTypeNative"
case .IDP: return "SFOAuthTypeIDP"
case .unknown: fallthrough
@unknown default: return "SFOAuthTypeUnknown"
}
}

// Static constants for Objective-C bridging
public static let SFOAuthTypeUnknown = AuthType.unknown
public static let SFOAuthTypeUserAgent = AuthType.userAgent
public static let SFOAuthTypeRefresh = AuthType.refresh
public static let SFOAuthTypeAdvancedBrowser = AuthType.advancedBrowser
public static let SFOAuthTypeJwtTokenExchange = AuthType.jwtTokenExchange
public static let SFOAuthTypeIDP = AuthType.IDP
public static let SFOAuthTypeWebServer = AuthType.webServer
public static let SFOAuthTypeNative = AuthType.native
}

@objc(SFOAuthInfo)
@objcMembers
public class AuthInfo: NSObject {
public let authType: AuthType

public var authTypeDescription: String {
return authType.description
}

// Main Swift initializer
@objc(initWithAuthType:)
public init(authType: AuthType) {
self.authType = authType
super.init()
}

// Default initializer for Swift and Objective-C
@objc public override init() {
self.authType = .unknown
super.init()
}

// Objective-C class factory method
@objc(infoWithAuthType:)
public class func info(withAuthType authType: AuthType) -> AuthInfo {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the use case for this vs init at line 77? I got confused by the comments because I thought one was for Objective-C and one was for Swift but they look like they're both available for both languages

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your right. I think I tried to put this up before the weekend and missed a couple things. I'll clean this up again.

return AuthInfo(authType: authType)
}

// Expose the raw value for Objective-C
@objc public var authTypeRawValue: Int {
return authType.rawValue
}

// Expose the description for Objective-C
@objc public override var description: String {
return "<SFOAuthInfo: \(Unmanaged.passUnretained(self).toOpaque()), authType=\(authTypeDescription)>"
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#import <WebKit/WebKit.h>
#import "SFOAuthCredentials+Internal.h"
#import "SFOAuthCoordinator+Internal.h"
#import "SFOAuthInfo.h"
#import "SFSDKAuthConfigUtil.h"
#import "SFSDKCryptoUtils.h"
#import "NSData+SFSDKUtils.h"
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#import "SFOAuthSessionRefresher+Internal.h"
#import "SFUserAccountManager.h"
#import "SFOAuthCredentials+Internal.h"
#import "SFOAuthInfo.h"
#import "SFSDKOAuth2.h"

@interface SFOAuthSessionRefresher()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#import <SalesforceSDKCore/SFIdentityCoordinator.h>
#import <SalesforceSDKCore/SFOAuthCoordinator.h>
#import <SalesforceSDKCore/SFOAuthInfo.h>

NS_ASSUME_NONNULL_BEGIN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#include "SFOAuthInfo.h"

@class SFAuthErrorHandler;
@class SFAuthErrorHandlerList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#import <SalesforceSDKCore/SFFormatUtils.h>
#import <SalesforceSDKCore/SFSDKAlertMessageBuilder.h>
#import <SalesforceSDKCore/SFSDKSoslBuilder.h>
#import <SalesforceSDKCore/SFOAuthInfo.h>
#import <SalesforceSDKCore/SFSDKCollectionResponse.h>
#import <SalesforceSDKCore/NSData+SFAdditions.h>
#import <SalesforceSDKCore/SFSDKSalesforceAnalyticsManager.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

#import "SFOAuthTestFlowCoordinatorDelegate.h"
#import "SFOAuthInfo.h"

static NSString * const kWebNotSupportedExceptionName = @"com.salesforce.oauth.tests.WebNotSupported";
static NSString * const kWebNotSupportedReasonFormat = @"%@ WKWebView transactions not supported in unit test framework.";
Expand Down
Loading
Loading