Commit b42c3869 authored by Bruno Kim Medeiros Cesar's avatar Bruno Kim Medeiros Cesar Committed by Commit Bot

Ignore IdToken child result if USM accounts are supported.

The "usm" service flag is not sent in IdToken. After USM support is
launched, we'll want to delete this setting entirely.

Bug: 836246
Change-Id: I4981132619ff1bd580bd10a6a47d7aa088394825
Reviewed-on: https://chromium-review.googlesource.com/1059457Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Bruno Kim Medeiros Cesar <brunokim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559053}
parent 725c78df
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/login/signin/oauth2_token_initializer.h" #include "chrome/browser/chromeos/login/signin/oauth2_token_initializer.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_features.h"
namespace chromeos { namespace chromeos {
...@@ -31,11 +32,14 @@ void OAuth2TokenInitializer::OnOAuth2TokensAvailable( ...@@ -31,11 +32,14 @@ void OAuth2TokenInitializer::OnOAuth2TokensAvailable(
user_context_.SetAuthCode(std::string()); user_context_.SetAuthCode(std::string());
user_context_.SetRefreshToken(result.refresh_token); user_context_.SetRefreshToken(result.refresh_token);
user_context_.SetAccessToken(result.access_token); user_context_.SetAccessToken(result.access_token);
const bool support_usm =
base::FeatureList::IsEnabled(features::kCrOSEnableUSMUserService);
if (result.is_child_account && if (result.is_child_account &&
user_context_.GetUserType() != user_manager::USER_TYPE_CHILD) { user_context_.GetUserType() != user_manager::USER_TYPE_CHILD) {
LOG(FATAL) << "Incorrect child user type " << user_context_.GetUserType(); LOG(FATAL) << "Incorrect child user type " << user_context_.GetUserType();
} else if (user_context_.GetUserType() == user_manager::USER_TYPE_CHILD && } else if (user_context_.GetUserType() == user_manager::USER_TYPE_CHILD &&
!result.is_child_account) { !result.is_child_account && !support_usm) {
LOG(FATAL) << "Incorrect non-child token for the child user."; LOG(FATAL) << "Incorrect non-child token for the child user.";
} }
callback_.Run(true, user_context_); callback_.Run(true, user_context_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment