Chromium Code Reviews| 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..c76e4f073b0d5278388aaede354b056693eefebd |
| --- /dev/null |
| +++ b/remoting/client/ios/facade/remoting_authentication.h |
| @@ -0,0 +1,53 @@ |
| +// 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; |
| + |
| +// Provide the |refreshToken| and |email| to authenticate a user as a returning |
| +// user of the application. |
| +- (void)authenticateWithRefreshToken:(NSString*)refreshToken |
| + email:(NSString*)email; |
| + |
| +// Fetches an OAuth Access Token and passes it back to the callback. |
| +- (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.
|
| + (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_ |