Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_CLIENT_IOS_FACADE_REMOTING_AUTHENTICATION_H_ | |
| 6 #define REMOTING_CLIENT_IOS_FACADE_REMOTING_AUTHENTICATION_H_ | |
| 7 | |
| 8 #import "remoting/client/chromoting_client_runtime.h" | |
| 9 #import "remoting/client/ios/domain/user_info.h" | |
| 10 | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "remoting/base/oauth_token_getter.h" | |
| 13 | |
| 14 // |RemotingAuthenticationDelegate|s are interested in authentication related | |
| 15 // notifications. | |
| 16 @protocol RemotingAuthenticationDelegate<NSObject> | |
| 17 | |
| 18 // Notifies the delegate that the user has been updated. | |
| 19 - (void)userDidUpdate:(UserInfo*)user; | |
| 20 | |
| 21 @end | |
| 22 | |
| 23 // This is the class that will manage the details around authentication | |
| 24 // management and currently active user. It will make sure the user object is | |
| 25 // saved to the keychain correctly and loaded on startup. It also is the entry | |
| 26 // point for gaining access to an auth token for authrized calls. | |
| 27 @interface RemotingAuthentication : NSObject | |
| 28 | |
| 29 // Provide an |authorizationCode| to authenticate a user as the first time user | |
| 30 // of the application or OAuth Flow. | |
| 31 - (void)authenticateWithAuthorizationCode:(NSString*)authorizationCode; | |
| 32 | |
| 33 // Provide the |refreshToken| and |email| to authenticate a user as a returning | |
| 34 // user of the application. | |
| 35 - (void)authenticateWithRefreshToken:(NSString*)refreshToken | |
| 36 email:(NSString*)email; | |
| 37 | |
| 38 // Fetches an OAuth Access Token and passes it back to the callback. | |
| 39 - (void)callbackWithAccessToken: | |
|
Yuwei
2017/05/04 05:10:14
This method doesn't really fetch the OAuth token i
nicholss
2017/05/08 17:08:10
I think the method name is ok, I added a comment.
| |
| 40 (const remoting::OAuthTokenGetter::TokenCallback&)onAccessToken; | |
| 41 | |
| 42 // Forget the current user. | |
| 43 - (void)logout; | |
| 44 | |
| 45 // Returns the currently logged in user or nil. | |
| 46 @property(strong, nonatomic) UserInfo* user; | |
| 47 | |
| 48 // Delegate recieves updates on user changes. | |
| 49 @property(weak, nonatomic) id<RemotingAuthenticationDelegate> delegate; | |
| 50 | |
| 51 @end | |
| 52 | |
| 53 #endif // REMOTING_CLIENT_IOS_FACADE_REMOTING_AUTHENTICATION_H_ | |
| OLD | NEW |