Skip to content

Commit

Permalink
Rename OIDExternalUserAgentUICoordinator to OIDExternalUserAgent
Browse files Browse the repository at this point in the history
Drop the "UICoordinator". Just "OIDExternalUserAgent". It's cleaner.
  • Loading branch information
WilliamDenniss committed Mar 8, 2018
1 parent bee3f29 commit 776c5fd
Show file tree
Hide file tree
Showing 27 changed files with 193 additions and 189 deletions.
100 changes: 50 additions & 50 deletions AppAuth.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions Source/AppAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#import "OIDAuthorizationService.h"
#import "OIDError.h"
#import "OIDErrorUtilities.h"
#import "OIDExternalUserAgentFlowSession.h"
#import "OIDExternalUserAgentUICoordinator.h"
#import "OIDExternalUserAgent.h"
#import "OIDExternalUserAgentSession.h"
#import "OIDGrantTypes.h"
#import "OIDRegistrationRequest.h"
#import "OIDRegistrationResponse.h"
Expand All @@ -45,11 +45,12 @@
#elif TARGET_OS_IOS
#import "OIDAuthState+IOS.h"
#import "OIDAuthorizationService+IOS.h"
#import "OIDExternalUserAgentUICoordinatorCustomBrowser.h"
#import "OIDExternalUserAgentIOS.h"
#import "OIDExternalUserAgentIOSCustomBrowser.h"
#elif TARGET_OS_MAC
#import "OIDAuthState+Mac.h"
#import "OIDAuthorizationService+Mac.h"
#import "OIDExternalUserAgentUICoordinatorMac.h"
#import "OIDExternalUserAgentMac.h"
#import "OIDRedirectHTTPHandler.h"
#else
#error "Platform Undefined"
Expand Down
8 changes: 4 additions & 4 deletions Source/Framework/AppAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FOUNDATION_EXPORT const unsigned char AppAuthVersionString[];
#import <AppAuth/OIDAuthorizationRequest.h>
#import <AppAuth/OIDAuthorizationResponse.h>
#import <AppAuth/OIDAuthorizationService.h>
#import <AppAuth/OIDExternalUserAgentUICoordinator.h>
#import <AppAuth/OIDExternalUserAgent.h>
#import <AppAuth/OIDError.h>
#import <AppAuth/OIDErrorUtilities.h>
#import <AppAuth/OIDGrantTypes.h>
Expand All @@ -50,12 +50,12 @@ FOUNDATION_EXPORT const unsigned char AppAuthVersionString[];
#elif TARGET_OS_IOS
#import <AppAuth/OIDAuthState+IOS.h>
#import <AppAuth/OIDAuthorizationService+IOS.h>
#import <AppAuth/OIDExternalUserAgentUICoordinatorCustomBrowser.h>
#import <AppAuth/OIDExternalUserAgentUICoordinatorIOS.h>
#import <AppAuth/OIDExternalUserAgentIOS.h>
#import <AppAuth/OIDExternalUserAgentIOSCustomBrowser.h>
#elif TARGET_OS_MAC
#import <AppAuth/OIDAuthState+Mac.h>
#import <AppAuth/OIDAuthorizationService+Mac.h>
#import <AppAuth/OIDExternalUserAgentUICoordinatorMac.h>
#import <AppAuth/OIDExternalUserAgentMac.h>
#import <AppAuth/OIDRedirectHTTPHandler.h>
#else
#error "Platform Undefined"
Expand Down
16 changes: 8 additions & 8 deletions Source/OIDAuthState.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
@protocol OIDAuthorizationFlowSession;
@protocol OIDAuthStateChangeDelegate;
@protocol OIDAuthStateErrorDelegate;
@protocol OIDExternalUserAgentUICoordinator;
@protocol OIDExternalUserAgentFlowSession;
@protocol OIDExternalUserAgent;
@protocol OIDExternalUserAgentSession;

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -143,15 +143,15 @@ typedef void (^OIDAuthStateAuthorizationCallback)(OIDAuthState *_Nullable authSt
/*! @brief Convenience method to create a @c OIDAuthState by presenting an authorization request
and performing the authorization code exchange in the case of code flow requests.
@param authorizationRequest The authorization request to present.
@param UICoordinator Generic UI coordinator that can present an external user-agent request.
@param UICoordinator A external user agent that can present an external user-agent request.
@param callback The method called when the request has completed or failed.
@return A @c OIDExternalUserAgentFlowSession instance which will terminate when it
receives a @c OIDExternalUserAgentFlowSession.cancel message, or after processing a
@c OIDExternalUserAgentFlowSession.resumeExternalUserAgentFlowWithURL: message.
@return A @c OIDExternalUserAgentSession instance which will terminate when it
receives a @c OIDExternalUserAgentSession.cancel message, or after processing a
@c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message.
*/
+ (id<OIDExternalUserAgentFlowSession, OIDAuthorizationFlowSession>)
+ (id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
UICoordinator:(id<OIDExternalUserAgentUICoordinator>)UICoordinator
UICoordinator:(id<OIDExternalUserAgent>)externalUserAgent
callback:(OIDAuthStateAuthorizationCallback)callback;

/*! @internal
Expand Down
8 changes: 4 additions & 4 deletions Source/OIDAuthState.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ @implementation OIDAuthState

#pragma mark - Convenience initializers

+ (id<OIDExternalUserAgentFlowSession, OIDAuthorizationFlowSession>)
+ (id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
UICoordinator:(id<OIDExternalUserAgentUICoordinator>)UICoordinator
UICoordinator:(id<OIDExternalUserAgent>)externalUserAgent
callback:(OIDAuthStateAuthorizationCallback)callback {
// presents the authorization request
id<OIDExternalUserAgentFlowSession, OIDAuthorizationFlowSession> authFlowSession = [OIDAuthorizationService
id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession> authFlowSession = [OIDAuthorizationService
presentAuthorizationRequest:authorizationRequest
UICoordinator:UICoordinator
UICoordinator:externalUserAgent
callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse,
NSError *_Nullable authorizationError) {
// inspects response and processes further if needed (e.g. authorization
Expand Down
2 changes: 1 addition & 1 deletion Source/OIDAuthorizationFlowSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
- (BOOL)resumeAuthorizationFlowWithURL:(NSURL *)URL;

/*! @brief @c OIDAuthorizationUICoordinator or clients should call this method when the
/*! @brief @c OIDExternalUserAgent implementations should call this method when the
authorization flow failed with a non-OAuth error.
@param error The error that is the reason for the failure of this authorization flow.
@remarks Has no effect if called more than once, or after a @c cancel message was received.
Expand Down
14 changes: 7 additions & 7 deletions Source/OIDAuthorizationService.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
@class OIDTokenRequest;
@class OIDTokenResponse;
@protocol OIDAuthorizationFlowSession;
@protocol OIDExternalUserAgentFlowSession;
@protocol OIDExternalUserAgentUICoordinator;
@protocol OIDExternalUserAgent;
@protocol OIDExternalUserAgentSession;

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -116,13 +116,13 @@ typedef void (^OIDRegistrationCompletion)(OIDRegistrationResponse *_Nullable reg
@param UICoordinator Generic authorization UI coordinator that can present an authorization
request.
@param callback The method called when the request has completed or failed.
@return A @c OIDExternalUserAgentFlowSession instance which will terminate when it
receives a @c OIDExternalUserAgentFlowSession.cancel message, or after processing a
@c OIDExternalUserAgentFlowSession.resumeExternalUserAgentFlowWithURL: message.
@return A @c OIDExternalUserAgentSession instance which will terminate when it
receives a @c OIDExternalUserAgentSession.cancel message, or after processing a
@c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message.
*/
+ (id<OIDExternalUserAgentFlowSession, OIDAuthorizationFlowSession>)
+ (id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession>)
presentAuthorizationRequest:(OIDAuthorizationRequest *)request
UICoordinator:(id<OIDExternalUserAgentUICoordinator>)UICoordinator
UICoordinator:(id<OIDExternalUserAgent>)externalUserAgent
callback:(OIDAuthorizationCallback)callback;

/*! @brief Performs a token request.
Expand Down
22 changes: 11 additions & 11 deletions Source/OIDAuthorizationService.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#import "OIDDefines.h"
#import "OIDErrorUtilities.h"
#import "OIDAuthorizationFlowSession.h"
#import "OIDExternalUserAgentFlowSession.h"
#import "OIDExternalUserAgentUICoordinator.h"
#import "OIDExternalUserAgent.h"
#import "OIDExternalUserAgentSession.h"
#import "OIDRegistrationRequest.h"
#import "OIDRegistrationResponse.h"
#import "OIDServiceConfiguration.h"
Expand All @@ -42,10 +42,10 @@

NS_ASSUME_NONNULL_BEGIN

@interface OIDAuthorizationFlowSessionImplementation : NSObject<OIDExternalUserAgentFlowSession, OIDAuthorizationFlowSession> {
@interface OIDAuthorizationFlowSessionImplementation : NSObject<OIDExternalUserAgentSession, OIDAuthorizationFlowSession> {
// private variables
OIDAuthorizationRequest *_request;
id<OIDExternalUserAgentUICoordinator> _UICoordinator;
id<OIDExternalUserAgent> _UICoordinator;
OIDAuthorizationCallback _pendingauthorizationFlowCallback;
}

Expand All @@ -66,7 +66,7 @@ - (instancetype)initWithRequest:(OIDAuthorizationRequest *)request {
return self;
}

- (void)presentAuthorizationWithCoordinator:(id<OIDExternalUserAgentUICoordinator>)UICoordinator
- (void)presentAuthorizationWithCoordinator:(id<OIDExternalUserAgent>)UICoordinator
callback:(OIDAuthorizationCallback)authorizationFlowCallback {
_UICoordinator = UICoordinator;
_pendingauthorizationFlowCallback = authorizationFlowCallback;
Expand All @@ -81,7 +81,7 @@ - (void)presentAuthorizationWithCoordinator:(id<OIDExternalUserAgentUICoordinato
}

- (void)cancel {
[_UICoordinator dismissExternalUserAgentUIAnimated:YES completion:^{
[_UICoordinator dismissExternalUserAgentAnimated:YES completion:^{
NSError *error = [OIDErrorUtilities
errorWithCode:OIDErrorCodeUserCanceledAuthorizationFlow
underlyingError:nil
Expand Down Expand Up @@ -146,7 +146,7 @@ - (BOOL)resumeExternalUserAgentFlowWithURL:(NSURL *)URL {
}
}

[_UICoordinator dismissExternalUserAgentUIAnimated:YES completion:^{
[_UICoordinator dismissExternalUserAgentAnimated:YES completion:^{
[self didFinishWithResponse:response error:error];
}];

Expand All @@ -172,7 +172,7 @@ - (void)didFinishWithResponse:(nullable OIDAuthorizationResponse *)response
}

- (void)failAuthorizationFlowWithError:(NSError *)error {
[self failAuthorizationFlowWithError:error];
[self failExternalUserAgentFlowWithError:error];
}

- (BOOL)resumeAuthorizationFlowWithURL:(NSURL *)URL {
Expand Down Expand Up @@ -253,13 +253,13 @@ + (void)discoverServiceConfigurationForDiscoveryURL:(NSURL *)discoveryURL

#pragma mark - Authorization Endpoint

+ (id<OIDExternalUserAgentFlowSession, OIDAuthorizationFlowSession>)
+ (id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession>)
presentAuthorizationRequest:(OIDAuthorizationRequest *)request
UICoordinator:(id<OIDExternalUserAgentUICoordinator>)UICoordinator
UICoordinator:(id<OIDExternalUserAgent>)externalUserAgent
callback:(OIDAuthorizationCallback)callback {
OIDAuthorizationFlowSessionImplementation *flowSession =
[[OIDAuthorizationFlowSessionImplementation alloc] initWithRequest:request];
[flowSession presentAuthorizationWithCoordinator:UICoordinator callback:callback];
[flowSession presentAuthorizationWithCoordinator:externalUserAgent callback:callback];
return flowSession;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! @file OIDExternalUserAgentUICoordinator.h
/*! @file OIDExternalUserAgent.h
@brief AppAuth iOS SDK
@copyright
Copyright 2016 Google Inc. All Rights Reserved.
Expand All @@ -18,35 +18,35 @@

#import <Foundation/Foundation.h>

@protocol OIDExternalUserAgentFlowSession;
@protocol OIDExternalUserAgentSession;
@protocol OIDExternalUserAgentRequest;

NS_ASSUME_NONNULL_BEGIN

/*! @protocol OIDExternalUserAgentUICoordinator
/*! @protocol OIDExternalUserAgent
@brief An external user-agent UI coordinator that presents a request. Clients may provide custom
implementations of an external UI coordinator to customize the way the requests are
presented to the end user.
*/
@protocol OIDExternalUserAgentUICoordinator<NSObject>
@protocol OIDExternalUserAgent<NSObject>

/*! @brief Presents the external user-agent request in the UI coordinator.
@param request The request to be presented in the UI.
@param session The @c OIDExternalUserAgentFlowSession instance that initiates presenting the UI.
Concrete implementations of a @c OIDExternalUserAgentUICoordinator may call
/*! @brief Presents the request in the external user-agent.
@param request The request to be presented in the external user-agent.
@param session The @c OIDExternalUserAgentSession instance that initiates presenting the UI.
Concrete implementations of a @c OIDExternalUserAgent may call
resumeExternalUserAgentFlowWithURL or failExternalUserAgentFlowWithError on session to either
resume or fail the request.
@return YES If the request UI was successfully presented to the user.
*/
- (BOOL)presentExternalUserAgentRequest:(id<OIDExternalUserAgentRequest> )request
session:(id<OIDExternalUserAgentFlowSession>)session;
session:(id<OIDExternalUserAgentSession>)session;

/*! @brief Dimisses the external user-agent UI and calls completion when the dismiss operation ends.
@param animated Wheter or not the dismiss operation should be animated.
/*! @brief Dimisses the external user-agent and calls completion when the dismiss operation ends.
@param animated Whether or not the dismiss operation should be animated.
@remarks Has no effect if no UI is presented.
@param completion The block to be called when the dismiss operations ends
*/
- (void)dismissExternalUserAgentUIAnimated:(BOOL)animated completion:(void (^)(void))completion;
- (void)dismissExternalUserAgentAnimated:(BOOL)animated completion:(void (^)(void))completion;

@end

Expand Down
6 changes: 3 additions & 3 deletions Source/OIDExternalUserAgentRequest.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! @file OIDExternalUserAgentUICoordinator.h
/*! @file OIDExternalUserAgent.h
@brief AppAuth iOS SDK
@copyright
Copyright 2017 The AppAuth Authors. All Rights Reserved.
Expand All @@ -16,9 +16,9 @@
limitations under the License.
*/

/*! @protocol OIDExternalUserAgentUICoordinator
/*! @protocol OIDExternalUserAgent
@brief An interface that any external user-agent request may implement to use the
@c OIDExternalUserAgentUICoordinator flow.
@c OIDExternalUserAgent flow.
*/
@protocol OIDExternalUserAgentRequest

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! @file OIDExternalUserAgentFlowSession.h
/*! @file OIDExternalUserAgentSession.h
@brief AppAuth iOS SDK
@copyright
Copyright 2017 The AppAuth Authors. All Rights Reserved.
Expand All @@ -19,11 +19,11 @@

/*! @brief Represents an in-flight external user-agent flow session.
*/
@protocol OIDExternalUserAgentFlowSession <NSObject>
@protocol OIDExternalUserAgentSession <NSObject>

/*! @brief Cancels the code flow session, invoking the request's callback with a cancelled error.
@remarks Has no effect if called more than once, or after a
@c OIDExternalUserAgentFlowSession.resumeExternalUserAgentFlowWithURL: message was received.
@c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message was received.
Will cause an error with code: @c ::OIDErrorCodeProgramCanceledAuthorizationFlow to be
passed to the @c callback block passed to
@c OIDAuthorizationService.presentAuthorizationRequest:presentingViewController:callback:
Expand All @@ -42,7 +42,7 @@
*/
- (BOOL)resumeExternalUserAgentFlowWithURL:(NSURL *)URL;

/*! @brief @c OIDExternalUserAgentUICoordinator or clients should call this method when the
/*! @brief @c OIDExternalUserAgent or clients should call this method when the
external user-agent flow failed with a non-OAuth error.
@param error The error that is the reason for the failure of this external flow.
@remarks Has no effect if called more than once, or after a @c cancel message was received.
Expand Down
8 changes: 4 additions & 4 deletions Source/iOS/OIDAuthState+IOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ NS_ASSUME_NONNULL_BEGIN
@param presentingViewController The view controller from which to present the
@c SFSafariViewController.
@param callback The method called when the request has completed or failed.
@return A @c OIDExternalUserAgentFlowSession instance which will terminate when it
receives a @c OIDExternalUserAgentFlowSession.cancel message, or after processing a
@c OIDExternalUserAgentFlowSession.resumeExternalUserAgentFlowWithURL: message.
@return A @c OIDExternalUserAgentSession instance which will terminate when it
receives a @c OIDExternalUserAgentSession.cancel message, or after processing a
@c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message.
*/
+ (id<OIDExternalUserAgentFlowSession, OIDAuthorizationFlowSession>)
+ (id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
presentingViewController:(UIViewController *)presentingViewController
callback:(OIDAuthStateAuthorizationCallback)callback;
Expand Down
11 changes: 6 additions & 5 deletions Source/iOS/OIDAuthState+IOS.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@

#import "OIDAuthState+IOS.h"

#import "OIDExternalUserAgentUICoordinatorIOS.h"
#import "OIDExternalUserAgentIOS.h"

@implementation OIDAuthState (IOS)

+ (id<OIDExternalUserAgentFlowSession, OIDAuthorizationFlowSession>)
+ (id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
presentingViewController:(UIViewController *)presentingViewController
callback:(OIDAuthStateAuthorizationCallback)callback {
OIDExternalUserAgentUICoordinatorIOS *coordinator = [[OIDExternalUserAgentUICoordinatorIOS alloc]
initWithPresentingViewController:presentingViewController];
OIDExternalUserAgentIOS *externalUserAgent =
[[OIDExternalUserAgentIOS alloc]
initWithPresentingViewController:presentingViewController];
return [self authStateByPresentingAuthorizationRequest:authorizationRequest
UICoordinator:coordinator
UICoordinator:externalUserAgent
callback:callback];
}

Expand Down
10 changes: 5 additions & 5 deletions Source/iOS/OIDAuthorizationService+IOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#import <UIKit/UIKit.h>

#import "OIDAuthorizationService.h"
#import "OIDExternalUserAgentFlowSession.h"
#import "OIDExternalUserAgentSession.h"

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -32,11 +32,11 @@ NS_ASSUME_NONNULL_BEGIN
@param presentingViewController The view controller from which to present the
\SFSafariViewController.
@param callback The method called when the request has completed or failed.
@return A @c OIDExternalUserAgentFlowSession instance which will terminate when it
receives a @c OIDExternalUserAgentFlowSession.cancel message, or after processing a
@c OIDExternalUserAgentFlowSession.resumeExternalUserAgentFlowWithURL: message.
@return A @c OIDExternalUserAgentSession instance which will terminate when it
receives a @c OIDExternalUserAgentSession.cancel message, or after processing a
@c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message.
*/
+ (id<OIDExternalUserAgentFlowSession, OIDAuthorizationFlowSession>)
+ (id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession>)
presentAuthorizationRequest:(OIDAuthorizationRequest *)request
presentingViewController:(UIViewController *)presentingViewController
callback:(OIDAuthorizationCallback)callback;
Expand Down
Loading

0 comments on commit 776c5fd

Please sign in to comment.