Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webview interaction and system webview #126

Merged
merged 60 commits into from
Jun 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
5f61177
add some more definitions. subject to change.
unpluggedk Apr 21, 2018
e905d25
updating msidwebviewauthorization to have start instead of init
unpluggedk Apr 23, 2018
ba71b3d
initial implementation of webview interactive session.
unpluggedk Apr 26, 2018
fc1d8db
updating system webview controller in handling response
unpluggedk Apr 28, 2018
f29dcb3
bring in pkce and make changes to how system webviews work
unpluggedk Apr 28, 2018
c669afe
add urlQueryItemsArray in NSDictionary extension
unpluggedk Apr 28, 2018
d8813b5
address comments
unpluggedk Apr 29, 2018
c8c826f
more of addresssing comments
unpluggedk Apr 29, 2018
4dd6ec6
refactor web auth response logic
unpluggedk Apr 29, 2018
d987e60
refactor response creation
unpluggedk Apr 30, 2018
8c99592
update project settings
unpluggedk Apr 30, 2018
d99bc6f
system webview flow functionally 'in place'
unpluggedk May 2, 2018
10aae32
preprocessors for mac vs iphone targets in system webview
unpluggedk May 2, 2018
0e34d81
type fix: msal prefix to msid prefix
unpluggedk May 2, 2018
9e7fb0b
readdress header imports
unpluggedk May 2, 2018
0bd3d7f
refactoring
unpluggedk May 4, 2018
7b5255b
revise sha256 method - incorrect implementation in adal perhaps?
unpluggedk May 4, 2018
69e15a1
update oauth error handling, for now a hack to get suberror from
unpluggedk May 4, 2018
fbbb81e
revise synchronized handling for session, and add clearing of the
unpluggedk May 8, 2018
c5675ec
fix tests
unpluggedk May 9, 2018
f1207ee
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
unpluggedk May 9, 2018
d58eed6
replace idtoken string parameter into uid/utid
unpluggedk May 9, 2018
6f737f0
update project files and some to make mac test build work
unpluggedk May 9, 2018
b2c9929
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
unpluggedk May 9, 2018
0dc3a61
remove preprocessor and replace with @available(...)
unpluggedk May 10, 2018
243fb01
SafariViewController flow in place.
unpluggedk May 11, 2018
9ea3817
fix typo
unpluggedk May 11, 2018
a4d2286
remove unneeded test variables
unpluggedk May 11, 2018
459dc3a
fix mac errors - exclude uikit files
unpluggedk May 14, 2018
a234566
add unit testing for web responses + bug fixes
unpluggedk May 17, 2018
a4eacd1
adding more testing for MSIDWebviewAuthorization and bug fixing
unpluggedk May 17, 2018
af44efc
revise web authorization flow - with bug fixes
unpluggedk May 18, 2018
36b3ef2
add test stubs and few comments
unpluggedk May 18, 2018
517a114
more unit testing and minor fixes
unpluggedk May 18, 2018
a5d230e
fix mac tests
unpluggedk May 18, 2018
5ed28e3
add telemetry
unpluggedk May 22, 2018
2b8b756
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
unpluggedk May 22, 2018
1230844
address comments
unpluggedk May 22, 2018
dda26c7
remove replaced file
unpluggedk May 22, 2018
375e1d4
Merge remote-tracking branch 'origin/dev' into jak/system_webview
unpluggedk May 22, 2018
f54800a
update unit testeing on WPJ response
unpluggedk May 22, 2018
ec90fb5
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
unpluggedk May 22, 2018
b31e99f
checkpoint: update flow as discussed
unpluggedk May 24, 2018
8718d82
Merge branch 'oldalton/msal_updates_to_cache' of https://github.com/A…
unpluggedk May 24, 2018
a9cff24
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
unpluggedk May 24, 2018
1ea816d
update the flow - revise how request state is being passed around
unpluggedk May 25, 2018
7b8979c
refactor for improvements. unit tests need to be fixed.
unpluggedk May 25, 2018
7d9ed31
minor bug fix - saferi viewcontroller reset upon completion
unpluggedk May 25, 2018
58b7c6a
adding unit testing after changes and some minor fixes
unpluggedk May 26, 2018
dad2296
move testcacheIdentifiers to testIdentifiers.
unpluggedk May 28, 2018
9801600
revise start of web interactive session to return void than BOOL
unpluggedk May 30, 2018
9d505c8
update mock webview controller
unpluggedk May 31, 2018
97ddaa1
state verification to have a terminating conditional
unpluggedk Jun 1, 2018
9ec3d45
fix returning error at start webview
unpluggedk Jun 1, 2018
804186a
separate webview factory and revised response handling
unpluggedk Jun 6, 2018
17834c5
add unit testing and minor fixes
unpluggedk Jun 7, 2018
e5da20a
- MSIDWebviewConfiguration no longer inherits from MSIDConfiguration.
unpluggedk Jun 8, 2018
865eff9
address rest of the comments
unpluggedk Jun 11, 2018
185db0d
addressing feedback: remove stateVerifier flag for places unnecessary,
unpluggedk Jun 14, 2018
6183514
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
unpluggedk Jun 15, 2018
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
289 changes: 254 additions & 35 deletions IdentityCore/IdentityCore.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
44 changes: 43 additions & 1 deletion IdentityCore/src/MSIDError.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,53 @@ typedef NS_ENUM(NSInteger, MSIDErrorCode)
MSIDErrorInvalidRequest = -51014,
MSIDErrorInvalidClient = -51015,
MSIDErrorInvalidGrant = -51016,
MSIDErrorInvalidParameter = -51017,
MSIDErrorInvalidScope = -51017,
MSIDErrorInvalidParameter = -51018,

