Configuring an iOS App as an Identity Provider Client
You can configure any app built on Mobile SDK 11.0 or later as an identity provider client. You configure it to identify itself as an identity provider client and to specify its identity provider. Mobile SDK does the rest.
In the init() method of your AppDelegate class, specify the URI scheme for the identity provider you’re using:
Your app is now ready for use as an identity provider client.
(Optional) Configure Your IDP Client App to Use Keychain
After you set up your IDP app to initiate authentication, update the client to complete the flow. You can use these methods to handle the incoming IDP URL.
(Optional) Customizing the Login Flow Selection View in the Client App
Mobile SDK provides template apps for both identity providers and their client apps. The client template defines a view that lets the user choose to log in through an identity provider or the Salesforce login screen. When a user opens an app built from the client template, the app presents this view if
the user hasn’t yet logged in, or
the current user hasn’t been set.
To customize the login style selection view, a client app extends the UIViewController class and also must implement the SFSDKLoginFlowSelectionView protocol.
1@protocol SFSDKLoginFlowSelectionViewDelegate<NSObject>2/**3 * Used to notify the SDK of user selection on the login flow selection view4 * @param controller instance invoking this delegate5 * @param appOptions addl. name value pairs sent from the sdk for6 * the SFSDKLoginFlowSelectionView7 */8-(void)loginFlowSelectionIDPSelected:(UIViewController *)controller9 options:(NSDictionary *)appOptions;1011/**12 * Used to notify the SDK of user selection on the login flow selection view13 * @param controller instance invoking this delegate14 * @param appOptions addl. name value pairs sent from the sdk for15 * the SFSDKLoginFlowSelectionView16 */17-(void)loginFlowSelectionLocalLoginSelected:(UIViewController *)controller18 options:(NSDictionary *)appOptions;1920@end
1@protocol SFSDKLoginFlowSelectionView<NSObject>2 @property(weak,nonatomic) id <SFSDKLoginFlowSelectionViewDelegate>selectionFlowDelegate;3 @property(nonatomic,strong) NSDictionary *appOptions;4@end
During the client app’s identity provider flow, Mobile SDK sets up an instance of the selectionFlowDelegate and appOptions properties defined in this protocol. You use these artifacts in your view controller to notify Mobile SDK of the user’s login method selection. For example, assume that you’ve implemented the SFSDKUserSelectionView protocol in a UIViewController class named IDPLoginNavViewController. You then can use that view controller as the user selection dialog box by setting the idpLoginFlowSelectionAction on the SalesforceSDKManager shared instance, as follows: