-
Notifications
You must be signed in to change notification settings - Fork 142
WIP Feat[MQB]: add authentication with basic logic #696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/groups/bmq/bmqp/bmqp_ctrlmsg.xsd
Outdated
<element name='authenticateRequest' type='tns:AuthenticateRequest'/> | ||
<element name='authenticateResponse' type='tns:AuthenticateResponse'/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From our discussion today, we're leaning toward moving these types to a new, top-level complexType that just contains the authentication protocols.
d923a9d
to
6737422
Compare
fe5f4fb
to
515517d
Compare
InitialConnectionChannelFactoryConfig( | ||
&d_statChannelFactory, | ||
authenticationMessage, | ||
sessionOptions.connectTimeout(), // TODO: different for authn? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a different timeout for authentication?
515517d
to
e6554bf
Compare
Signed-off-by: Emelia Lei <[email protected]>
Signed-off-by: Emelia Lei <[email protected]>
Signed-off-by: Emelia Lei <[email protected]>
Signed-off-by: Emelia Lei <[email protected]>
Signed-off-by: Emelia Lei <[email protected]>
Signed-off-by: Emelia Lei <[email protected]>
Signed-off-by: Emelia Lei <[email protected]>
…ation Signed-off-by: Emelia Lei <[email protected]>
e6554bf
to
cef4a2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Continue looking, but here are some comments
authenticationMessage.makeAuthenticateRequest(); | ||
bsl::string str = "username:password"; | ||
ar.mechanism() = "basic"; | ||
ar.data() = bsl::vector<char>(str.begin(), str.end()); // hexBinary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few notes:
-
Binary hex introduces
+100%
protocol overhead todata.size()
after encoding.
If we usebase64
, we can have+33%
protocol overhead.
Probably it's not a problem, because we don't intend to send authn requests too often and don't want to send too much data here. -
Should binary hex be enforced? If so, it's worth to add checks in both client library (before sending a request) and on the broker side (when request is received).
This also means that"username:password"
data provided here will be rejected. -
Another way to enforce binary hex is to hide it from the library user.
Let the user to just assignbsl::vector<char> data
to anything, and convert it to binary hex when message is packed. -
What variations of capital letters does this hex binary support?
abcdef
,ABCDEF
, or bothabcdefABCDEF
?
@@ -226,7 +226,8 @@ class Application { | |||
const bsl::shared_ptr<bmqp::HeartbeatMonitor>& monitor); | |||
bsl::shared_ptr<bmqp::HeartbeatMonitor> | |||
createMonitor(const bsl::shared_ptr<bmqio::Channel>& channel); | |||
void startHeartbeat(const bsl::shared_ptr<bmqio::Channel>& channel, | |||
void | |||
startHeartbeat(const bsl::shared_ptr<bmqio::Channel>& channel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a formatter bug @dorjesinpo encountered
src/groups/bmq/bmqimp/bmqimp_initialconnectionchannelfactory.cpp
Outdated
Show resolved
Hide resolved
b174b92
to
a191d1e
Compare
Signed-off-by: Emelia Lei <[email protected]>
a191d1e
to
f750a50
Compare
@@ -311,6 +319,7 @@ int SessionUtil::createApplication(SessionImpl* sessionImpl) | |||
sessionImpl->d_application_mp.load( | |||
new (*(sessionImpl->d_allocator_p)) | |||
bmqimp::Application(options, | |||
authenticationMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In its proper form, this probably won't be a concrete object, but rather something user-provided via SessionOptions
that provides a callback to generate the raw information needed to construct this message.
Broker side:
AuthenticationEvent
event type.AuthenticationContext
to encapsulate relevant context data.InitialConnectionHandler
to handle the authentication flow.Client side:
bmqimp_application
to pass in anAuthenticationMessage
.