jamiewalch | b438fb9d | 2016-02-08 23:20:12 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "remoting/protocol/rejecting_authenticator.h" |
| 6 | |
sergeyu | 64adc27 | 2016-03-12 09:12:43 | [diff] [blame] | 7 | #include "base/callback.h" |
Hans Wennborg | 828a097 | 2020-04-27 18:10:09 | [diff] [blame] | 8 | #include "base/check_op.h" |
| 9 | #include "base/notreached.h" |
jamiewalch | b438fb9d | 2016-02-08 23:20:12 | [diff] [blame] | 10 | #include "remoting/protocol/channel_authenticator.h" |
kjellander | f0e410b | 2017-01-04 14:45:01 | [diff] [blame] | 11 | #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" |
jamiewalch | b438fb9d | 2016-02-08 23:20:12 | [diff] [blame] | 12 | |
Joe Downing | 39d710e | 2022-08-25 20:11:45 | [diff] [blame^] | 13 | namespace remoting::protocol { |
jamiewalch | b438fb9d | 2016-02-08 23:20:12 | [diff] [blame] | 14 | |
| 15 | RejectingAuthenticator::RejectingAuthenticator(RejectionReason rejection_reason) |
| 16 | : rejection_reason_(rejection_reason) { |
| 17 | } |
| 18 | |
| 19 | RejectingAuthenticator::~RejectingAuthenticator() = default; |
| 20 | |
| 21 | Authenticator::State RejectingAuthenticator::state() const { |
| 22 | return state_; |
| 23 | } |
| 24 | bool RejectingAuthenticator::started() const { |
| 25 | return true; |
| 26 | } |
| 27 | |
| 28 | Authenticator::RejectionReason |
| 29 | RejectingAuthenticator::rejection_reason() const { |
| 30 | DCHECK_EQ(state_, REJECTED); |
| 31 | return rejection_reason_; |
| 32 | } |
| 33 | |
| 34 | void RejectingAuthenticator::ProcessMessage( |
Mirko Bonadei | 80d1cea | 2019-01-18 22:22:17 | [diff] [blame] | 35 | const jingle_xmpp::XmlElement* message, |
Evan Stade | ce9372b | 2020-03-12 01:28:16 | [diff] [blame] | 36 | base::OnceClosure resume_callback) { |
jamiewalch | b438fb9d | 2016-02-08 23:20:12 | [diff] [blame] | 37 | DCHECK_EQ(state_, WAITING_MESSAGE); |
| 38 | state_ = REJECTED; |
Evan Stade | ce9372b | 2020-03-12 01:28:16 | [diff] [blame] | 39 | std::move(resume_callback).Run(); |
jamiewalch | b438fb9d | 2016-02-08 23:20:12 | [diff] [blame] | 40 | } |
| 41 | |
Mirko Bonadei | 80d1cea | 2019-01-18 22:22:17 | [diff] [blame] | 42 | std::unique_ptr<jingle_xmpp::XmlElement> RejectingAuthenticator::GetNextMessage() { |
jamiewalch | b438fb9d | 2016-02-08 23:20:12 | [diff] [blame] | 43 | NOTREACHED(); |
| 44 | return nullptr; |
| 45 | } |
| 46 | |
| 47 | const std::string& RejectingAuthenticator::GetAuthKey() const { |
| 48 | NOTREACHED(); |
| 49 | return auth_key_; |
Nico Weber | 7452f1c | 2019-02-11 15:06:17 | [diff] [blame] | 50 | } |
jamiewalch | b438fb9d | 2016-02-08 23:20:12 | [diff] [blame] | 51 | |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 52 | std::unique_ptr<ChannelAuthenticator> |
jamiewalch | b438fb9d | 2016-02-08 23:20:12 | [diff] [blame] | 53 | RejectingAuthenticator::CreateChannelAuthenticator() const { |
| 54 | NOTREACHED(); |
| 55 | return nullptr; |
| 56 | } |
| 57 | |
Joe Downing | 39d710e | 2022-08-25 20:11:45 | [diff] [blame^] | 58 | } // namespace remoting::protocol |