/*!
The user or application failed to authenticate in the interactive flow.
Inspect MSALOAuthErrorKey and MSALErrorDescriptionKey in the userInfo
dictionary for more detailed information about the specific error.
*/
MSIDErrorAuthorizationFailed = -52020,

/*!
The state returned by the server does not match the state that was sent to
the server at the beginning of the authorization attempt.
*/
MSIDErrorInvalidState = -52501,
/*!
Interaction required errors occur because of a wide variety of errors
returned by the authentication service.
*/
MSIDErrorMismatchedUser = -52101,
Copy link
Member

Choose a reason for hiding this comment

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

just curious, when is this error returned?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When parameter sets a user, and we force webview to login as a different user.
We handled it as an error in MSAL, we can discuss about this.

Copy link
Member

Choose a reason for hiding this comment

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

nit: can we put errors in increasing order? (MSIDErrorInvalidState is in the middle)

MSIDErrorNoAuthorizationResponse = -52102,
Copy link
Member

Choose a reason for hiding this comment

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

nit: no authorization code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, it's just url nil response.

MSIDErrorBadAuthorizationResponse = -52103,


MSIDErrorUserCancel = -51019,
/*!
The authentication request was cancelled programmatically.
*/
MSIDErrorSessionCanceled = -51020,
/*!
An interactive authentication session is already running with the
SafariViewController visible. Another authentication session can not be
launched yet.
*/
MSIDErrorInteractiveSessionAlreadyRunning = -51021,
/*!
An interactive authentication session failed to start.
*/
MSIDErrorInteractiveSessionStartFailure = -51022,
Copy link
Member

Choose a reason for hiding this comment

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

what is the case when this would happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SFAuthenticationSession: when start is called on a cancelled session
SafariViewController, when we can't find the current viewcontroller to present from.


MSIDErrorUnsupportedFunctionality = -51018,

Copy link
Member

Choose a reason for hiding this comment

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

both MSIDErrorInvalidParameter = -51018, and MSIDErrorUnsupportedFunctionality = -51018 are -51018?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's address errors in a separate PR

MSIDErrorCodeFirst = MSIDErrorInternal,
MSIDErrorCodeLast = MSIDErrorUnsupportedFunctionality
};

extern NSError *MSIDCreateError(NSString *domain, NSInteger code, NSString *errorDescription, NSString *oauthError, NSString *subError, NSError *underlyingError, NSUUID *correlationId, NSDictionary *additionalUserInfo);

extern MSIDErrorCode MSIDErrorCodeForOAuthError(NSString *oauthError, MSIDErrorCode defaultCode);

22 changes: 21 additions & 1 deletion IdentityCore/src/MSIDError.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,24 @@
return [NSError errorWithDomain:domain code:code userInfo:userInfo];
}


MSIDErrorCode MSIDErrorCodeForOAuthError(NSString *oauthError, MSIDErrorCode defaultCode)
{
if (oauthError && [oauthError caseInsensitiveCompare:@"invalid_request"] == NSOrderedSame)
{
return MSIDErrorInvalidRequest;
}
if (oauthError && [oauthError caseInsensitiveCompare:@"invalid_client"] == NSOrderedSame)
{
return MSIDErrorInvalidClient;
}
if (oauthError && [oauthError caseInsensitiveCompare:@"invalid_scope"] == NSOrderedSame)
{
return MSIDErrorInvalidScope;
}
if (oauthError && [oauthError caseInsensitiveCompare:@"invalid_grant"] == NSOrderedSame)
{
return MSIDErrorInvalidGrant;
}

return defaultCode;
}
6 changes: 6 additions & 0 deletions IdentityCore/src/MSIDOAuth2Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ extern NSString *const MSID_OAUTH2_AUTHORIZATION_CODE;
extern NSString *const MSID_OAUTH2_AUTHORIZATION_URI;
extern NSString *const MSID_OAUTH2_AUTHORITY;
extern NSString *const MSID_OAUTH2_AUTHORIZE_SUFFIX;
extern NSString *const MSID_OAUTH2_V2_AUTHORIZE_SUFFIX;
extern NSString *const MSID_OAUTH2_BEARER;
extern NSString *const MSID_OAUTH2_CLIENT_ID;
extern NSString *const MSID_OAUTH2_CLAIMS;
extern NSString *const MSID_OAUTH2_CODE;
extern NSString *const MSID_OAUTH2_ERROR;
extern NSString *const MSID_OAUTH2_ERROR_DESCRIPTION;
extern NSString *const MSID_OAUTH2_ERROR_SUBCODE;
extern NSString *const MSID_OAUTH2_EXPIRES_IN;
extern NSString *const MSID_OAUTH2_GRANT_TYPE;
extern NSString *const MSID_OAUTH2_REDIRECT_URI;
Expand All @@ -53,6 +56,8 @@ extern NSString *const MSID_OAUTH2_CORRELATION_ID_REQUEST_VALUE;
extern NSString *const MSID_OAUTH2_SAML11_BEARER_VALUE;
extern NSString *const MSID_OAUTH2_SAML2_BEARER_VALUE;
extern NSString *const MSID_OAUTH2_SCOPE_OPENID_VALUE;
extern NSString *const MSID_OAUTH2_SCOPE_OFFLINE_ACCESS_VALUE;
extern NSString *const MSID_OAUTH2_SCOPE_PROFILE_VALUE;
extern NSString *const MSID_OAUTH2_ASSERTION;
extern NSString *const MSID_OAUTH2_CLIENT_TELEMETRY;
extern NSString *const MSID_OAUTH2_PROMPT;
Expand All @@ -61,6 +66,7 @@ extern NSString *const MSID_OAUTH2_PROMPT_NONE;
extern NSString *const MSID_OAUTH2_EXPIRES_ON;
extern NSString *const MSID_OAUTH2_EXT_EXPIRES_IN;
extern NSString *const MSID_FAMILY_ID;
extern NSString *const MSID_AUTH_CLOUD_INSTANCE_HOST_NAME;

