OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_HOST_THIRD_PARTY_AUTH_CONFIG_H_ |
| 6 #define REMOTING_HOST_THIRD_PARTY_AUTH_CONFIG_H_ |
| 7 |
| 8 #include <ostream> |
| 9 #include <string> |
| 10 |
| 11 #include "url/gurl.h" |
| 12 |
| 13 namespace base { |
| 14 class DictionaryValue; |
| 15 } // namespace base |
| 16 |
| 17 namespace remoting { |
| 18 |
| 19 struct ThirdPartyAuthConfig { |
| 20 GURL token_url; |
| 21 GURL token_validation_url; |
| 22 std::string token_validation_cert_issuer; |
| 23 |
| 24 inline bool is_empty() const { |
| 25 return token_url.is_empty() && token_validation_url.is_empty(); |
| 26 } |
| 27 |
| 28 // Returns false and doesn't modify |out| if parsing fails (i.e. some input |
| 29 // values are invalid). |
| 30 static bool Parse(const std::string& token_url, |
| 31 const std::string& token_validation_url, |
| 32 const std::string& token_validation_cert_issuer, |
| 33 ThirdPartyAuthConfig* out); |
| 34 |
| 35 // Extracts raw (raw = as strings) policy values from |policy_dict|. |
| 36 // Missing policy values are set to an empty string. |
| 37 // Returns false if no ThirdPartyAuthConfig-related policies were present. |
| 38 static bool ExtractPolicyValues(const base::DictionaryValue& policy_dict, |
| 39 std::string* token_url, |
| 40 std::string* token_validation_url, |
| 41 std::string* token_validation_cert_issuer); |
| 42 }; |
| 43 |
| 44 std::ostream& operator<<(std::ostream& os, const ThirdPartyAuthConfig& cfg); |
| 45 |
| 46 } // namespace remoting |
| 47 |
| 48 #endif // REMOTING_HOST_THIRD_PARTY_AUTH_CONFIG_H_ |
OLD | NEW |