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

Unified Diff: remoting/protocol/validating_authenticator.h

Issue 2724223003: Disconnect all users if too many connection requests are received for It2Me (Closed)
Patch Set: Addressing CR Feedback Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/jingle_session.cc ('k') | remoting/protocol/validating_authenticator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/validating_authenticator.h
diff --git a/remoting/protocol/validating_authenticator.h b/remoting/protocol/validating_authenticator.h
index 73f5d953166d57df385e286901fed0db3d504b80..6ebe5f9654bc50c0509f860f4174792108cfcb53 100644
--- a/remoting/protocol/validating_authenticator.h
+++ b/remoting/protocol/validating_authenticator.h
@@ -19,17 +19,16 @@ namespace protocol {
// This authenticator class provides a way to check the validity of a connection
// as it is being established through an asynchronous callback. The validation
-// logic supplied by the caller is run when the first message is received from
-// the client. If the connection details are valid (e.g. conform to the current
-// policies), then the initial message, and all subsequent messages, are passed
-// to the underlying authenticator instance for processing.
+// logic supplied by the caller is run once the underlying authenticator(s) have
+// accepted the connection.
class ValidatingAuthenticator : public Authenticator {
public:
enum class Result {
SUCCESS,
ERROR_INVALID_CREDENTIALS,
ERROR_INVALID_ACCOUNT,
- ERROR_REJECTED_BY_USER
+ ERROR_REJECTED_BY_USER,
+ ERROR_TOO_MANY_CONNECTIONS
};
typedef base::Callback<void(Result validation_result)> ResultCallback;
@@ -55,22 +54,18 @@ class ValidatingAuthenticator : public Authenticator {
std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
private:
- // Checks |validation_result|. On success, |message| and |resume_callback|
- // are passed on to |current_authenticator_|. If the connection was rejected,
- // |state_| and |rejection_reason_| are updated and |resume_callback| is run.
- void OnValidateComplete(const buzz::XmlElement* message,
- const base::Closure& resume_callback,
- Result validation_result);
+ // Checks |result|. If the connection was rejected, |state_| and
+ // |rejection_reason_| are updated. |callback| is always run.
+ void OnValidateComplete(const base::Closure& callback, Result result);
// Updates |state_| to reflect the current underlying authenticator state.
// |resume_callback| is called after the state is updated.
void UpdateState(const base::Closure& resume_callback);
- bool first_message_received_ = false;
-
// The JID of the remote user.
std::string remote_jid_;
+ // Called for validation of incoming connection requests.
ValidationCallback validation_callback_;
// Returns the current state of the authenticator.
@@ -81,6 +76,8 @@ class ValidatingAuthenticator : public Authenticator {
std::unique_ptr<Authenticator> current_authenticator_;
+ std::unique_ptr<buzz::XmlElement> pending_auth_message_;
+
base::WeakPtrFactory<ValidatingAuthenticator> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ValidatingAuthenticator);
« no previous file with comments | « remoting/protocol/jingle_session.cc ('k') | remoting/protocol/validating_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698