OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/token_validator_base.h" | 5 #include "remoting/host/token_validator_base.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 void TokenValidatorBase::OnCertificatesSelected( | 140 void TokenValidatorBase::OnCertificatesSelected( |
141 net::CertificateList* selected_certs, | 141 net::CertificateList* selected_certs, |
142 net::ClientCertStore* unused) { | 142 net::ClientCertStore* unused) { |
143 const std::string& issuer = | 143 const std::string& issuer = |
144 third_party_auth_config_.token_validation_cert_issuer; | 144 third_party_auth_config_.token_validation_cert_issuer; |
145 if (request_) { | 145 if (request_) { |
146 for (size_t i = 0; i < selected_certs->size(); ++i) { | 146 for (size_t i = 0; i < selected_certs->size(); ++i) { |
147 if (issuer == kCertIssuerWildCard || | 147 if (issuer == kCertIssuerWildCard || |
148 issuer == (*selected_certs)[i]->issuer().common_name) { | 148 issuer == (*selected_certs)[i]->issuer().common_name) { |
149 request_->ContinueWithCertificate((*selected_certs)[i]); | 149 request_->ContinueWithCertificate((*selected_certs)[i].get()); |
150 return; | 150 return; |
151 } | 151 } |
152 } | 152 } |
153 request_->ContinueWithCertificate(NULL); | 153 request_->ContinueWithCertificate(NULL); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 bool TokenValidatorBase::IsValidScope(const std::string& token_scope) { | 157 bool TokenValidatorBase::IsValidScope(const std::string& token_scope) { |
158 // TODO(rmsousa): Deal with reordering/subsets/supersets/aliases/etc. | 158 // TODO(rmsousa): Deal with reordering/subsets/supersets/aliases/etc. |
159 return token_scope == token_scope_; | 159 return token_scope == token_scope_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 return std::string(); | 192 return std::string(); |
193 } | 193 } |
194 | 194 |
195 std::string shared_secret; | 195 std::string shared_secret; |
196 // Everything is valid, so return the shared secret to the caller. | 196 // Everything is valid, so return the shared secret to the caller. |
197 dict->GetStringWithoutPathExpansion("access_token", &shared_secret); | 197 dict->GetStringWithoutPathExpansion("access_token", &shared_secret); |
198 return shared_secret; | 198 return shared_secret; |
199 } | 199 } |
200 | 200 |
201 } // namespace remoting | 201 } // namespace remoting |
OLD | NEW |