AWSSAMLSignInProvider Class Reference
| Inherits from | NSObject |
|---|---|
| Conforms to | AWSSignInProvider |
| Declared in | AWSSAMLSignInProvider.h AWSSAMLSignInProvider.m |
Other Methods
– handleLoginWithTaskCompletionSource:
This method will be called when loginWithSignInProvider is invoked from AWSIdentityManager.
Developer is expected to call setResult on taskCompletionSource with the SAML login token on a successful login,
or setError when the login is cancelled or encounters an error.
- (void)handleLoginWithTaskCompletionSource:(AWSTaskCompletionSource<NSString*> *)taskCompletionSourceParameters
taskCompletionSource |
the |
|---|
Discussion
The token internally is stored in the keychain store, and a flag is set in NSUserDefaults indicating the user is logged in using this SAML sign-in provider.
Objective-C
- (void)handleLoginWithTaskCompletionSource:(AWSTaskCompletionSource
Swift
func handleLogicWithTaskCompletionSource(taskCompletionSource: AWSTaskCompletionSource
Declared In
AWSSAMLSignInProvider.h
– fetchLatestToken
This method is called whenver the cognito credentials are refreshed or when app is loaded from background state / closed state.
The previous saved token can be fetched using fetchStoredToken, and if it is valid the same can be returned without refreshing.
- (AWSTask<NSString*> *)fetchLatestTokenReturn Value
an instance of AWSTask. task.result should contain the valid token in case of successful token fetch, or task.error should be set
Declared In
AWSSAMLSignInProvider.h
– interceptApplication:didFinishLaunchingWithOptions:
Passes parameters used to launch the application to the current identity provider.
It can be used to complete the user sign-in call flow, which uses a browser to
get information from the user, directly. The current sign-in provider will be set to nil if
the sign-in provider is not registered using registerAWSSignInProvider:forKey method of
AWSSignInProviderFactory class.
- (BOOL)interceptApplication:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptionsParameters
application |
application |
|---|---|
launchOptions |
options used to launch the application |
Return Value
true if this call handled the operation
Declared In
AWSSAMLSignInProvider.h
– interceptApplication:openURL:sourceApplication:annotation:
Passes parameters used to launch the application to the current identity provider.
It can be used to complete the user sign-in call flow, which uses a browser to
get information from the user, directly. The developer should store a reference to
the taskCompletionSource instance provided by the handleLoginWithTaskCompletionSouce
method to set the result with successfully retrieved token.
- (BOOL)interceptApplication:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotationParameters
application |
application |
|---|---|
url |
url used to open the application |
sourceApplication |
source application |
annotation |
annotation |
Return Value
true if this call handled the operation
Declared In
AWSSAMLSignInProvider.h
– setUserName:
Sets the userName value of the signed-in user into a persistent store.
Should be called on a successful login to set the user name which is used by AWSIdentityManager.
- (void)setUserName:(NSString *)userNameParameters
userName |
the user name of the signed-in user |
|---|
Declared In
AWSSAMLSignInProvider.h
– setImageURL:
Sets the imageURL value of the signed-in user into a persistent store.
Should be called on a successful login to set the user name which is used by AWSIdentityManager.
- (void)setImageURL:(NSURL *)imageURLParameters
imageURL |
the image URL for a picture of the signed-in user |
|---|
Declared In
AWSSAMLSignInProvider.h
– setViewControllerForSignIn:
Can be used to store a reference of teh view controller from which loginWithSignInProvider is invoked by AWSIdentityManager
- (void)setViewControllerForSignIn:(UIViewController *)signInViewControllerParameters
signInViewController |
the signInViewController object whose reference needs to be stored |
|---|
Declared In
AWSSAMLSignInProvider.h
– getViewControllerForSignIn
This method returns the view controller whose reference was stored using setViewControllerForSignIn
- (UIViewController *)getViewControllerForSignInReturn Value
the stored view controller if set, else nil
Declared In
AWSSAMLSignInProvider.h
– fetchStoredToken
Returns the token stored in keychain as-is (without refreshing)
- (NSString *)fetchStoredTokenReturn Value
the token if available in keychain, else nil
Declared In
AWSSAMLSignInProvider.h
– isLoggedIn
Determines if the user is logged in based on the token available in keychain and if the login flag is set internally.
- (BOOL)isLoggedInReturn Value
YES if the user is logged in using SAML sign-in provider instance
Declared In
AWSSAMLSignInProvider.h
Other Methods
– reloadSession
The handler method for managing the session reload for the Sign-In Provider.
- (void)reloadSessionDeclared In
AWSSignInProvider.h
– setCachedLoginFlag
Call this method on a successful login. This method should store a flag in persistent storage which determines if the user has signed-in using this sign-in provider.
This method is called by AWSIdentityManager on interceptApplication:didFinishLaunchingWithOptions method to set the current sign-in provider.
- (void)setCachedLoginFlagDeclared In
AWSSignInProvider.h
– isCachedLoginFlagSet
Fetches the status of the cached login flag set using setCachedLoginFlag.
- (BOOL)isCachedLoginFlagSetReturn Value
YES if the setCachedLoginFlag is set.
Declared In
AWSSignInProvider.h
– clearCachedLoginFlag
Clears the cached login flag. This method should be called during logout to clear the stored flag.
- (void)clearCachedLoginFlagDeclared In
AWSSignInProvider.h
– login:
The login handler method for the Sign-In Provider. The completionHandler will bubble back errors to the developers.
- (void)login:(AWSIdentityManagerCompletionBlock)completionHandlerDeclared In
AWSSignInProvider.h
– logout
The logout handler method for the Sign-In Provider.
- (void)logoutDeclared In
AWSSignInProvider.h