// Used for PKCE support
extern NSString *const MSID_OAUTH2_CODE_CHALLENGE;
Expand Down
7 changes: 7 additions & 0 deletions IdentityCore/src/MSIDOAuth2Constants.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@
NSString *const MSID_OAUTH2_ACCESS_TOKEN = @"access_token";
NSString *const MSID_OAUTH2_AUTHORIZATION = @"authorization";
NSString *const MSID_OAUTH2_AUTHORIZE_SUFFIX = @"/oauth2/authorize";
NSString *const MSID_OAUTH2_V2_AUTHORIZE_SUFFIX = @"/oauth2/v2.0/authorize";
NSString *const MSID_OAUTH2_AUTHORITY = @"authority";
NSString *const MSID_OAUTH2_AUTHORIZATION_CODE = @"authorization_code";
NSString *const MSID_OAUTH2_AUTHORIZATION_URI = @"authorization_uri";
NSString *const MSID_OAUTH2_BEARER = @"Bearer";
NSString *const MSID_OAUTH2_CLIENT_ID = @"client_id";
NSString *const MSID_OAUTH2_CLAIMS = @"claims";
NSString *const MSID_OAUTH2_CODE = @"code";
NSString *const MSID_OAUTH2_ERROR = @"error";
NSString *const MSID_OAUTH2_ERROR_DESCRIPTION = @"error_description";
NSString *const MSID_OAUTH2_ERROR_SUBCODE = @"error_subcode";
NSString *const MSID_OAUTH2_EXPIRES_IN = @"expires_in";
NSString *const MSID_OAUTH2_GRANT_TYPE = @"grant_type";
NSString *const MSID_OAUTH2_REDIRECT_URI = @"redirect_uri";
Expand All @@ -56,6 +59,8 @@
NSString *const MSID_OAUTH2_SAML11_BEARER_VALUE = @"urn:ietf:params:oauth:grant-type:saml1_1-bearer";
NSString *const MSID_OAUTH2_SAML2_BEARER_VALUE = @"urn:ietf:params:oauth:grant-type:saml2-bearer";
NSString *const MSID_OAUTH2_SCOPE_OPENID_VALUE = @"openid";
NSString *const MSID_OAUTH2_SCOPE_PROFILE_VALUE = @"profile";
NSString *const MSID_OAUTH2_SCOPE_OFFLINE_ACCESS_VALUE = @"offline_access";
NSString *const MSID_OAUTH2_CLIENT_TELEMETRY = @"x-ms-clitelem";
NSString *const MSID_OAUTH2_PROMPT = @"prompt";
NSString *const MSID_OAUTH2_PROMPT_NONE = @"none";
Expand All @@ -78,6 +83,8 @@
NSString *const MSID_OAUTH2_ADDITIONAL_SERVER_INFO = @"additional_server_info";
NSString *const MSID_OAUTH2_ENVIRONMENT = @"environment";

NSString *const MSID_AUTH_CLOUD_INSTANCE_HOST_NAME = @"cloud_instance_host_name";

NSString *const MSID_CREDENTIAL_TYPE_CACHE_KEY = @"credential_type";
NSString *const MSID_ENVIRONMENT_CACHE_KEY = @"environment";
NSString *const MSID_REALM_CACHE_KEY = @"realm";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#import "MSIDTelemetryEventStrings.h"
#import "MSIDTelemetryCacheEvent.h"
#import "MSIDLegacyTokenCacheKey.h"
#import "MSIDConfiguration.h"
#import "MSIDTokenResponse.h"
#import "NSDate+MSIDExtensions.h"
#import "MSIDAuthority.h"
Expand Down
15 changes: 1 addition & 14 deletions IdentityCore/src/configuration/MSIDConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

@interface MSIDConfiguration : NSObject <NSCopying>

// Commonly used or needed properties
@property (readwrite) NSURL *authority;
@property (readwrite) NSString *redirectUri;
@property (readwrite) NSString *clientId;
Expand All @@ -39,18 +40,4 @@
clientId:(NSString *)clientId
target:(NSString *)target;

