Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Add option for user to select browser type to use for browser based authentication #265

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7430418
Merge pull request #122 from CAAPIM/Stable
BobbyWeber Dec 14, 2017
553eb10
Merge branch 'Stable'
BobbyWeber Dec 21, 2017
00dbbef
Merge branch 'Stable'
BobbyWeber Mar 2, 2018
c14b271
Merge branch 'Stable'
BobbyWeber Jun 13, 2018
75d6c76
Merge branch 'Stable'
BobbyWeber Jul 11, 2018
ef25850
Merge branch 'Stable'
BobbyWeber Aug 27, 2018
90fb3f4
Merge branch 'Stable'
BobbyWeber Dec 7, 2018
65706bf
Merge branch 'Stable'
BobbyWeber Feb 19, 2019
7fc8754
Merge branch 'Stable'
BobbyWeber Feb 19, 2019
9ab0730
iOS13 Changes for ASN.1 decoding null pointer bit string issue
ysd24 Sep 3, 2019
e43509b
Removing Mac Catalyst Support for Final build
BobbyWeber Sep 13, 2019
f93934b
Removing Mac Catalyst Support for Final Build
BobbyWeber Sep 13, 2019
31c4231
Fixing test targets for iOS 13
BobbyWeber Sep 17, 2019
8682e50
Updated changelog for 1.9.20
ysd24 Sep 18, 2019
bc1d6b2
Merge pull request #224 from CAAPIM/iOS-13-Master
manutripathi82 Sep 18, 2019
374c7b3
Merge branch 'develop' into merge-develop
Oct 3, 2019
cecb20d
Merge pull request #232 from CAAPIM/merge-develop
manutripathi82 Oct 3, 2019
bdc0bad
Merge pull request #250 from CAAPIM/develop
manutripathi82 Mar 12, 2020
1e6d309
Added the option for a user to configure what browser they want to us…
Dec 8, 2020
6423696
Fixed indentation
Dec 8, 2020
9428327
Remove unneeded edits to the project file
Dec 8, 2020
ef20369
Remove workspace checks
Dec 8, 2020
a2374bc
Remove more unneeded edits
Dec 8, 2020
33158cf
Add some more whitespaces to adhere to coding guidelines
Dec 8, 2020
6a2da19
Added pragma marks, and utility log statements
Dec 8, 2020
7ee1716
Change __block to __weak to prevent possible retain cycles
Dec 8, 2020
b492e32
Missed 1 weakSelf
Dec 8, 2020
7c48c43
Added option to provide the callack url scheme when choosing to use w…
Dec 22, 2020
4e6029d
Removed the need to provide a url scheme when using the Web session b…
Feb 1, 2021
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
34 changes: 31 additions & 3 deletions MASFoundation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@
A898EF682182D35700CF291B /* MASJWKSet.m in Sources */ = {isa = PBXBuildFile; fileRef = A898EF662182D35700CF291B /* MASJWKSet.m */; };
A898EF6B2182D3DF00CF291B /* NSURLSession+MASPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A898EF692182D3DF00CF291B /* NSURLSession+MASPrivate.h */; };
A898EF6C2182D3DF00CF291B /* NSURLSession+MASPrivate.m in Sources */ = {isa = PBXBuildFile; fileRef = A898EF6A2182D3DF00CF291B /* NSURLSession+MASPrivate.m */; };
C81CC3CC1FC2EA190058718E /* MASBrowserBasedAuthentication.h in Headers */ = {isa = PBXBuildFile; fileRef = C81CC3CA1FC2EA190058718E /* MASBrowserBasedAuthentication.h */; };
C81CC3CD1FC2EA190058718E /* MASBrowserBasedAuthentication.m in Sources */ = {isa = PBXBuildFile; fileRef = C81CC3CB1FC2EA190058718E /* MASBrowserBasedAuthentication.m */; };
C81CC3CC1FC2EA190058718E /* MASBrowserBasedAuthentication.h in Headers */ = {isa = PBXBuildFile; fileRef = C81CC3CA1FC2EA190058718E /* MASBrowserBasedAuthentication.h */; settings = {ATTRIBUTES = (Public, ); }; };
C81CC3D01FC2EFBB0058718E /* UIAlertController+MAS.h in Headers */ = {isa = PBXBuildFile; fileRef = C81CC3CE1FC2EFBB0058718E /* UIAlertController+MAS.h */; };
C81CC3D11FC2EFBB0058718E /* UIAlertController+MAS.m in Sources */ = {isa = PBXBuildFile; fileRef = C81CC3CF1FC2EFBB0058718E /* UIAlertController+MAS.m */; };
C858D6B52398FC5400963763 /* MASDataTask+MASPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = C858D6B32398FC5400963763 /* MASDataTask+MASPrivate.h */; };
Expand Down Expand Up @@ -327,6 +326,14 @@
CBD25B151E7A0A9200DFB47F /* MF_Base64Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = CBD25B131E7A0A9200DFB47F /* MF_Base64Additions.m */; };
CBFA70F41F1ED5D6006D025D /* MASSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = CBFA70F21F1ED5D6006D025D /* MASSecurityPolicy.h */; };
CBFA70F51F1ED5D6006D025D /* MASSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = CBFA70F31F1ED5D6006D025D /* MASSecurityPolicy.m */; };
E0BA784D257E7FEF0003A9B8 /* MASSafariBrowserBasedAuthentication.m in Sources */ = {isa = PBXBuildFile; fileRef = E0BA784B257E7FEF0003A9B8 /* MASSafariBrowserBasedAuthentication.m */; };
E0BA7861257EB8C00003A9B8 /* MASWebSessionBrowserBasedAuthentication.m in Sources */ = {isa = PBXBuildFile; fileRef = E0BA785F257EB8C00003A9B8 /* MASWebSessionBrowserBasedAuthentication.m */; };
E0BA7867257F62570003A9B8 /* MASSafariBrowserBasedAuthentication.h in Headers */ = {isa = PBXBuildFile; fileRef = E0BA784A257E7FEF0003A9B8 /* MASSafariBrowserBasedAuthentication.h */; };
E0BA7869257F62590003A9B8 /* MASWebSessionBrowserBasedAuthentication.h in Headers */ = {isa = PBXBuildFile; fileRef = E0BA785E257EB8C00003A9B8 /* MASWebSessionBrowserBasedAuthentication.h */; };
E0BA786D257F62820003A9B8 /* MASBrowserBasedAuthenticationInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = E0BA7849257E7FA60003A9B8 /* MASBrowserBasedAuthenticationInterface.h */; };
E0BA7877257F708A0003A9B8 /* MASBrowserBasedAuthentication.m in Sources */ = {isa = PBXBuildFile; fileRef = C81CC3CB1FC2EA190058718E /* MASBrowserBasedAuthentication.m */; };
E0BA788A257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = E0BA7888257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.h */; };
E0BA788B257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = E0BA7889257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.m */; };
E3662A3723DEE503007A76A1 /* MASIHTTPRequestOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = E3662A3523DEE502007A76A1 /* MASIHTTPRequestOperation.h */; };
E3662A3823DEE503007A76A1 /* MASIHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = E3662A3623DEE502007A76A1 /* MASIHTTPRequestOperation.m */; };
E3662A3B23DEE52C007A76A1 /* MASIURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = E3662A3923DEE52B007A76A1 /* MASIURLResponseSerialization.m */; };
Expand Down Expand Up @@ -687,6 +694,13 @@
CBD25B131E7A0A9200DFB47F /* MF_Base64Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MF_Base64Additions.m; sourceTree = "<group>"; };
CBFA70F21F1ED5D6006D025D /* MASSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASSecurityPolicy.h; sourceTree = "<group>"; };
CBFA70F31F1ED5D6006D025D /* MASSecurityPolicy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASSecurityPolicy.m; sourceTree = "<group>"; };
E0BA7849257E7FA60003A9B8 /* MASBrowserBasedAuthenticationInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MASBrowserBasedAuthenticationInterface.h; sourceTree = "<group>"; };
E0BA784A257E7FEF0003A9B8 /* MASSafariBrowserBasedAuthentication.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MASSafariBrowserBasedAuthentication.h; sourceTree = "<group>"; };
E0BA784B257E7FEF0003A9B8 /* MASSafariBrowserBasedAuthentication.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MASSafariBrowserBasedAuthentication.m; sourceTree = "<group>"; };
E0BA785E257EB8C00003A9B8 /* MASWebSessionBrowserBasedAuthentication.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MASWebSessionBrowserBasedAuthentication.h; sourceTree = "<group>"; };
E0BA785F257EB8C00003A9B8 /* MASWebSessionBrowserBasedAuthentication.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MASWebSessionBrowserBasedAuthentication.m; sourceTree = "<group>"; };
E0BA7888257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MASBrowserBasedAuthenticationFactory.h; sourceTree = "<group>"; };
E0BA7889257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MASBrowserBasedAuthenticationFactory.m; sourceTree = "<group>"; };
E3662A3523DEE502007A76A1 /* MASIHTTPRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASIHTTPRequestOperation.h; sourceTree = "<group>"; };
E3662A3623DEE502007A76A1 /* MASIHTTPRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASIHTTPRequestOperation.m; sourceTree = "<group>"; };
E3662A3923DEE52B007A76A1 /* MASIURLResponseSerialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASIURLResponseSerialization.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1122,6 +1136,13 @@
A898EF662182D35700CF291B /* MASJWKSet.m */,
CBA3EB301E94634C00E64D9D /* MASClaims+MASPrivate.h */,
CBA3EB311E94634C00E64D9D /* MASClaims+MASPrivate.m */,
E0BA7849257E7FA60003A9B8 /* MASBrowserBasedAuthenticationInterface.h */,
E0BA784A257E7FEF0003A9B8 /* MASSafariBrowserBasedAuthentication.h */,
E0BA784B257E7FEF0003A9B8 /* MASSafariBrowserBasedAuthentication.m */,
E0BA785E257EB8C00003A9B8 /* MASWebSessionBrowserBasedAuthentication.h */,
E0BA785F257EB8C00003A9B8 /* MASWebSessionBrowserBasedAuthentication.m */,
E0BA7888257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.h */,
E0BA7889257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.m */,
);
path = models;
sourceTree = "<group>";
Expand Down Expand Up @@ -1493,15 +1514,18 @@
CB9B1207210949D5008A2075 /* NSMutableData+MASASN1Helper.h in Headers */,
CBA3EB2E1E945F2400E64D9D /* MASClaims.h in Headers */,
CB0B58591E258C2A00BC0163 /* MASAuthorizationResponse.h in Headers */,
E0BA786D257F62820003A9B8 /* MASBrowserBasedAuthenticationInterface.h in Headers */,
CBA3EB321E94634C00E64D9D /* MASClaims+MASPrivate.h in Headers */,
CBD25AFF1E78C47C00DFB47F /* JWTClaimsSetVerifier.h in Headers */,
CBD25AF21E78C47C00DFB47F /* JWTRSAlgorithm.h in Headers */,
CB6491F01FE9DAF300281288 /* MQTTPersistence.h in Headers */,
10E027A11F72B10100EAB103 /* RNCryptor+Private.h in Headers */,
CBD25B0C1E78C47C00DFB47F /* JWTBase64Coder.h in Headers */,
E0BA788A257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.h in Headers */,
A419B3A11C176259008DC88C /* NSData+MAS.h in Headers */,
A488CE751C0B97FD00B8B961 /* MASService.h in Headers */,
CB6491FB1FE9DAF300281288 /* MQTTSSLSecurityPolicy.h in Headers */,
E0BA7867257F62570003A9B8 /* MASSafariBrowserBasedAuthentication.h in Headers */,
CBD25B0B1E78C47C00DFB47F /* JWT.h in Headers */,
CBD25B091E78C47C00DFB47F /* JWTCoding.h in Headers */,
CB6491F71FE9DAF300281288 /* MQTTSessionManager.h in Headers */,
Expand All @@ -1523,6 +1547,7 @@
A4E340F91B9E9F2000883AD3 /* MAS.h in Headers */,
E3662A4223DEE5A4007A76A1 /* MASINetworking.h in Headers */,
CBD25AF31E78C47C00DFB47F /* JWTCryptoKey.h in Headers */,
E0BA7869257F62590003A9B8 /* MASWebSessionBrowserBasedAuthentication.h in Headers */,
CB6492031FE9DAF300281288 /* MQTTStrict.h in Headers */,
A4831AFD1BD1A917007B4AE6 /* MASUser+MASPrivate.h in Headers */,
CBD25AEC1E78C47C00DFB47F /* JWTAlgorithmDataHolderChain.h in Headers */,
Expand Down Expand Up @@ -1782,12 +1807,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E0BA788B257F78820003A9B8 /* MASBrowserBasedAuthenticationFactory.m in Sources */,
CB5E4C711C1D250D001B3B8A /* MASPutURLRequest.m in Sources */,
CB2A4056209B9DA600F988AA /* MASMultiFactorHandler+MASPrivate.m in Sources */,
A858C6661D0978A6001FB9AD /* MASOTPService.m in Sources */,
CBD25AE71E78C47C00DFB47F /* JWTAlgorithmNone.m in Sources */,
CB1C151F1E450109002B31A5 /* NSURL+MASPrivate.m in Sources */,
10D2D49F1C1686ED00DF8AC4 /* MASGroup+MASPrivate.m in Sources */,
E0BA7877257F708A0003A9B8 /* MASBrowserBasedAuthentication.m in Sources */,
CB99754F1EDF5837006CEBB1 /* MASAuthCredentialsAuthorizationCode.m in Sources */,
A488CE761C0B97FD00B8B961 /* MASService.m in Sources */,
A42A86A11BBDA27F00AE98AC /* NSError+MASPrivate.m in Sources */,
Expand All @@ -1799,6 +1826,7 @@
CB2357971F0EFDEA00D4C420 /* MASSessionTaskOperation.m in Sources */,
CB6491E91FE9DAF300281288 /* MQTTDecoder.m in Sources */,
CB64920A1FE9DAF300281288 /* ReconnectTimer.m in Sources */,
E0BA784D257E7FEF0003A9B8 /* MASSafariBrowserBasedAuthentication.m in Sources */,
10E027A01F72B10100EAB103 /* RNCryptor.m in Sources */,
CBAFD24D1F2BD46C0034DF02 /* MASSecurityConfiguration.m in Sources */,
CB6491E11FE9DAF300281288 /* MQTTCFSocketEncoder.m in Sources */,
Expand Down Expand Up @@ -1826,6 +1854,7 @@
10E027A71F72B10100EAB103 /* RNEncryptor.m in Sources */,
699570E72062FF1300017244 /* MASError.m in Sources */,
CB9975571EDF5986006CEBB1 /* MASAuthCredentialsClientCredentials.m in Sources */,
E0BA7861257EB8C00003A9B8 /* MASWebSessionBrowserBasedAuthentication.m in Sources */,
5BD3E7E420630FC900A151C7 /* MASConstants.m in Sources */,
A47332D01BBC61F50002A492 /* NSData+MASPrivate.m in Sources */,
CBAFD2511F2BD48B0034DF02 /* MASSecurityConfiguration+MASPrivate.m in Sources */,
Expand Down Expand Up @@ -1877,7 +1906,6 @@
CBD25AF61E78C47C00DFB47F /* JWTCryptoKeyExtractor.m in Sources */,
A4150E701BF1643900037E27 /* MASIJSONResponseSerializer+MASPrivate.m in Sources */,
A417BA521BF033C300EC9BCB /* CLLocation+MASPrivate.m in Sources */,
C81CC3CD1FC2EA190058718E /* MASBrowserBasedAuthentication.m in Sources */,
69B7DF6D1F96756B0056DD3A /* MASRequest+MASPrivate.m in Sources */,
A4831AB21BD1A551007B4AE6 /* MASFile.m in Sources */,
CB0B585A1E258C2A00BC0163 /* MASAuthorizationResponse.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1059D36F1B61AA3700223267"
BuildableName = "MASFoundation.framework"
BlueprintName = "MASFoundation"
ReferencedContainer = "container:MASFoundation.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -53,17 +62,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1059D36F1B61AA3700223267"
BuildableName = "MASFoundation.framework"
BlueprintName = "MASFoundation"
ReferencedContainer = "container:MASFoundation.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -84,8 +82,6 @@
ReferencedContainer = "container:MASFoundation.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -51,8 +49,6 @@
ReferencedContainer = "container:MASFoundation.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
8 changes: 8 additions & 0 deletions MASFoundation/Classes/MAS.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@
+ (void)enableBrowserBasedAuthentication:(BOOL)enable;


/**
* Sets the type of browser to use for Browser Based Authentication (templatized login).
* By default this is `MASBrowserBasedAuthenticationBrowserTypeSafari`.

@param browserType MASBrowserBasedAuthenticationBrowserType object indicating the browser type used for browser based authentication.
*/
+ (void)setBrowserBasedAuthenticationBrowserType:(MASBrowserBasedAuthenticationBrowserType)browserType;


