Skip to content

Commit

Permalink
Published Auth timeout for one additional flow (#903)
Browse files Browse the repository at this point in the history
* Published Auth timeout ifor one additional flow
---------

Signed-off-by: Yonatan Dankner <[email protected]>
Co-authored-by: Yonatan Dankner <[email protected]>
  • Loading branch information
ydankner and Yonatan Dankner authored Oct 14, 2024
1 parent 8f8a6f7 commit 544128e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/Auth/lib/AuthHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,11 @@ void AuthHandler::notify_evse(int connector_id, const ProvidedIdToken& provided_
this->connectors.at(connector_id)->timeout_timer.stop();
this->connectors.at(connector_id)
->timeout_timer.timeout(
[this, evse_index, connector_id]() {
[this, evse_index, connector_id, provided_token]() {
EVLOG_info << "Authorization timeout for evse#" << evse_index;
this->connectors.at(connector_id)->connector.identifier.reset();
this->withdraw_authorization_callback(evse_index);
this->publish_token_validation_status_callback(provided_token, TokenValidationStatus::TimedOut);
},
std::chrono::seconds(this->connection_timeout));
std::lock_guard<std::mutex> plug_in_lk(this->plug_in_queue_mutex);
Expand Down
3 changes: 3 additions & 0 deletions modules/Auth/tests/auth_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,9 @@ TEST_F(AuthTest, test_authorization_without_transaction) {
ASSERT_TRUE(result == TokenHandlingResult::ALREADY_IN_PROCESS);
ASSERT_TRUE(this->auth_receiver->get_authorization(0));

EXPECT_CALL(mock_publish_token_validation_status_callback,
Call(Field(&ProvidedIdToken::id_token, provided_token.id_token), TokenValidationStatus::TimedOut));

// wait for timeout
std::this_thread::sleep_for(std::chrono::seconds(CONNECTION_TIMEOUT + 1));

Expand Down

0 comments on commit 544128e

Please sign in to comment.