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

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: Corrected unit test comment. 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..07661571f3bb267a1a6541c2863a9d425d927b49 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 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_policy(POLICY_NONE) {
}
AuthResult::~AuthResult() {
@@ -101,7 +105,12 @@ AuthResult AuthenticateChallengeReply(const CastMessage& challenge_reply,
return result;
}
- return AuthResult();
+ if (response.client_auth_certificate().find(kAudioOnlyPolicy) !=
+ std::string::npos) {
+ result.channel_policy |= AuthResult::POLICY_AUDIO_ONLY;
+ }
+
+ return result;
}
} // namespace cast_channel

Powered by Google App Engine
This is Rietveld 408576698