Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Unified Diff: remoting/ios/facade/remoting_authentication.h

Issue 2949713002: [CRD iOS] Refactor an interface for RemotingAuthorization (Closed)
Patch Set: Resolve feedback Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/ios/facade/remoting_authentication.h
diff --git a/remoting/ios/facade/remoting_authentication.h b/remoting/ios/facade/remoting_authentication.h
index 5eeed4f4925a167cf319cfde33edf92a26cec099..92e0fc79340187102579616fa847d8c11bc87859 100644
--- a/remoting/ios/facade/remoting_authentication.h
+++ b/remoting/ios/facade/remoting_authentication.h
@@ -5,11 +5,19 @@
#ifndef REMOTING_IOS_FACADE_REMOTING_AUTHENTICATION_H_
#define REMOTING_IOS_FACADE_REMOTING_AUTHENTICATION_H_
-#import "remoting/client/chromoting_client_runtime.h"
#import "remoting/ios/domain/user_info.h"
#include "base/memory/weak_ptr.h"
-#include "remoting/base/oauth_token_getter.h"
+
+typedef NS_ENUM(NSInteger, RemotingAuthenticationStatus) {
+ RemotingAuthenticationStatusSuccess,
+ RemotingAuthenticationStatusNetworkError,
+ RemotingAuthenticationStatusAuthError
+};
+
+typedef void (^AccessTokenCallback)(RemotingAuthenticationStatus status,
+ NSString* userEmail,
+ NSString* accessToken);
// |RemotingAuthenticationDelegate|s are interested in authentication related
// notifications.
@@ -20,28 +28,23 @@
@end
-// This is the class that will manage the details around authentication
+// This is the interface that will manage the details around authentication
// management and currently active user. It will make sure the user object is
// saved to the keychain correctly and loaded on startup. It also is the entry
// point for gaining access to an auth token for authrized calls.
-@interface RemotingAuthentication : NSObject
-
-// Provide an |authorizationCode| to authenticate a user as the first time user
-// of the application or OAuth Flow.
-- (void)authenticateWithAuthorizationCode:(NSString*)authorizationCode;
+@protocol RemotingAuthentication<NSObject>
-// Fetches an OAuth Access Token and passes it back to the callback if
-// the user is authenticated. Otherwise does nothing.
+// Fetches an Access Token and passes it back to the callback if the user is
+// authenticated. Otherwise does nothing.
// TODO(nicholss): We might want to throw an error or add error message to
// the callback sig to be able to react to the un-authed case.
-- (void)callbackWithAccessToken:
- (const remoting::OAuthTokenGetter::TokenCallback&)onAccessToken;
+- (void)callbackWithAccessToken:(AccessTokenCallback)onAccessToken;
// Forget the current user.
- (void)logout;
// Returns the currently logged in user or nil.
-@property(strong, nonatomic) UserInfo* user;
+@property(strong, nonatomic, readonly) UserInfo* user;
// Delegate recieves updates on user changes.
@property(weak, nonatomic) id<RemotingAuthenticationDelegate> delegate;

Powered by Google App Engine
This is Rietveld 408576698