Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: extensions/browser/api/cast_channel/cast_auth_util.cc

Issue 807723004: Cast audio only policy enforcement support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed windows compiler warning Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/cast_channel/cast_auth_util.cc
diff --git a/extensions/browser/api/cast_channel/cast_auth_util.cc b/extensions/browser/api/cast_channel/cast_auth_util.cc
index 68cb9f321fccacae26cb9724966405155d1c8735..e863a57dc3f84d8ea5a7f903889fb7bc01bfd36c 100644
--- a/extensions/browser/api/cast_channel/cast_auth_util.cc
+++ b/extensions/browser/api/cast_channel/cast_auth_util.cc
@@ -17,6 +17,9 @@ namespace {
const char* const kParseErrorPrefix = "Failed to parse auth message: ";
+const unsigned char kAudioOnlyPolicy[] =
+ {0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0xD6, 0x79, 0x02, 0x05, 0x02};
+
// Extracts an embedded DeviceAuthMessage payload from an auth challenge reply
// message.
AuthResult ParseAuthMessage(const CastMessage& challenge_reply,
@@ -54,7 +57,8 @@ AuthResult ParseAuthMessage(const CastMessage& challenge_reply,
} // namespace
-AuthResult::AuthResult() : error_type(ERROR_NONE), nss_error_code(0) {
+AuthResult::AuthResult()
+ : error_type(ERROR_NONE), nss_error_code(0), channel_policies(POLICY_NONE) {
}
AuthResult::~AuthResult() {
@@ -101,7 +105,12 @@ AuthResult AuthenticateChallengeReply(const CastMessage& challenge_reply,
return result;
}
- return AuthResult();
+ if (response.client_auth_certificate().find(reinterpret_cast<const char*>(
+ kAudioOnlyPolicy)) != std::string::npos) {
+ result.channel_policies |= AuthResult::POLICY_AUDIO_ONLY;
+ }
+
+ return result;
}
} // namespace cast_channel
« no previous file with comments | « extensions/browser/api/cast_channel/cast_auth_util.h ('k') | extensions/browser/api/cast_channel/cast_channel_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698