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

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

Issue 2854273002: [CRD iOS] Implementing save to keychain and user defaults for login info. Refactor remoting service. (Closed)
Patch Set: Removing authenticate with refresh token from pub api. Created 3 years, 7 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/client/ios/facade/remoting_authentication.h
diff --git a/remoting/client/ios/facade/remoting_authentication.h b/remoting/client/ios/facade/remoting_authentication.h
new file mode 100644
index 0000000000000000000000000000000000000000..1ab7e33aca0a3dd73162525c057942ffed11039b
--- /dev/null
+++ b/remoting/client/ios/facade/remoting_authentication.h
@@ -0,0 +1,51 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_CLIENT_IOS_FACADE_REMOTING_AUTHENTICATION_H_
+#define REMOTING_CLIENT_IOS_FACADE_REMOTING_AUTHENTICATION_H_
+
+#import "remoting/client/chromoting_client_runtime.h"
+#import "remoting/client/ios/domain/user_info.h"
+
+#include "base/memory/weak_ptr.h"
+#include "remoting/base/oauth_token_getter.h"
+
+// |RemotingAuthenticationDelegate|s are interested in authentication related
+// notifications.
+@protocol RemotingAuthenticationDelegate<NSObject>
+
+// Notifies the delegate that the user has been updated.
+- (void)userDidUpdate:(UserInfo*)user;
+
+@end
+
+// This is the class 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;
+
+// Fetches an OAuth 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;
+
+// Forget the current user.
+- (void)logout;
+
+// Returns the currently logged in user or nil.
+@property(strong, nonatomic) UserInfo* user;
+
+// Delegate recieves updates on user changes.
+@property(weak, nonatomic) id<RemotingAuthenticationDelegate> delegate;
+
+@end
+
+#endif // REMOTING_CLIENT_IOS_FACADE_REMOTING_AUTHENTICATION_H_
« no previous file with comments | « remoting/client/ios/facade/host_list_fetcher.cc ('k') | remoting/client/ios/facade/remoting_authentication.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698