Skip to content

Commit

Permalink
Merge pull request openid#271 from WilliamDenniss/AppAuth_1_0
Browse files Browse the repository at this point in the history
Clean up the API surface in preparation for 1.0
  • Loading branch information
WilliamDenniss authored Jul 18, 2018
2 parents fadb76d + eb59c89 commit 65ef95c
Show file tree
Hide file tree
Showing 56 changed files with 129 additions and 570 deletions.
14 changes: 0 additions & 14 deletions AppAuth.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,6 @@
A5EEF29A20D821960044F470 /* OIDTokenUtilitiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A5EEF1FD20CF07760044F470 /* OIDTokenUtilitiesTests.m */; };
A5EEF29B20D821970044F470 /* OIDTokenUtilitiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A5EEF1FD20CF07760044F470 /* OIDTokenUtilitiesTests.m */; };
A5EEF29C20D821970044F470 /* OIDTokenUtilitiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A5EEF1FD20CF07760044F470 /* OIDTokenUtilitiesTests.m */; };
A6339DAA20321ADD0043D1C9 /* OIDAuthorizationFlowSession.h in Headers */ = {isa = PBXBuildFile; fileRef = A6339DA3203211320043D1C9 /* OIDAuthorizationFlowSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
A6339DAB20321AE50043D1C9 /* OIDAuthorizationFlowSession.h in Headers */ = {isa = PBXBuildFile; fileRef = A6339DA3203211320043D1C9 /* OIDAuthorizationFlowSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
A6339DAC20321AE70043D1C9 /* OIDAuthorizationFlowSession.h in Headers */ = {isa = PBXBuildFile; fileRef = A6339DA3203211320043D1C9 /* OIDAuthorizationFlowSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
A6339DAD20321AEB0043D1C9 /* OIDAuthorizationFlowSession.h in Headers */ = {isa = PBXBuildFile; fileRef = A6339DA3203211320043D1C9 /* OIDAuthorizationFlowSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
A6DEAB9B2018E4AD0022AC32 /* OIDExternalUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB982018E4A20022AC32 /* OIDExternalUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; };
A6DEAB9C2018E4AD0022AC32 /* OIDExternalUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB982018E4A20022AC32 /* OIDExternalUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; };
A6DEAB9D2018E4AD0022AC32 /* OIDExternalUserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A6DEAB982018E4A20022AC32 /* OIDExternalUserAgent.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -607,7 +603,6 @@
60140F841DE43C8C00DA0DC3 /* OIDRegistrationResponseTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OIDRegistrationResponseTests.h; sourceTree = "<group>"; };
60140F851DE43CC700DA0DC3 /* OIDRegistrationResponseTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OIDRegistrationResponseTests.m; sourceTree = "<group>"; };
A5EEF1FD20CF07760044F470 /* OIDTokenUtilitiesTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OIDTokenUtilitiesTests.m; sourceTree = "<group>"; };
A6339DA3203211320043D1C9 /* OIDAuthorizationFlowSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDAuthorizationFlowSession.h; sourceTree = "<group>"; };
A6DEAB982018E4A20022AC32 /* OIDExternalUserAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgent.h; sourceTree = "<group>"; };
A6DEAB992018E4A20022AC32 /* OIDExternalUserAgentSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentSession.h; sourceTree = "<group>"; };
A6DEAB9A2018E4A20022AC32 /* OIDExternalUserAgentRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OIDExternalUserAgentRequest.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -783,7 +778,6 @@
340DAE241D581FE700EC285B /* macOS */,
F6F60FAF1D2BFEF000325CB3 /* iOS */,
341741AF1C5D8243000EF209 /* AppAuth.h */,
A6339DA3203211320043D1C9 /* OIDAuthorizationFlowSession.h */,
341741B41C5D8243000EF209 /* OIDAuthorizationRequest.h */,
341741B51C5D8243000EF209 /* OIDAuthorizationRequest.m */,
341741B61C5D8243000EF209 /* OIDAuthorizationResponse.h */,
Expand Down Expand Up @@ -963,7 +957,6 @@
343AAAF91E83499000F9D36E /* OIDTokenUtilities.h in Headers */,
343AAAEC1E83499000F9D36E /* OIDError.h in Headers */,
A6DEABAB2018E5C50022AC32 /* OIDExternalUserAgentIOS.h in Headers */,
A6339DAA20321ADD0043D1C9 /* OIDAuthorizationFlowSession.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -993,7 +986,6 @@
343AAAFC1E83499100F9D36E /* OIDAuthorizationResponse.h in Headers */,
343AAB0C1E83499100F9D36E /* OIDScopeUtilities.h in Headers */,
55A094D020DFBB11000045D1 /* OIDURLSessionProvider.h in Headers */,
A6339DAB20321AE50043D1C9 /* OIDAuthorizationFlowSession.h in Headers */,
343AAB011E83499100F9D36E /* OIDAuthStateErrorDelegate.h in Headers */,
343AAAFB1E83499100F9D36E /* OIDAuthorizationRequest.h in Headers */,
343AAB051E83499100F9D36E /* OIDErrorUtilities.h in Headers */,
Expand Down Expand Up @@ -1026,7 +1018,6 @@
343AAB141E83499200F9D36E /* OIDAuthorizationResponse.h in Headers */,
343AAB241E83499200F9D36E /* OIDScopeUtilities.h in Headers */,
55A094D120DFBB12000045D1 /* OIDURLSessionProvider.h in Headers */,
A6339DAC20321AE70043D1C9 /* OIDAuthorizationFlowSession.h in Headers */,
343AAB191E83499200F9D36E /* OIDAuthStateErrorDelegate.h in Headers */,
343AAB131E83499200F9D36E /* OIDAuthorizationRequest.h in Headers */,
343AAB1D1E83499200F9D36E /* OIDErrorUtilities.h in Headers */,
Expand Down Expand Up @@ -1060,7 +1051,6 @@
343AAAE11E83494A00F9D36E /* OIDLoopbackHTTPServer.h in Headers */,
343AAB311E83499200F9D36E /* OIDAuthStateErrorDelegate.h in Headers */,
343AAB2F1E83499200F9D36E /* OIDAuthState.h in Headers */,
A6339DAD20321AEB0043D1C9 /* OIDAuthorizationFlowSession.h in Headers */,
343AAB3E1E83499200F9D36E /* OIDServiceDiscovery.h in Headers */,
A6DEAB9E2018E4AE0022AC32 /* OIDExternalUserAgent.h in Headers */,
34A6632C1E871DD40060B664 /* OIDIDToken.h in Headers */,
Expand Down Expand Up @@ -1918,7 +1908,6 @@
340DAE551D58216A00EC285B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ANALYZER_NONNULL = YES;
CODE_SIGN_IDENTITY = "-";
EXECUTABLE_PREFIX = lib;
Expand All @@ -1931,7 +1920,6 @@
340DAE561D58216A00EC285B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ANALYZER_NONNULL = YES;
CODE_SIGN_IDENTITY = "-";
EXECUTABLE_PREFIX = lib;
Expand Down Expand Up @@ -2408,7 +2396,6 @@
343AAAD41E8348AA00F9D36E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CODE_SIGN_IDENTITY = "-";
Expand All @@ -2434,7 +2421,6 @@
343AAAD51E8348AA00F9D36E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CODE_SIGN_IDENTITY = "-";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7FF583C8F7036437BE8875B3 /* Pods-Example-macOS.debug.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist";
Expand All @@ -456,7 +455,6 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 60553B3AB5BA3E1BB259E487 /* Pods-Example-macOS.release.xcconfig */;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist";
Expand All @@ -476,7 +474,6 @@
341AA4C81E7F2E5000FCA5C6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F6016E6B1D2AC11E003497D7 /* Build configuration list for PBXProject "Example-macOS" */ = {
isa = XCConfigurationList;
Expand Down
16 changes: 1 addition & 15 deletions Examples/Example-macOS/Source/AppAuthExampleViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,12 @@
@class AppDelegate;
@class OIDAuthState;
@class OIDServiceConfiguration;
@class OIDRedirectHTTPHandler;

NS_ASSUME_NONNULL_BEGIN

/*! @brief The example application's view controller.
*/
@interface AppAuthExampleViewController : NSViewController {
// private variables
OIDRedirectHTTPHandler *_redirectHTTPHandler;
// property variables
NSButton *_authAutoButton;
NSButton *_authManual;
NSButton *_authAutoHTTPButton;
NSButton *_codeExchangeButton;
NSButton *_userinfoButton;
NSButton *_clearAuthStateButton;
NSTextView *_logTextView;
__weak AppDelegate *_appDelegate;
OIDAuthState *_authState;
}
@interface AppAuthExampleViewController : NSViewController

@property(nullable) IBOutlet NSButton *authAutoButton;
@property(nullable) IBOutlet NSButton *authManual;
Expand Down
14 changes: 3 additions & 11 deletions Examples/Example-macOS/Source/AppAuthExampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,9 @@
@interface AppAuthExampleViewController () <OIDAuthStateChangeDelegate, OIDAuthStateErrorDelegate>
@end

@implementation AppAuthExampleViewController

@synthesize authAutoButton = _authAutoButton;
@synthesize authManual = _authManual;
@synthesize authAutoHTTPButton = _authAutoHTTPButton;
@synthesize codeExchangeButton = _codeExchangeButton;
@synthesize userinfoButton = _userinfoButton;
@synthesize clearAuthStateButton = _clearAuthStateButton;
@synthesize logTextView = _logTextView;
@synthesize appDelegate = _appDelegate;
@synthesize authState = _authState;
@implementation AppAuthExampleViewController {
OIDRedirectHTTPHandler *_redirectHTTPHandler;
}

- (void)viewDidLoad {
[super viewDidLoad];
Expand Down
8 changes: 1 addition & 7 deletions Examples/Example-macOS/Source/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
/*! @class AppDelegate
@brief The example application's delegate.
*/
@interface AppDelegate : NSObject <NSApplicationDelegate> {
// property variables
NSWindow *_window;
id<OIDExternalUserAgentSession> _currentAuthorizationFlow;
}
@interface AppDelegate : NSObject <NSApplicationDelegate>

/*! @property currentAuthorizationFlow
@brief The authorization flow session which receives the return URL from the browser.
Expand All @@ -38,8 +34,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property(nonatomic, strong, nullable) id<OIDExternalUserAgentSession> currentAuthorizationFlow;

@property(nullable) IBOutlet NSWindow *window;

@end

NS_ASSUME_NONNULL_END
7 changes: 4 additions & 3 deletions Examples/Example-macOS/Source/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@

NS_ASSUME_NONNULL_BEGIN

@implementation AppDelegate
@interface AppDelegate ()
@property(nullable) IBOutlet NSWindow *window;
@end

@synthesize window = _window;
@synthesize currentAuthorizationFlow = _currentAuthorizationFlow;
@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
_window.title = @"AppAuth Example for macOS";
Expand Down
1 change: 0 additions & 1 deletion Source/AppAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#import "OIDAuthState.h"
#import "OIDAuthStateChangeDelegate.h"
#import "OIDAuthStateErrorDelegate.h"
#import "OIDAuthorizationFlowSession.h"
#import "OIDAuthorizationRequest.h"
#import "OIDAuthorizationResponse.h"
#import "OIDAuthorizationService.h"
Expand Down
1 change: 0 additions & 1 deletion Source/Framework/AppAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ FOUNDATION_EXPORT const unsigned char AppAuthVersionString[];
#import <AppAuth/OIDAuthState.h>
#import <AppAuth/OIDAuthStateChangeDelegate.h>
#import <AppAuth/OIDAuthStateErrorDelegate.h>
#import <AppAuth/OIDAuthorizationFlowSession.h>
#import <AppAuth/OIDAuthorizationRequest.h>
#import <AppAuth/OIDAuthorizationResponse.h>
#import <AppAuth/OIDAuthorizationService.h>
Expand Down
38 changes: 2 additions & 36 deletions Source/OIDAuthState.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
@class OIDRegistrationResponse;
@class OIDTokenResponse;
@class OIDTokenRequest;
@protocol OIDAuthorizationFlowSession;
@protocol OIDAuthStateChangeDelegate;
@protocol OIDAuthStateErrorDelegate;
@protocol OIDExternalUserAgent;
Expand Down Expand Up @@ -52,30 +51,7 @@ typedef void (^OIDAuthStateAuthorizationCallback)(OIDAuthState *_Nullable authSt
/*! @brief A convenience class that retains the auth state between @c OIDAuthorizationResponse%s
and @c OIDTokenResponse%s.
*/
@interface OIDAuthState : NSObject <NSSecureCoding> {
// private variables
/*! @brief Array of pending actions (use @c _pendingActionsSyncObject to synchronize access).
*/
NSMutableArray *_pendingActions;

/*! @brief Object for synchronizing access to @c pendingActions.
*/
id _pendingActionsSyncObject;

/*! @brief If YES, tokens will be refreshed on the next API call regardless of expiry.
*/
BOOL _needsTokenRefresh;

// property variables
NSString *_refreshToken;
NSString *_scope;
OIDAuthorizationResponse *_lastAuthorizationResponse;
OIDTokenResponse *_lastTokenResponse;
OIDRegistrationResponse *_lastRegistrationResponse;
NSError *_authorizationError;
__weak id<OIDAuthStateChangeDelegate> _stateChangeDelegate;
__weak id<OIDAuthStateErrorDelegate> _errorDelegate;
}
@interface OIDAuthState : NSObject <NSSecureCoding>

/*! @brief The most recent refresh token received from the server.
@discussion Rather than using this property directly, you should call
Expand Down Expand Up @@ -149,7 +125,7 @@ typedef void (^OIDAuthStateAuthorizationCallback)(OIDAuthState *_Nullable authSt
receives a @c OIDExternalUserAgentSession.cancel message, or after processing a
@c OIDExternalUserAgentSession.resumeExternalUserAgentFlowWithURL: message.
*/
+ (id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession>)
+ (id<OIDExternalUserAgentSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
externalUserAgent:(id<OIDExternalUserAgent>)externalUserAgent
callback:(OIDAuthStateAuthorizationCallback)callback;
Expand Down Expand Up @@ -274,16 +250,6 @@ typedef void (^OIDAuthStateAuthorizationCallback)(OIDAuthState *_Nullable authSt
- (nullable OIDTokenRequest *)tokenRefreshRequestWithAdditionalParameters:
(nullable NSDictionary<NSString *, NSString *> *)additionalParameters;

/*! @brief Deprecated, use @c OIDAuthState.performActionWithFreshTokens:.
@discussion Calls the block with a valid access token (refreshing it first, if needed), or if a
refresh was needed and failed, with the error that caused it to fail.
@param action The block to execute with a fresh token. This block will be executed on the main
thread.
@deprecated Use @c OIDAuthState.performActionWithFreshTokens: which is equivalent.
*/
- (void)withFreshTokensPerformAction:(OIDAuthStateAction)action
__deprecated_msg("Use OIDAuthState.performActionWithFreshTokens:");

@end

NS_ASSUME_NONNULL_END
33 changes: 15 additions & 18 deletions Source/OIDAuthState.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,28 @@ - (void)didChangeState;
@end


@implementation OIDAuthState

@synthesize refreshToken = _refreshToken;
@synthesize scope = _scope;
@synthesize lastAuthorizationResponse = _lastAuthorizationResponse;
@synthesize lastTokenResponse = _lastTokenResponse;
@synthesize lastRegistrationResponse = _lastRegistrationResponse;
@synthesize authorizationError = _authorizationError;
@synthesize stateChangeDelegate = _stateChangeDelegate;
@synthesize errorDelegate = _errorDelegate;
@implementation OIDAuthState {
/*! @brief Array of pending actions (use @c _pendingActionsSyncObject to synchronize access).
*/
NSMutableArray *_pendingActions;

/*! @brief Object for synchronizing access to @c pendingActions.
*/
id _pendingActionsSyncObject;

/*! @brief If YES, tokens will be refreshed on the next API call regardless of expiry.
*/
BOOL _needsTokenRefresh;
}

#pragma mark - Convenience initializers

+ (id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession>)
+ (id<OIDExternalUserAgentSession>)
authStateByPresentingAuthorizationRequest:(OIDAuthorizationRequest *)authorizationRequest
externalUserAgent:(id<OIDExternalUserAgent>)externalUserAgent
callback:(OIDAuthStateAuthorizationCallback)callback {
// presents the authorization request
id<OIDExternalUserAgentSession, OIDAuthorizationFlowSession> authFlowSession = [OIDAuthorizationService
id<OIDExternalUserAgentSession> authFlowSession = [OIDAuthorizationService
presentAuthorizationRequest:authorizationRequest
externalUserAgent:externalUserAgent
callback:^(OIDAuthorizationResponse *_Nullable authorizationResponse,
Expand Down Expand Up @@ -507,12 +510,6 @@ - (void)performActionWithFreshTokens:(OIDAuthStateAction)action
}];
}

#pragma mark - Deprecated

- (void)withFreshTokensPerformAction:(OIDAuthStateAction)action {
[self performActionWithFreshTokens:action additionalRefreshParameters:nil];
}

#pragma mark -

/*! @fn isTokenFresh
Expand Down
44 changes: 0 additions & 44 deletions Source/OIDAuthorizationFlowSession.h

This file was deleted.

Loading

0 comments on commit 65ef95c

Please sign in to comment.