- (instancetype)initWithAuthority:(NSURL *)authority
redirectUri:(NSString *)redirectUri
clientId:(NSString *)clientId
target:(NSString *)target
correlationId:(NSUUID *)correlationId;

// Optional configurations
@property (readwrite) NSString *loginHint;
@property (readwrite) NSUUID *correlationId;

@property (readwrite) MSIDNetworkConfiguration *networkConfig;

@property (readwrite) NSDictionary<NSString *, NSString *> *sliceParameters;

@end
14 changes: 1 addition & 13 deletions IdentityCore/src/configuration/MSIDConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#import "MSIDConfiguration.h"
#import "NSOrderedSet+MSIDExtensions.h"
#import "MSIDPkce.h"

@implementation MSIDConfiguration

Copy link
Member

@jasoncoolmax jasoncoolmax May 11, 2018

Choose a reason for hiding this comment

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

should line 50 be return [self initWithAuthority:authority redirectUri:redirectUri clientId:clientId target:target correlationId:nil];? otherwise it won't create suitable class when creating a subclass :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah it should've been exactly that

Expand All @@ -33,27 +34,15 @@ - (instancetype)copyWithZone:(NSZone*)zone
configuration.redirectUri = [_redirectUri copyWithZone:zone];
configuration.target = [_target copyWithZone:zone];
configuration.clientId = [_clientId copyWithZone:zone];
configuration.correlationId = [_correlationId copyWithZone:zone];
configuration.loginHint = [_loginHint copyWithZone:zone];
configuration.sliceParameters = [_sliceParameters copyWithZone:zone];
Copy link
Member

Choose a reason for hiding this comment

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

I think we need slice parameters for all requests, both interactive and silent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is to be determined whether it will use MSIDConfiguration class or not.

configuration.networkConfig = [_networkConfig copyWithZone:zone];

return configuration;
}

- (instancetype)initWithAuthority:(NSURL *)authority
redirectUri:(NSString *)redirectUri
clientId:(NSString *)clientId
target:(NSString *)target
{
return [[MSIDConfiguration alloc] initWithAuthority:authority redirectUri:redirectUri clientId:clientId target:target correlationId:nil];
}

- (instancetype)initWithAuthority:(NSURL *)authority
redirectUri:(NSString *)redirectUri
clientId:(NSString *)clientId
target:(NSString *)target
correlationId:(NSUUID *)correlationId
{
self = [super init];

Expand All @@ -63,7 +52,6 @@ - (instancetype)initWithAuthority:(NSURL *)authority
_redirectUri = redirectUri;
_clientId = clientId;
_target = target;
_correlationId = correlationId;
}

return self;
Expand Down
8 changes: 3 additions & 5 deletions IdentityCore/src/configuration/MSIDNetworkConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
#import <Foundation/Foundation.h>


@interface MSIDNetworkConfiguration : NSObject <NSCopying>
@interface MSIDNetworkConfiguration : NSObject
Copy link
Contributor

Choose a reason for hiding this comment

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

Should MSIDNetworkConfiguration be singleton? If no, how are we going to access it in the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both it's properties are class properties with setters and getters.
So, you'd just use MSIDNetworkConfiguration.timeout and MSIDNetworkConfiguration.retryCount

Copy link
Contributor Author

Choose a reason for hiding this comment

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


@property (readwrite) NSTimeInterval timeout;
@property (readwrite) int retryCount;

- (instancetype)initWithTimeout:(NSTimeInterval)timeout retryCount:(int)retryCount;
@property (class, nonatomic, readwrite) NSTimeInterval timeout;
@property (class, nonatomic, readwrite) NSInteger retryCount;

@end
37 changes: 12 additions & 25 deletions IdentityCore/src/configuration/MSIDNetworkConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,28 @@

#import "MSIDNetworkConfiguration.h"

static NSTimeInterval const s_defaultTimeout = 30;
static int const s_defaultRetryCount = 2;
static NSTimeInterval s_timeout = 30;
static NSInteger s_retryCount = 2;

