[Remoting Mobile] Centralized OAuth Token Getter
This CL:
* Provides an interface in ChromotingClientRuntime to allow mobile client
to fetch OAuth token from a centralized place.
* Provides iOS implementation for the OAuthTokenGetter.
* Passes the token getter to the transport context so that it can be used
to fetch the ice config.
The centralized OAuthTokenGetter will be used for WebRTC protocol and
will also be used for telemetry logging. I'll send a follow up CL to
implement the OAuthTokenGetter for Android and refactor the auth logic
in telemetry logger.
Bug: 780736
Change-Id: I91b6f3dac8271e27b18854daddd52637a0a66add
Reviewed-on: https://chromium-review.googlesource.com/754410
Reviewed-by: Jamie Walch <[email protected]>
Commit-Queue: Yuwei Huang <[email protected]>
Cr-Commit-Position: refs/heads/master@{#515020}
diff --git a/remoting/ios/facade/ios_oauth_token_getter.h b/remoting/ios/facade/ios_oauth_token_getter.h
new file mode 100644
index 0000000..7ac9e1a6
--- /dev/null
+++ b/remoting/ios/facade/ios_oauth_token_getter.h
@@ -0,0 +1,31 @@
+// 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_IOS_FACADE_IOS_OAUTH_TOKEN_GETTER_H_
+#define REMOTING_IOS_FACADE_IOS_OAUTH_TOKEN_GETTER_H_
+
+#include "base/macros.h"
+#include "remoting/base/oauth_token_getter.h"
+
+namespace remoting {
+
+// The OAuthTokenGetter implementation on iOS client that uses
+// RemotingService.instance.authentication to authenticate. Depending on the
+// RemotingAuthentication implementation, this class may be single-threaded.
+class IosOauthTokenGetter : public OAuthTokenGetter {
+ public:
+ IosOauthTokenGetter();
+ ~IosOauthTokenGetter() override;
+
+ // OAuthTokenGetter overrides.
+ void CallWithToken(const TokenCallback& on_access_token) override;
+ void InvalidateCache() override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(IosOauthTokenGetter);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_IOS_FACADE_IOS_OAUTH_TOKEN_GETTER_H_