/**
* Returns current MASState enumeration value. The value can be used to determine which state SDK is currently at.
Expand Down
6 changes: 6 additions & 0 deletions MASFoundation/Classes/MAS.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ + (void)enableBrowserBasedAuthentication:(BOOL)enable
}


+ (void)setBrowserBasedAuthenticationBrowserType:(MASBrowserBasedAuthenticationBrowserType)browserType
{
[MASModelService setBrowserBasedAuthenticationBrowserType:browserType];
}


+ (void)setKeychainSynchronizable:(BOOL)enabled
{
[MASAccessService setKeychainSynchronizable:enabled];
Expand Down
19 changes: 18 additions & 1 deletion MASFoundation/Classes/MASConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,23 @@ typedef NS_ENUM(NSInteger, MASGrantFlow)
};


/**
* The enumerated MASBrowserBasedAuthenticationBrowserType.
*/
typedef NS_ENUM(NSInteger, MASBrowserBasedAuthenticationBrowserType)
{
/**
* Type used to launch browser based authentication in a `SafariViewController`
*/
MASBrowserBasedAuthenticationBrowserTypeSafari,

/**
* Type used to launch browser based authentication in a `ASWebAuthenticationSession`
*/
MASBrowserBasedAuthenticationBrowserTypeWebSession API_AVAILABLE(ios(12.0), macCatalyst(13.0), macos(10.15), watchos(6.2)),
};