@implementation MSIDNetworkConfiguration

- (instancetype)init
+ (void)setTimeout:(NSTimeInterval)timeout
{
self = [super init];
if (self)
{
_timeout = s_defaultTimeout;
_retryCount = s_defaultRetryCount;
}
return self;
s_timeout = timeout;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it is better to have default timeout & retryCount setter & getters and assign default values to them in initializer? In such case you will not need to override setters & getters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are class properties, which means they don't have default synthesizer.
thus, we'd need to write a setter/getter anyways. so, with that, I don't see a need for an initializer.

}

- (instancetype)initWithTimeout:(NSTimeInterval)timeout retryCount:(int)retryCount
+ (NSTimeInterval)timeout
{
self = [super init];
if (self)
{
_timeout = timeout;
_retryCount = retryCount;
}
return self;
return s_timeout;
}

- (instancetype)copyWithZone:(NSZone*)zone
+(void)setRetryCount:(NSInteger)retryCount
{
MSIDNetworkConfiguration *configuration = [[MSIDNetworkConfiguration allocWithZone:zone] init];
configuration.timeout = _timeout;
configuration.retryCount = _retryCount;

return configuration;
s_retryCount = retryCount;
}

+ (NSInteger)retryCount
{
return s_retryCount;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,47 @@
//------------------------------------------------------------------------------

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

@class MSIDPkce;
@class MSIDClientInfo;

@interface MSIDWebviewConfiguration : MSIDConfiguration
@interface MSIDWebviewConfiguration : NSObject

// Common
@property (readwrite) NSURL *authorizationEndpoint;
@property (readwrite) NSString *redirectUri;
@property (readwrite) NSString *clientId;
@property (readwrite) NSString *resource;
@property (readwrite) NSOrderedSet<NSString *> *scopes;
@property (readwrite) NSUUID *correlationId;

@property (readwrite) NSDictionary<NSString *, NSString *> *extraQueryParameters;
@property (readwrite) NSDictionary<NSString *, NSString *> *sliceParameters;
@property (readwrite) NSString *promptBehavior;
@property (readwrite) NSString *claims;

// Is this only for V2?
@property (readwrite) NSString *requestState;
// State verifier: Recommended verifier for state value of the response.
// Set to YES to stop if verifying state fails
@property (readonly) BOOL verifyState;

@property (readwrite) MSIDPkce *pkce;
@property (readwrite) MSIDClientInfo *clientInfo;
// PKCE Support
@property (readonly) MSIDPkce *pkce;

// User information
@property (readwrite) NSString *loginHint;
@property (readwrite) NSString *utid;
@property (readwrite) NSString *uid;

// Priority start URL
@property (readwrite) NSURL *explicitStartURL;

- (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint
redirectUri:(NSString *)redirectUri
clientId:(NSString *)clientId
resource:(NSString *)resource
scopes:(NSOrderedSet<NSString *> *)scopes
correlationId:(NSUUID *)correlationId
verifyState:(BOOL)verifyState
enablePkce:(BOOL)enablePkce;


@end
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,36 @@
//------------------------------------------------------------------------------

#import "MSIDWebviewConfiguration.h"
#import "MSIDPkce.h"

@implementation MSIDWebviewConfiguration

- (instancetype)initWithAuthorizationEndpoint:(NSURL *)authorizationEndpoint
redirectUri:(NSString *)redirectUri
clientId:(NSString *)clientId
resource:(NSString *)resource
scopes:(NSOrderedSet<NSString *> *)scopes
correlationId:(NSUUID *)correlationId
verifyState:(BOOL)verifyState
enablePkce:(BOOL)enablePkce

{
self = [super init];
if (self)
{
_authorizationEndpoint = authorizationEndpoint;
_redirectUri = redirectUri;
_clientId = clientId;
_resource = resource;
_scopes = scopes;
_correlationId = correlationId;
_verifyState = verifyState;

if (enablePkce)
{
_pkce = [MSIDPkce new];
}
}
return self;
}
@end
Loading