Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
960bc31
Feat[MQB]: Add authn plugin config and controller (#740)
emelialei88 May 29, 2025
2879947
added int test for authn
emelialei88 Jun 3, 2025
1d6b2d6
use plugin to authenticate
emelialei88 Jun 3, 2025
d5db94a
added reauthentication
emelialei88 Jun 10, 2025
36074de
fix format and get other IT to work
emelialei88 Jun 25, 2025
4b038c7
add bmqauthnbasic plugin and more tests for reauthn
emelialei88 Jun 23, 2025
097580b
WIP: default credential
emelialei88 Jun 26, 2025
f4a216e
convert NegotiationContext to VST class
emelialei88 Jun 27, 2025
8c82b8d
continue default credential
emelialei88 Jun 27, 2025
91dec02
remove isContinueRead for negotiator
emelialei88 Jun 30, 2025
5147203
fix for default credential
emelialei88 Jul 7, 2025
2c2c114
add anonymous credential
emelialei88 Jul 8, 2025
4b852cc
remove an unused function
emelialei88 Jul 9, 2025
4bd63c7
fix negotiation for default credential
emelialei88 Jul 10, 2025
e64856e
minor fix
emelialei88 Jul 10, 2025
3a3adfb
make transportmanager own negotiator
emelialei88 Jul 11, 2025
8216aaf
fix clientsession.t no AuthenticationContext
emelialei88 Jul 11, 2025
38422b1
remove isContinueRead
emelialei88 Jul 16, 2025
f131434
minor fix on IT, comment, header
emelialei88 Jul 16, 2025
0712a0a
create function handleNegotiationMessage
emelialei88 Jul 16, 2025
fcf03ed
add handling adminclient
emelialei88 Jul 16, 2025
e3603fb
adding scheduler/timer; change reauthenticate to look similar as auth…
emelialei88 Jul 18, 2025
9c6dea4
refactor (re)authenticate to reduce duplication
emelialei88 Jul 21, 2025
3e1a3e8
add domain_urls
emelialei88 Jul 21, 2025
368ee32
change desc of lifetimeMs
emelialei88 Jul 22, 2025
b76c606
update IT to process heartbeat req
emelialei88 Jul 24, 2025
0ec222a
cancel reauthn timer when a channel closes
emelialei88 Jul 24, 2025
3e4d615
add a pass IT for reauthn
emelialei88 Jul 24, 2025
5bf5ce0
minor fix
emelialei88 Jul 30, 2025
050df90
addressing PR feedback
emelialei88 Aug 5, 2025
5dc5c22
add CLOSED state to AuthenticationContext
emelialei88 Aug 20, 2025
a3bf6a9
add state to initialconnectionhandler
emelialei88 Aug 7, 2025
4a7c7f7
fix for handleEvent
emelialei88 Aug 20, 2025
bafed6a
add more log
emelialei88 Aug 13, 2025
060d37c
use scheduler from application
emelialei88 Aug 28, 2025
45aac28
attempt to fix build sanitizer issue for plugin
emelialei88 Sep 4, 2025
be64135
PR feedback: unlock guard before complete
emelialei88 Sep 25, 2025
abe2eb1
PR feedback: make TCPSessionFactory handle reauthn event
emelialei88 Sep 25, 2025
4cfd279
PR feedback: call reauthn directly
emelialei88 Sep 25, 2025
297a475
PR feedback: negotiationContext ctor
emelialei88 Sep 25, 2025
5df945a
PR feedback: race - scheduled reauthn and close
emelialei88 Sep 26, 2025
21d3296
AuthenticationContext merge mutex
emelialei88 Sep 29, 2025
0814f5d
move functions from InitialConnectionHandler to context
emelialei88 Sep 29, 2025
1ad490e
rawclient able to send bytes
emelialei88 Oct 1, 2025
bc464b6
change lifetimeMs to nonNegative
emelialei88 Oct 1, 2025
3e1dd14
address feedback: grammar and format
emelialei88 Oct 2, 2025
7eb632a
protect d_nbActiveChannels
emelialei88 Oct 2, 2025
524583f
address feedback: more grammar and format
emelialei88 Oct 3, 2025
899a9ea
address feedback
emelialei88 Oct 16, 2025
231a7ab
address feedback: cache initialConnectionContext
emelialei88 Oct 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: ./.github/workflows/build-ubuntu.yaml
with:
ref: ${{ github.sha }}
target: "bmqbrkr bmqtool bmqstoragetool all.it bmqauthnpass bmqauthnfail"
target: "bmqbrkr bmqtool bmqstoragetool all.it bmqauthnpass bmqauthnfail bmqauthnbasic"
save_build_as_artifacts: true
run_unit_tests: false

Expand Down Expand Up @@ -202,6 +202,7 @@ jobs:
name: Sanitize
uses: ./.github/workflows/sanitize.yaml
needs: integration_tests_ubuntu
if: ${{ !cancelled() }} # runs on success or failure

integration_tests_storagetool_ubuntu:
name: IT [Storage tool]
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ if (NOT DEFINED INSTALL_TARGETS)
set(BMQ_TARGET_FUZZTESTS_NEEDED NO)
set(BMQ_TARGET_AUTHNPASS_NEEDED YES)
set(BMQ_TARGET_AUTHNFAIL_NEEDED YES)
set(BMQ_TARGET_AUTHNBASIC_NEEDED YES)
else()
bbproject_check_install_target("bmqbrkr" installBMQBRKR)
bbproject_check_install_target("BMQBRKR_NIGHTLY" installNightly)
Expand All @@ -152,6 +153,7 @@ else()
set(BMQ_TARGET_FUZZTESTS_NEEDED NO)
set(BMQ_TARGET_AUTHNPASS_NEEDED NO)
set(BMQ_TARGET_AUTHNFAIL_NEEDED NO)
set(BMQ_TARGET_AUTHNBASIC_NEEDED NO)

bbproject_check_install_target("bmq" installBMQ)
bbproject_check_install_target("mqb" installMQB)
Expand All @@ -162,6 +164,7 @@ else()
bbproject_check_install_target("fuzztests" installFUZZTESTS)
bbproject_check_install_target("authnpass" installAUTHNPASS)
bbproject_check_install_target("authnfail" installAUTHNFAIL)
bbproject_check_install_target("authnbasic" installAUTHNBASIC)

if (installBMQ)
set(BMQ_TARGET_BMQ_NEEDED YES)
Expand Down Expand Up @@ -218,6 +221,12 @@ else()
set(BMQ_TARGET_MQB_NEEDED YES)
set(BMQ_TARGET_AUTHNFAIL_NEEDED YES)
endif()

if (installAUTHNBASIC)
set(BMQ_TARGET_BMQ_NEEDED YES)
set(BMQ_TARGET_MQB_NEEDED YES)
set(BMQ_TARGET_AUTHNBASIC_NEEDED YES)
endif()
endif()

find_package(Git)
Expand Down
2 changes: 1 addition & 1 deletion bin/build-darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ CMAKE_OPTIONS=(\

PKG_CONFIG_PATH="${DIR_INSTALL}/lib/pkgconfig:${BREW_PKG_CONFIG_PATH}" \
cmake -B "${DIR_BUILD}/blazingmq" -S "${DIR_ROOT}" "${CMAKE_OPTIONS[@]}"
cmake --build "${DIR_BUILD}/blazingmq" --parallel 16 --target bmqbrkr bmqtool all.it bmqauthnpass bmqauthnfail
cmake --build "${DIR_BUILD}/blazingmq" --parallel 16 --target bmqbrkr bmqtool all.it bmqauthnpass bmqauthnfail bmqauthnbasic

echo broker is here: "${DIR_BUILD}/blazingmq/src/applications/bmqbrkr/bmqbrkr.tsk"
echo to run the broker: "${DIR_BUILD}/blazingmq/src/applications/bmqbrkr/run"
Expand Down
12 changes: 6 additions & 6 deletions docker/sanitizers/build_sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ apt-get install -qy cmake

# Install LLVM
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
chmod +x llvm.sh
LLVM_VERSION=18
LLVM_TAG="llvmorg-18.1.8"
./llvm.sh ${LLVM_VERSION} all

# Create version-agnostic pointers to required LLVM binaries.
ln -sf /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang
ln -sf /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++
ln -sf /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++
ln -sf /usr/bin/llvm-symbolizer-${LLVM_VERSION} /usr/bin/llvm-symbolizer

# Set some initial constants
Expand Down Expand Up @@ -198,7 +198,7 @@ export PATH

# Build BDE + NTF
pushd "${DIR_SRCS_EXT}/bde"
eval "$(bbs_build_env -p clang -u dbg_64_safe_cpp20 -b "${DIR_BUILD_EXT}/bde")"
eval "$(bbs_build_env -p clang -u dbg_64_safe_cpp20_pic -b "${DIR_BUILD_EXT}/bde")"
bbs_build configure --toolchain "${TOOLCHAIN_PATH}"
bbs_build build -j${PARALLELISM}
bbs_build --install=/opt/bb --prefix=/ install
Expand All @@ -216,7 +216,7 @@ sed -i 's/fcoroutines-ts/fcoroutines/g' 'repository.cmake'
--without-warnings-as-errors \
--without-usage-examples \
--without-applications \
--ufid 'dbg_64_safe_cpp20' \
--ufid 'dbg_64_safe_cpp20_pic' \
--toolchain "${TOOLCHAIN_PATH}"
make -j${PARALLELISM}
make install
Expand Down Expand Up @@ -284,14 +284,14 @@ else
CMAKE_OPTIONS+=(-UINSTALL_TARGETS);
# Need both all.t for UT run and `bmqbrkr and bmqtool` to run ITs
# Thus set TARGETS to "all"
TARGETS="all"
TARGETS=(bmqbrkr bmqtool all.it all.t bmqauthnpass bmqauthnfail bmqauthnbasic)
fi
PKG_CONFIG_PATH="/opt/bb/lib64/pkgconfig:/opt/bb/lib/pkgconfig:/opt/bb/share/pkgconfig:$(pkg-config --variable pc_path pkg-config)" \
cmake --preset fuzz-tests -B "${DIR_BUILD_BMQ}" -S "${DIR_SRC_BMQ}" -G Ninja \
-DCMAKE_PREFIX_PATH="${DIR_SRCS_EXT}/bde-tools/BdeBuildSystem" \
"${CMAKE_OPTIONS[@]}"
cmake --build "${DIR_BUILD_BMQ}" -j${PARALLELISM} \
--target ${TARGETS} -v --clean-first
--target "${TARGETS[@]}" -v --clean-first

if [ "${FUZZER}" == "on" ]; then
# In fuzzers case we only need to build the tests
Expand Down
9 changes: 5 additions & 4 deletions src/groups/bmq/bmqp/bmqp_ctrlmsg.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@
<element name='primaryStatusAdvisory' type='tns:PrimaryStatusAdvisory'/>
<element name='clusterSyncRequest' type='tns:DummyType'/>
<element name='clusterSyncResponse' type='tns:DummyType'/>
<element name='queueUnassignedAdvisory' type='tns:DummyType'/>
<element name='queueUnassignedAdvisory' type='tns:DummyType'/>
<element name='queueUnAssignmentAdvisory' type='tns:QueueUnAssignmentAdvisory'/>
<element name='leaderAdvisoryAck' type='tns:LeaderAdvisoryAck'/>
<element name='leaderAdvisoryCommit' type='tns:LeaderAdvisoryCommit'/>
Expand Down Expand Up @@ -1749,14 +1749,15 @@

status.....: Status of the request
lifetimeMs.: The duration (in milliseconds) the client's session is
valid for. The client must re-authenticate before the
valid for. The client must reauthenticate before the
lifetime expires or it will be disconnected.
The session lifetime is undefined if this value is unset.
The session lifetime is valid indefinitely if this value
is unset.
</documentation>
</annotation>
<sequence>
<element name='status' type='tns:Status' />
<element name='lifetimeMs' type='long' minOccurs='0'/>
<element name='lifetimeMs' type='nonNegativeInteger' minOccurs='0'/>
</sequence>
</complexType>

Expand Down
16 changes: 8 additions & 8 deletions src/groups/bmq/bmqp/bmqp_ctrlmsg_messages.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions src/groups/bmq/bmqp/bmqp_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ class Event {
/// returns true.
Event clone(bslma::Allocator* allocator) const;

/// Return the encoding type of this Authentication event. The
/// behavior is undefined unless `isAuthenticationEvent()` returns true.
EncodingType::Enum authenticationEventEncodingType() const;

/// Return the type of this event. The behavior is undefined unless
/// `isValid()` returns true.
EventType::Enum type() const;
Expand Down Expand Up @@ -333,8 +337,9 @@ int Event::loadSchemaEvent(TYPE* message) const
}

EncodingType::Enum encodingType = EncodingType::e_BER;
if (d_header->type() == EventType::e_CONTROL) {
encodingType = EventHeaderUtil::controlEventEncodingType(*d_header);
if (d_header->type() == EventType::e_CONTROL ||
d_header->type() == EventType::e_AUTHENTICATION) {
encodingType = EventHeaderUtil::encodingType(*d_header);
}

bmqu::MemOutStream os;
Expand Down Expand Up @@ -428,6 +433,14 @@ inline Event Event::clone(bslma::Allocator* allocator) const
return Event(d_blob_p, allocator, true /* clone == true */);
}

inline EncodingType::Enum Event::authenticationEventEncodingType() const
{
// PRECONDITIONS
BSLS_ASSERT_SAFE(isAuthenticationEvent());

return EventHeaderUtil::encodingType(*d_header);
}

inline EventType::Enum Event::type() const
{
// PRECONDITIONS
Expand Down
26 changes: 13 additions & 13 deletions src/groups/bmq/bmqp/bmqp_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -924,14 +924,13 @@ struct EventHeaderUtil {
// CLASS METHODS

/// Set the appropriate bits in the specified `eventHeader` to represent
/// the specified encoding `type` for a control event.
static void setControlEventEncodingType(EventHeader* eventHeader,
EncodingType::Enum type);

/// Return the encoding type for a control event represented by the
/// appropriate bits in the specified `eventHeader`.
static EncodingType::Enum
controlEventEncodingType(const EventHeader& eventHeader);
/// the specified encoding `type` for a control or an authentication event.
static void setEncodingType(EventHeader* eventHeader,
EncodingType::Enum type);

/// Return the encoding type for a control event or an authentication event
/// represented by the appropriate bits in the specified `eventHeader`.
static EncodingType::Enum encodingType(const EventHeader& eventHeader);
};

// ===================
Expand Down Expand Up @@ -3835,12 +3834,12 @@ inline unsigned char EventHeader::typeSpecific() const
// struct EventHeaderUtil
// ----------------------

inline void
EventHeaderUtil::setControlEventEncodingType(EventHeader* eventHeader,
inline void EventHeaderUtil::setEncodingType(EventHeader* eventHeader,
EncodingType::Enum type)
{
// PRECONDITIONS
BSLS_ASSERT_SAFE(eventHeader->type() == EventType::e_CONTROL);
BSLS_ASSERT_SAFE(eventHeader->type() == EventType::e_CONTROL ||
eventHeader->type() == EventType::e_AUTHENTICATION);
BSLS_ASSERT_SAFE(type != EncodingType::e_UNKNOWN);

unsigned char typeSpecific = eventHeader->typeSpecific();
Expand All @@ -3856,10 +3855,11 @@ EventHeaderUtil::setControlEventEncodingType(EventHeader* eventHeader,
}

inline EncodingType::Enum
EventHeaderUtil::controlEventEncodingType(const EventHeader& eventHeader)
EventHeaderUtil::encodingType(const EventHeader& eventHeader)
{
// PRECONDITIONS
BSLS_ASSERT_SAFE(eventHeader.type() == EventType::e_CONTROL);
BSLS_ASSERT_SAFE(eventHeader.type() == EventType::e_CONTROL ||
eventHeader.type() == EventType::e_AUTHENTICATION);

const unsigned char typeSpecific = eventHeader.typeSpecific();
const int encodingType = (typeSpecific & k_CONTROL_EVENT_ENCODING_MASK) >>
Expand Down
10 changes: 4 additions & 6 deletions src/groups/bmq/bmqp/bmqp_protocol.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static void test1_breathingTest()
// Create EventHeader with non-default ctor
bmqp::EventHeader eh2(bmqp::EventType::e_CONTROL);
const bmqp::EncodingType::Enum encodingType =
bmqp::EventHeaderUtil::controlEventEncodingType(eh2);
bmqp::EventHeaderUtil::encodingType(eh2);

BMQTST_ASSERT_EQ(static_cast<size_t>(eh2.length()), sizeof(eh2));
BMQTST_ASSERT_EQ(eh2.fragmentBit(), 0);
Expand Down Expand Up @@ -1754,13 +1754,11 @@ static void test7_eventHeaderUtil()
PVV(test.d_line
<< ": Testing: EventHeaderUtil::setControlEventEncodingType("
<< test.d_value << ")");
bmqp::EventHeaderUtil::setControlEventEncodingType(&eventHeader,
test.d_value);
bmqp::EventHeaderUtil::setEncodingType(&eventHeader, test.d_value);

// 2. Verify that the intended encoding type is set
BMQTST_ASSERT_EQ(
test.d_value,
bmqp::EventHeaderUtil::controlEventEncodingType(eventHeader));
BMQTST_ASSERT_EQ(test.d_value,
bmqp::EventHeaderUtil::encodingType(eventHeader));
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/groups/bmq/bmqp/bmqp_schemaeventbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class SchemaEventBuilder {
/// Encode the templated specified `message` of the specified event
/// `type` in this SchemaEvent, and return 0 on success or a non-zero
/// result on error. The behaviour is undefined unless `type` is
/// `CONTROL` or `ELECTOR`.
/// `CONTROL`, `ELECTOR`, or `AUTHENTICATION`.
template <class TYPE>
int setMessage(const TYPE& message, EventType::Enum type);

Expand Down Expand Up @@ -246,10 +246,10 @@ int SchemaEventBuilder::setMessage(const TYPE& message, EventType::Enum type)
EventHeader* eventHeader = new (d_blob_sp->buffer(0).data())
EventHeader(type);

// Specify the encoding type in the EventHeader for control messages
if (type == EventType::e_CONTROL) {
EventHeaderUtil::setControlEventEncodingType(eventHeader,
d_encodingType);
// Specify the encoding type in the EventHeader for control or
// authentication messages
if (type == EventType::e_CONTROL || type == EventType::e_AUTHENTICATION) {
EventHeaderUtil::setEncodingType(eventHeader, d_encodingType);
}

// Append appropriate encoding of 'message' to the blob
Expand Down
1 change: 1 addition & 0 deletions src/groups/mqb/mqba/mqba_adminsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ void AdminSession::processEvent(const bmqp::Event& event,
{
// executed by the *IO* thread

// PRECONDITIONS
if (!event.isControlEvent()) {
BALL_LOG_ERROR << "#ADMCLIENT_UNEXPECTED_EVENT " << description()
<< ": Unexpected event type: " << event;
Expand Down
Loading
Loading