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 // Fetches an OAuth Access Token and passes it back to the callback if | |
34 // the user is authenticated. Otherwise does nothing. | |
35 // TODO(nicholss): We might want to throw an error or add error message to | |
36 // the callback sig to be able to react to the un-authed case. | |
37 - (void)callbackWithAccessToken: | |
38 (const remoting::OAuthTokenGetter::TokenCallback&)onAccessToken; | |
39 | |
40 // Forget the current user. | |
41 - (void)logout; | |
42 | |
43 // Returns the currently logged in user or nil. | |
44 @property(strong, nonatomic) UserInfo* user; | |
45 | |
46 // Delegate recieves updates on user changes. | |
47 @property(weak, nonatomic) id<RemotingAuthenticationDelegate> delegate; | |
48 | |
49 @end | |
50 | |
51 #endif // REMOTING_CLIENT_IOS_FACADE_REMOTING_AUTHENTICATION_H_ | |
OLD | NEW |