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

Side by Side Diff: trunk/src/remoting/host/token_validator_factory_impl.cc

Issue 101113004: Revert 239759 "The comment in base64.h implies that base::Base64..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/remoting/host/pin_hash.cc ('k') | trunk/src/remoting/protocol/auth_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_factory_impl.h" 5 #include "remoting/host/token_validator_factory_impl.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool IsValidScope(const std::string& token_scope) { 100 bool IsValidScope(const std::string& token_scope) {
101 // TODO(rmsousa): Deal with reordering/subsets/supersets/aliases/etc. 101 // TODO(rmsousa): Deal with reordering/subsets/supersets/aliases/etc.
102 return token_scope == token_scope_; 102 return token_scope == token_scope_;
103 } 103 }
104 104
105 static std::string CreateScope(const std::string& local_jid, 105 static std::string CreateScope(const std::string& local_jid,
106 const std::string& remote_jid) { 106 const std::string& remote_jid) {
107 std::string nonce_bytes; 107 std::string nonce_bytes;
108 crypto::RandBytes(WriteInto(&nonce_bytes, kNonceLength + 1), kNonceLength); 108 crypto::RandBytes(WriteInto(&nonce_bytes, kNonceLength + 1), kNonceLength);
109 std::string nonce; 109 std::string nonce;
110 base::Base64Encode(nonce_bytes, &nonce); 110 bool success = base::Base64Encode(nonce_bytes, &nonce);
111 DCHECK(success);
111 return "client:" + remote_jid + " host:" + local_jid + " nonce:" + nonce; 112 return "client:" + remote_jid + " host:" + local_jid + " nonce:" + nonce;
112 } 113 }
113 114
114 std::string ProcessResponse() { 115 std::string ProcessResponse() {
115 // Verify that we got a successful response. 116 // Verify that we got a successful response.
116 net::URLRequestStatus status = request_->GetStatus(); 117 net::URLRequestStatus status = request_->GetStatus();
117 if (!status.is_success()) { 118 if (!status.is_success()) {
118 LOG(ERROR) << "Error validating token, status=" << status.status() 119 LOG(ERROR) << "Error validating token, status=" << status.status()
119 << " err=" << status.error(); 120 << " err=" << status.error();
120 return std::string(); 121 return std::string();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 TokenValidatorFactoryImpl::CreateTokenValidator( 182 TokenValidatorFactoryImpl::CreateTokenValidator(
182 const std::string& local_jid, 183 const std::string& local_jid,
183 const std::string& remote_jid) { 184 const std::string& remote_jid) {
184 return scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidator>( 185 return scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidator>(
185 new TokenValidatorImpl(token_url_, token_validation_url_, key_pair_, 186 new TokenValidatorImpl(token_url_, token_validation_url_, key_pair_,
186 local_jid, remote_jid, 187 local_jid, remote_jid,
187 request_context_getter_)); 188 request_context_getter_));
188 } 189 }
189 190
190 } // namespace remoting 191 } // namespace remoting
OLDNEW
« no previous file with comments | « trunk/src/remoting/host/pin_hash.cc ('k') | trunk/src/remoting/protocol/auth_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698