Index: remoting/host/third_party_auth_config.h |
diff --git a/remoting/host/third_party_auth_config.h b/remoting/host/third_party_auth_config.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c96f2b654d6694c9c7a125757c5633cb60dc3242 |
--- /dev/null |
+++ b/remoting/host/third_party_auth_config.h |
@@ -0,0 +1,48 @@ |
+// Copyright 2015 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_HOST_THIRD_PARTY_AUTH_CONFIG_H_ |
+#define REMOTING_HOST_THIRD_PARTY_AUTH_CONFIG_H_ |
+ |
+#include <ostream> |
+#include <string> |
+ |
+#include "url/gurl.h" |
+ |
+namespace base { |
+class DictionaryValue; |
+} // namespace base |
+ |
+namespace remoting { |
+ |
+struct ThirdPartyAuthConfig { |
+ GURL token_url; |
+ GURL token_validation_url; |
+ std::string token_validation_cert_issuer; |
+ |
+ inline bool is_empty() const { |
+ return token_url.is_empty() && token_validation_url.is_empty(); |
+ } |
+ |
+ // Returns false and doesn't modify |out| if parsing fails (i.e. some input |
+ // values are invalid). |
+ static bool Parse(const std::string& token_url, |
+ const std::string& token_validation_url, |
+ const std::string& token_validation_cert_issuer, |
+ ThirdPartyAuthConfig* out); |
+ |
+ // Extracts raw (raw = as strings) policy values from |policy_dict|. |
+ // Missing policy values are set to an empty string. |
+ // Returns false if no ThirdPartyAuthConfig-related policies were present. |
+ static bool ExtractPolicyValues(const base::DictionaryValue& policy_dict, |
+ std::string* token_url, |
+ std::string* token_validation_url, |
+ std::string* token_validation_cert_issuer); |
+}; |
+ |
+std::ostream& operator<<(std::ostream& os, const ThirdPartyAuthConfig& cfg); |
+ |
+} // namespace remoting |
+ |
+#endif // REMOTING_HOST_THIRD_PARTY_AUTH_CONFIG_H_ |