blob: ad4b695f76d62c1f5a035138887f4c3b9607a847 [file] [log] [blame]
jamiewalchb438fb9d2016-02-08 23:20:121// 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
sergeyu64adc272016-03-12 09:12:437#include "base/callback.h"
Hans Wennborg828a0972020-04-27 18:10:098#include "base/check_op.h"
9#include "base/notreached.h"
jamiewalchb438fb9d2016-02-08 23:20:1210#include "remoting/protocol/channel_authenticator.h"
kjellanderf0e410b2017-01-04 14:45:0111#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
jamiewalchb438fb9d2016-02-08 23:20:1212
Joe Downing39d710e2022-08-25 20:11:4513namespace remoting::protocol {
jamiewalchb438fb9d2016-02-08 23:20:1214
15RejectingAuthenticator::RejectingAuthenticator(RejectionReason rejection_reason)
16 : rejection_reason_(rejection_reason) {
17}
18
19RejectingAuthenticator::~RejectingAuthenticator() = default;
20
21Authenticator::State RejectingAuthenticator::state() const {
22 return state_;
23}
24bool RejectingAuthenticator::started() const {
25 return true;
26}
27
28Authenticator::RejectionReason
29RejectingAuthenticator::rejection_reason() const {
30 DCHECK_EQ(state_, REJECTED);
31 return rejection_reason_;
32}
33
34void RejectingAuthenticator::ProcessMessage(
Mirko Bonadei80d1cea2019-01-18 22:22:1735 const jingle_xmpp::XmlElement* message,
Evan Stadece9372b2020-03-12 01:28:1636 base::OnceClosure resume_callback) {
jamiewalchb438fb9d2016-02-08 23:20:1237 DCHECK_EQ(state_, WAITING_MESSAGE);
38 state_ = REJECTED;
Evan Stadece9372b2020-03-12 01:28:1639 std::move(resume_callback).Run();
jamiewalchb438fb9d2016-02-08 23:20:1240}
41
Mirko Bonadei80d1cea2019-01-18 22:22:1742std::unique_ptr<jingle_xmpp::XmlElement> RejectingAuthenticator::GetNextMessage() {
jamiewalchb438fb9d2016-02-08 23:20:1243 NOTREACHED();
44 return nullptr;
45}
46
47const std::string& RejectingAuthenticator::GetAuthKey() const {
48 NOTREACHED();
49 return auth_key_;
Nico Weber7452f1c2019-02-11 15:06:1750}
jamiewalchb438fb9d2016-02-08 23:20:1251
dcheng0765c492016-04-06 22:41:5352std::unique_ptr<ChannelAuthenticator>
jamiewalchb438fb9d2016-02-08 23:20:1253RejectingAuthenticator::CreateChannelAuthenticator() const {
54 NOTREACHED();
55 return nullptr;
56}
57
Joe Downing39d710e2022-08-25 20:11:4558} // namespace remoting::protocol