OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_ | |
6 #define REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/callback.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "googleurl/src/gurl.h" | |
13 #include "remoting/protocol/authenticator.h" | |
14 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | |
15 | |
16 namespace remoting { | |
17 | |
18 class RsaKeyPair; | |
19 | |
20 namespace protocol { | |
21 | |
22 // Implements an authentication method that relies on a third party server for | |
Sergey Ulanov
2013/03/07 21:20:41
Update comments?
| |
23 // authentication of both client and host. | |
24 // When third party authentication is being used, the client must request both a | |
25 // token and a shared secret from a third-party server (which may require the | |
26 // user to authenticate themselves). The client then sends only the token to the | |
27 // host. The host signs the token, then contacts the third-party server to | |
28 // exchange the token for the shared secret. Once both client and host have the | |
29 // shared secret, they use an underlying |V2Authenticator| (SPAKE2) to negotiate | |
30 // an authentication key, which is used to establish the connection. | |
31 class ThirdPartyAuthenticatorBase : public Authenticator { | |
32 public: | |
33 // XML tag names for third party authentication fields. | |
Sergey Ulanov
2013/03/07 21:20:41
Do they need to be public?
| |
34 static const buzz::StaticQName kTokenUrlTag; | |
35 static const buzz::StaticQName kTokenScopeTag; | |
36 static const buzz::StaticQName kTokenTag; | |
37 | |
38 virtual ~ThirdPartyAuthenticatorBase(); | |
39 | |
40 // Authenticator interface. | |
41 virtual State state() const OVERRIDE; | |
42 virtual RejectionReason rejection_reason() const OVERRIDE; | |
43 virtual void ProcessMessage(const buzz::XmlElement* message, | |
44 const base::Closure& resume_callback) OVERRIDE; | |
45 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; | |
46 virtual scoped_ptr<ChannelAuthenticator> | |
47 CreateChannelAuthenticator() const OVERRIDE; | |
48 | |
49 protected: | |
50 explicit ThirdPartyAuthenticatorBase(State initial_state); | |
51 void ProcessUnderlyingMessage( | |
52 const buzz::XmlElement* message, | |
53 const base::Closure& resume_callback); | |
54 virtual void ProcessMessageInternal( | |
55 const buzz::XmlElement* message, | |
56 const base::Closure& resume_callback) = 0; | |
57 virtual void GetNextMessageInternal(buzz::XmlElement* message) = 0; | |
58 | |
59 // Used for both host and client authenticators. | |
60 scoped_ptr<Authenticator> underlying_; | |
61 State state_; | |
62 RejectionReason rejection_reason_; | |
63 | |
64 private: | |
65 DISALLOW_COPY_AND_ASSIGN(ThirdPartyAuthenticatorBase); | |
66 }; | |
67 | |
68 } // namespace protocol | |
69 } // namespace remoting | |
70 | |
71 #endif // REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_ | |
OLD | NEW |