Skip to content
Open
1 change: 1 addition & 0 deletions Sources/AppAuth/iOS/OIDExternalUserAgentIOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
API_UNAVAILABLE(macCatalyst)
@interface OIDExternalUserAgentIOS : NSObject<OIDExternalUserAgent>
@property(nonatomic, weak) UIViewController *_presentingViewController;

- (null_unspecified instancetype)init API_AVAILABLE(ios(11))
__deprecated_msg("This method will not work on iOS 13, use "
Expand Down
9 changes: 4 additions & 5 deletions Sources/AppAuth/iOS/OIDExternalUserAgentIOS.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ @interface OIDExternalUserAgentIOS ()<SFSafariViewControllerDelegate>
#endif

@implementation OIDExternalUserAgentIOS {
UIViewController *_presentingViewController;
BOOL _prefersEphemeralSession;

BOOL _externalUserAgentFlowInProgress;
Expand Down Expand Up @@ -71,7 +70,7 @@ - (nullable instancetype)initWithPresentingViewController:
@"presentingViewController cannot be nil on iOS 13");
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000

_presentingViewController = presentingViewController;
self._presentingViewController = presentingViewController;
}
return self;
}
Expand Down Expand Up @@ -166,12 +165,12 @@ - (BOOL)presentExternalUserAgentRequest:(id<OIDExternalUserAgentRequest>)request
}
// iOS 9 and 10, use SFSafariViewController
if (@available(iOS 9.0, *)) {
if (!openedUserAgent && _presentingViewController) {
if (!openedUserAgent && self._presentingViewController) {
SFSafariViewController *safariVC =
[[SFSafariViewController alloc] initWithURL:requestURL];
safariVC.delegate = self;
_safariVC = safariVC;
[_presentingViewController presentViewController:safariVC animated:YES completion:nil];
[self._presentingViewController presentViewController:safariVC animated:YES completion:nil];
openedUserAgent = YES;
}
}
Expand Down Expand Up @@ -251,7 +250,7 @@ - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller NS_AV
#pragma mark - ASWebAuthenticationPresentationContextProviding

- (ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(ASWebAuthenticationSession *)session API_AVAILABLE(ios(13.0)){
return _presentingViewController.view.window;
return self._presentingViewController.view.window;
}
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000

Expand Down
7 changes: 7 additions & 0 deletions Sources/AppAuthCore/OIDAuthState.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@

NS_ASSUME_NONNULL_BEGIN

#if DEBUG
static const NSUInteger kExpiryTimeTolerance = 15;
#else
static const NSUInteger kExpiryTimeTolerance = 60;
#endif


/*! @brief Represents a block used to call an action with a fresh access token.
@param accessToken A valid access token if available.
@param idToken A valid ID token if available.
Expand Down
1 change: 0 additions & 1 deletion Sources/AppAuthCore/OIDAuthState.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

/*! @brief Number of seconds the access token is refreshed before it actually expires.
*/
static const NSUInteger kExpiryTimeTolerance = 60;

/*! @brief Object to hold OIDAuthState pending actions.
*/
Expand Down