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" | |
Sergey Ulanov
2013/03/20 07:24:12
Don't need this.
rmsousa
2013/03/21 01:23:25
Done.
| |
13 #include "remoting/protocol/authenticator.h" | |
14 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | |
Sergey Ulanov
2013/03/20 07:24:12
XmlElement can be forward-declared.
rmsousa
2013/03/21 01:23:25
Done.
| |
15 | |
16 namespace remoting { | |
17 | |
18 class RsaKeyPair; | |
Sergey Ulanov
2013/03/20 07:24:12
not used in this file
rmsousa
2013/03/21 01:23:25
Done.
| |
19 | |
20 namespace protocol { | |
21 | |
22 // Implements an authentication method that relies on a third party server for | |
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 virtual ~ThirdPartyAuthenticatorBase(); | |
34 | |
35 // Authenticator interface. | |
36 virtual State state() const OVERRIDE; | |
37 virtual RejectionReason rejection_reason() const OVERRIDE; | |
38 virtual void ProcessMessage(const buzz::XmlElement* message, | |
39 const base::Closure& resume_callback) OVERRIDE; | |
40 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; | |
41 virtual scoped_ptr<ChannelAuthenticator> | |
42 CreateChannelAuthenticator() const OVERRIDE; | |
43 | |
44 protected: | |
45 // XML tag names for third party authentication fields. | |
46 static const buzz::StaticQName kTokenUrlTag; | |
47 static const buzz::StaticQName kTokenScopeTag; | |
48 static const buzz::StaticQName kTokenTag; | |
49 | |
50 explicit ThirdPartyAuthenticatorBase(State initial_state); | |
51 | |
52 // Gives the message to the underlying authenticator for processing. | |
53 void ProcessUnderlyingMessage( | |
54 const buzz::XmlElement* message, | |
55 const base::Closure& resume_callback); | |
56 | |
57 // Processes the token-related elements of the message. | |
58 virtual void ProcessTokenMessage( | |
59 const buzz::XmlElement* message, | |
60 const base::Closure& resume_callback) = 0; | |
61 | |
62 // Adds the token related XML elements to the message. | |
63 virtual void AddTokenElements(buzz::XmlElement* message) = 0; | |
64 | |
65 scoped_ptr<Authenticator> underlying_; | |
66 State token_state_; | |
67 RejectionReason rejection_reason_; | |
68 | |
69 private: | |
70 DISALLOW_COPY_AND_ASSIGN(ThirdPartyAuthenticatorBase); | |
71 }; | |
72 | |
73 } // namespace protocol | |
74 } // namespace remoting | |
75 | |
76 #endif // REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_ | |
OLD | NEW |