@@ -57,56 +57,18 @@ class Dispatcher;
57
57
58
58
namespace mqba {
59
59
60
- // =======================
60
+ // ===================
61
61
// class Authenticator
62
- // =======================
62
+ // ===================
63
63
64
64
// / Authenticator for a BlazingMQ session with client or broker
65
65
class Authenticator : public mqbnet ::Authenticator {
66
66
public:
67
67
// TYPES
68
68
69
69
private:
70
- // PRIVATE TYPES
71
- struct ConnectionType {
72
- // Enum representing the type of session being negotiated, from that
73
- // side of the connection's point of view.
74
- enum Enum {
75
- e_UNKNOWN,
76
- e_CLUSTER_PROXY, // Reverse connection proxy -> broker
77
- e_CLUSTER_MEMBER, // Cluster node -> cluster node
78
- e_CLIENT, // Either SDK or Proxy -> Proxy or cluster node
79
- e_ADMIN
80
- };
81
- };
82
-
83
- // / Struct used to hold the context associated to a session being
84
- // / negotiated
85
- struct AuthenticationContext {
86
- // PUBLIC DATA
87
-
88
- // / The associated authenticatorContext, passed in by the caller.
89
- mqbnet::AuthenticatorContext* d_authenticatorContext_p;
90
-
91
- // / The channel to use for the authentication.
92
- bsl::shared_ptr<bmqio::Channel> d_channelSp;
93
-
94
- // / The callback to invoke to notify of the status of the
95
- // / authentication.
96
- mqbnet::Authenticator::AuthenticationCb d_authenticationCb;
97
-
98
- // / The negotiation message received from the remote peer.
99
- bmqp_ctrlmsg::NegotiationMessage d_authenticationMessage;
100
-
101
- // / True if this is a "reversed" connection (on either side of the
102
- // / connection).
103
- bool d_isReversed;
104
-
105
- // / The type of the session being negotiated.
106
- ConnectionType::Enum d_connectionType;
107
- };
108
-
109
- typedef bsl::shared_ptr<AuthenticationContext> AuthenticationContextSp;
70
+ typedef bsl::shared_ptr<mqbnet::AuthenticationContext>
71
+ AuthenticationContextSp;
110
72
111
73
private:
112
74
// DATA
@@ -127,33 +89,14 @@ class Authenticator : public mqbnet::Authenticator {
127
89
private:
128
90
// PRIVATE MANIPULATORS
129
91
130
- // / Read callback method invoked when receiving data in the specified
131
- // / `blob`, if the specified `status` indicates success. The specified
132
- // / `numNeeded` can be used to indicate if more bytes are needed in
133
- // / order to get a full message. The specified `context` holds the
134
- // / negotiation context associated to this read.
135
- void readCallback (const bmqio::Status& status,
136
- int * numNeeded,
137
- bdlbb::Blob* blob,
138
- const AuthenticationContextSp& context);
139
-
140
- // / Decode the negotiation messages received in the specified `blob` and
141
- // / store it, on success, in the corresponding member of the specified
142
- // / `context`, returning 0. Return a non-zero code on error and
143
- // / populate the specified `errorDescription` with a description of the
144
- // / error.
145
- int decodeNegotiationMessage (bsl::ostream& errorDescription,
146
- const AuthenticationContextSp& context,
147
- const bdlbb::Blob& blob);
148
-
149
- // / Invoked when received a `ClientIdentity` negotiation message with
92
+ // / Invoked when received a `ClientIdentity` authentication message with
150
93
// / the specified `context`. Creates and return a Session on success,
151
94
// / or return a null pointer and populate the specified
152
95
// / `errorDescription` with a description of the error on failure.
153
96
int onAuthenticationRequest (bsl::ostream& errorDescription,
154
97
const AuthenticationContextSp& context);
155
98
156
- // / Invoked when received a `BrokerResponse` negotiation message with
99
+ // / Invoked when received a `BrokerResponse` authentication message with
157
100
// / the specified `context`. Creates and return a Session on success,
158
101
// / or return a null pointer and populate the specified
159
102
// / `errorDescription` with a description of the error on failure.
@@ -164,22 +107,18 @@ class Authenticator : public mqbnet::Authenticator {
164
107
// / specified `context` and return 0 on success, or return a non-zero
165
108
// / code on error and populate the specified `errorDescription` with a
166
109
// / description of the error.
167
- int
168
- sendAuthenticationMessage ( bsl::ostream& errorDescription,
169
- const bmqp_ctrlmsg::NegotiationMessage & message,
170
- const AuthenticationContextSp& context);
110
+ int sendAuthenticationMessage (
111
+ bsl::ostream& errorDescription,
112
+ const bmqp_ctrlmsg::AuthenticationMessage & message,
113
+ const AuthenticationContextSp& context);
171
114
172
- // / Initiate an outbound negotiation (i.e., send out some negotiation
115
+ // / Initiate an outbound authentication (i.e., send out some authentication
173
116
// / message and schedule a read of the response) using the specified
174
117
// / `context`.
175
118
// / Senario: reverse connection
176
119
void
177
120
initiateOutboundAuthentication (const AuthenticationContextSp& context);
178
121
179
- // / Schedule a read for the negotiation of the session of the specified
180
- // / `context`.
181
- void scheduleRead (const AuthenticationContextSp& context);
182
-
183
122
public:
184
123
// TRAITS
185
124
BSLMF_NESTED_TRAIT_DECLARATION (Authenticator, bslma::UsesBslmaAllocator)
@@ -205,25 +144,19 @@ class Authenticator : public mqbnet::Authenticator {
205
144
// MANIPULATORS
206
145
// (virtual: mqbnet::Authenticator)
207
146
208
- // / Negotiate the connection on the specified `channel` associated with
209
- // / the specified negotiation `context` and invoke the specified
210
- // / `negotiationCb` once the negotiation is complete (either success or
211
- // / failure). Note that if no negotiation are needed, the
212
- // / `negotiationCb` may be invoked directly from inside the call to
213
- // / `negotiate`.
214
- void authenticate (mqbnet::AuthenticatorContext* context,
215
- const bsl::shared_ptr<bmqio::Channel>& channel,
216
- const mqbnet::Authenticator::AuthenticationCb&
217
- authenticationCb) BSLS_KEYWORD_OVERRIDE;
147
+ // / Send out outbound authentication message or reverse connection request
148
+ // / with the specified `context`.
149
+ int authenticationOutboundOrReverse (const AuthenticationContextSp& context)
150
+ BSLS_KEYWORD_OVERRIDE;
218
151
};
219
152
220
153
// ============================================================================
221
154
// INLINE DEFINITIONS
222
155
// ============================================================================
223
156
224
- // -----------------------
157
+ // -------------------
225
158
// class Authenticator
226
- // -----------------------
159
+ // -------------------
227
160
228
161
inline Authenticator&
229
162
Authenticator::setClusterCatalog (mqbblp::ClusterCatalog* value)
0 commit comments