summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/rejecting_authenticator.h
blob: cced70dbc6fd129667fc9a4d22cf5d1a0d0e9e47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_FACTORY_H_
#define REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_FACTORY_H_

#include <string>

#include "remoting/protocol/authenticator.h"

namespace remoting {
namespace protocol {

// Authenticator that accepts one message and rejects connection after that.
class RejectingAuthenticator : public Authenticator {
 public:
  RejectingAuthenticator(RejectionReason rejection_reason);
  ~RejectingAuthenticator() override;

  // Authenticator interface
  State state() const override;
  bool started() const override;
  RejectionReason rejection_reason() const override;
  void ProcessMessage(const buzz::XmlElement* message,
                      const base::Closure& resume_callback) override;
  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
  const std::string& GetAuthKey() const override;
  scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override;

 private:
  RejectionReason rejection_reason_;
  State state_ = WAITING_MESSAGE;
  std::string auth_key_;

  DISALLOW_COPY_AND_ASSIGN(RejectingAuthenticator);
};

}  // namespace protocol
}  // namespace remoting

#endif  // REMOTING_PROTOCOL_REJECTING_AUTHENTICATOR_FACTORY_H_