/**
* The enumerated MASRequestResponseTypes that can indicate what data format is expected
* in a request or a response.
Expand Down Expand Up @@ -273,7 +290,7 @@ typedef NS_ENUM(NSInteger, MASRequestResponseType)
* The enumerated MASState that can indicate what state of SDK currently is at.
*/
typedef NS_ENUM(NSInteger, MASState) {

/**
* State that SDK has not been initialized and does not have configuration file
* either in local file system based on the default configuration file name, nor in the keychain storage.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// MASTypedBrowserBasedAuthenticationFactory.h
// MASFoundation
//
// Copyright (c) 2020 CA. All rights reserved.
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//

#import <Foundation/Foundation.h>
#import "MASConstants.h"

@protocol MASBrowserBasedAuthenticationInterface;

/**
* Utility factory class to build the correct browser type to use
*/
@interface MASBrowserBasedAuthenticationFactory : NSObject

/**
* Build a new browser used for Browser Based Authentication
*
* @param browserType MASBrowserBasedAuthenticationBrowserType object used to indicate type of browser built
* @return id<MASTypedBrowserBasedAuthenticationInterface> object which can be used to start Browser Based Authentication.
*/
+ (id<MASBrowserBasedAuthenticationInterface>)buildBrowserOfBrowserType:(MASBrowserBasedAuthenticationBrowserType)browserType;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// MASBrowserBasedAuthenticationFactory.m
// MASFoundation
//
// Copyright (c) 2020 CA. All rights reserved.
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//

#import "MASBrowserBasedAuthenticationFactory.h"
#import "MASSafariBrowserBasedAuthentication.h"
#import "MASWebSessionBrowserBasedAuthentication.h"

@implementation MASBrowserBasedAuthenticationFactory

+ (id<MASBrowserBasedAuthenticationInterface>)buildBrowserOfBrowserType:(MASBrowserBasedAuthenticationBrowserType)browserType {

switch (browserType) {
case MASBrowserBasedAuthenticationBrowserTypeSafari:
return [[MASSafariBrowserBasedAuthentication alloc] init];
case MASBrowserBasedAuthenticationBrowserTypeWebSession:
return [[MASWebSessionBrowserBasedAuthentication alloc] init];
}
}
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// MASBrowserBasedAuthenticationInterface.h
// MASFoundation
//
// Copyright (c) 2020 CA. All rights reserved.
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
#import "MASConstants.h"

/**
* Interface used to abstract different type of browsers used for Browser Based Authentication
*/
@protocol MASBrowserBasedAuthenticationInterface <NSObject>

/**
Starts the Browser based authentication with the given url and completion block.

@param templatizedURL NSURL sent to the browser
@param completion MASAuthCredentialsBlock object.
*/
- (void)startWithURL:(NSURL *)templatizedURL completion:(MASAuthCredentialsBlock)webLoginBlock;


/**
Dismisses the currently presented browser.
*/
- (void)dismiss;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// MASSafariBrowserBasedAuthentication.h
// MASFoundation
//
// Copyright (c) 2020 CA. All rights reserved.
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//

#import <Foundation/Foundation.h>

@protocol MASBrowserBasedAuthenticationInterface;

/**
* A Browser Based Authentication type utilising an SFSafarViewController
*/
@interface MASSafariBrowserBasedAuthentication : NSObject <MASBrowserBasedAuthenticationInterface>

@end
Loading