-
Notifications
You must be signed in to change notification settings - Fork 928
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
ARTEMIS-5163 Broker fails to send MQTT LWT using certificate-based mutual TLS #5460
Conversation
A Subject attribute has been added to MQTTSessionState in order to enable the broker to send LWT. The provided client's identity is necessary when using mutual TLS for authentication.
The newly created willIdentity attribute is considered to be used when sending the LWT. Some refactoring to the class MQTTPublishManager has been applied.
Some refactoring to the class ServerSessionImpl has been applied.
Some refactoring to the class ServerSessionImpl has been applied in order to be able to call a new SecurityStore::check that accepts a Subject attribute.
A checkWithoutReAuthentication method has been added to SecurityStore and implemented in SecurityStoreImpl. This method will apply an authorization check based on the given Subject attribute.
Each time the HierarchicalRepositoryChangeListener.onChange() method is called, the willIdentity is updated. This is implemented by using the security repository in the class SecurityStore.
The method unregisterWillIdentityUpdateFromSecurityRepository() is additionally called when the MQTTSession is stopped
The will identity Subject is considered when creating a new address, that is used to send the LWT.
Some reduction to the method's cognitive complexity.
Tests were added to check set/unset of the willIdentity attribute.
Tests were added to check successful and failing sending of the LWT when certificate-based mutual TLS is used. This illustrates the need to store the client's user and role in Subject format as an MQTTSessionState attribute.
First off, thanks for sending a PR! There's some good work here, but I have a few concerns.
|
I think a really simple solution here would be to cache the |
@JeanLucGraphalo, do you plan on addressing my concerns or should I just close this? |
@jbertram, your comment has been added to the jira. I close the PR. |
Implements a fix of bug ARTEMIS-5163.
The changes follow the proposals as described in the ticket comments.
A lot of code refactoring was necessary to fix the problem, which could make the review challenging.