Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
4449b92
[broker-67] Add authentications modules and initial class structure
crazyrokr Dec 4, 2025
3c353c4
[broker-67] Remove unnecessary import
crazyrokr Dec 6, 2025
bfef50e
[broker-67] Implement file and db credentials sources
crazyrokr Dec 10, 2025
53b38dc
Merge branch 'develop' into feature-broker-67
crazyrokr Dec 10, 2025
3d36a83
[broker-67] Rename CredentialsSourceDatabaseConfig
crazyrokr Dec 10, 2025
fd0835b
[broker-67] Add tests
crazyrokr Dec 10, 2025
0de823c
[broker-67] Refactoring
crazyrokr Dec 10, 2025
c7c5213
[broker-67] Introduce AuthenticationSpringConfig
crazyrokr Dec 10, 2025
388be51
[broker-67] Revert unnecessary changes
crazyrokr Dec 10, 2025
ed00b01
[broker-67] Introduce DatabaseClient from spring-r2dbc
crazyrokr Dec 11, 2025
ebbfc47
Merge branch 'develop' into feature-broker-67
crazyrokr Dec 12, 2025
ef1f19b
[broker-67] Refactoring
crazyrokr Dec 13, 2025
9239636
[broker-67] Make AuthRequest a record
crazyrokr Dec 13, 2025
b75fd79
reorganize ACL modules
JavaSaBr Dec 14, 2025
8fe507c
reorganize ACL modules
JavaSaBr Dec 14, 2025
5bcdcd1
reorganize ACL modules
JavaSaBr Dec 14, 2025
f3fd5c7
integrate configuring groovy acl for application
JavaSaBr Dec 14, 2025
cfe73ce
integrate configuring groovy acl for application
JavaSaBr Dec 14, 2025
63c300c
resolve review comments
JavaSaBr Dec 14, 2025
63ab62d
Merge branch 'develop' into feature-broker-67
crazyrokr Dec 14, 2025
aceb2f7
Merge branch 'feature/142-integrate-acl-groovy-based-engine-part-1' i…
JavaSaBr Dec 14, 2025
e34f937
Merge remote-tracking branch 'origin/develop' into feature/142-integr…
JavaSaBr Dec 14, 2025
7f4768f
Merge branch 'develop' into feature-broker-67
crazyrokr Dec 15, 2025
59dabc4
resolve code review comments
JavaSaBr Dec 16, 2025
307655f
Merge branch 'feature-broker-67' into feature/141-implement-db-vesion…
crazyrokr Dec 16, 2025
74bb96a
Merge branch 'develop' into feature-broker-67
crazyrokr Dec 17, 2025
faecf1a
Merge branch 'develop' into feature/141-implement-db-vesioning-with-f…
crazyrokr Dec 17, 2025
f1bd443
[broker-141] Introduce Flyway
crazyrokr Dec 20, 2025
c7ae159
Merge branch 'feature-broker-67' into feature/141-implement-db-vesion…
crazyrokr Dec 20, 2025
1bb2956
[broker-141] Improve initialization of authentication service
crazyrokr Dec 20, 2025
d1e4e7f
[broker-141] Add logging during initialization of authentication service
crazyrokr Dec 20, 2025
949b798
[broker-141] Improve ApplicationPropertiesSpecification initialization
crazyrokr Dec 20, 2025
3dd9630
[broker-141] Introduce MqttClientFactory
crazyrokr Dec 20, 2025
97aabb8
[broker-141] Optimize gradle dependencies
crazyrokr Dec 20, 2025
cbeb2f4
[broker-141] Improve AuthenticationServiceTest
crazyrokr Dec 20, 2025
ce09c2f
[broker-141] Increase password length
crazyrokr Dec 20, 2025
677958e
[broker-141] Refactoring
crazyrokr Dec 20, 2025
632737b
[broker-141] Move db user credentials into map
crazyrokr Dec 20, 2025
b338670
[broker-141] Refactoring of properties access
crazyrokr Dec 20, 2025
858b244
[broker-141] Rename createContextRunner method
crazyrokr Dec 20, 2025
b4c636c
[broker-141] Rename classes and variables
crazyrokr Dec 20, 2025
8d70b2b
[broker-141] Add constraints to user_credentials table
crazyrokr Dec 21, 2025
652b88c
[broker-141] Rename auth-provider-basic to authentication-provider-basic
crazyrokr Dec 21, 2025
7d6f7fa
[broker-141] Move exception to separate package
crazyrokr Dec 21, 2025
4047842
[broker-141] Remove ConnectToAuthRequestConverter
crazyrokr Dec 21, 2025
1dc6427
[broker-141] Move db-specific configs to credentials-source-db
crazyrokr Dec 21, 2025
da83319
[broker-141] Remove redundant @Nullable annotation
crazyrokr Dec 21, 2025
364be20
[broker-141] Move AuthenticationServiceConfig to authentication-servi…
crazyrokr Dec 25, 2025
fbb05fa
[broker-141] Switch from H2 R2DBC to PostgreSQL Testcontainer
crazyrokr Dec 25, 2025
785c8dc
[broker-141] Improve AuthenticationConfigCondition abstraction, refac…
crazyrokr Dec 25, 2025
a064429
[broker-141] Improve dependency declaration
crazyrokr Dec 25, 2025
3d53267
Merge branch 'develop' into feature/141-implement-db-vesioning-with-f…
crazyrokr Dec 25, 2025
5ae4d65
[broker-141] Improve DefaultAuthenticationService description builder
crazyrokr Dec 25, 2025
b142f23
[broker-141] Remove redundant code, refactoring
crazyrokr Dec 25, 2025
51823b5
[broker-141] Support multi-provider setup
crazyrokr Dec 25, 2025
6448b7b
[broker-141] Revert unnecessary changes
crazyrokr Dec 25, 2025
1656438
[broker-141] Rename AuthRequest to AuthenticationRequest
crazyrokr Dec 25, 2025
5fe633d
[broker-141] Pass authenticationMethod, improve logging
crazyrokr Dec 26, 2025
4c709db
[broker-141] Add more authentication types
crazyrokr Dec 26, 2025
cdecb51
[broker-141] Introduce DatasourceType
crazyrokr Dec 26, 2025
38132a8
[broker-141] Refactoring
crazyrokr Jan 1, 2026
6824a23
[broker-141] Remove DatabaseUrlBuilder
crazyrokr Jan 1, 2026
c92f475
[broker-141] Rework authentication properties
crazyrokr Jan 2, 2026
166daef
Merge branch 'develop' into feature/141-implement-db-vesioning-with-f…
crazyrokr Jan 2, 2026
b5b5ae8
[broker-141] Rename DatabaseCredentials
crazyrokr Jan 2, 2026
3b71801
[broker-141] Improve Spring configuration
crazyrokr Jan 2, 2026
31079ab
[broker-141] Improve Spring configuration
crazyrokr Jan 2, 2026
5dab30a
[broker-141] Rename members
crazyrokr Jan 2, 2026
cf0faec
[broker-141] Improve DefaultAuthenticationService
crazyrokr Jan 2, 2026
baf885d
[broker-141] Improve DefaultAuthenticationService creation
crazyrokr Jan 2, 2026
bcc2d33
[broker-141] Refactoring
crazyrokr Jan 2, 2026
c91a1f5
[broker-141] Introduce DatabaseConfig
crazyrokr Jan 2, 2026
8327533
[broker-141] Rework properties structure
crazyrokr Jan 2, 2026
5faaff0
[broker-141] Support a list of credentials sources
crazyrokr Jan 2, 2026
de1412b
[broker-141] Extract FileCredentialsSourceSpringConfig
crazyrokr Jan 3, 2026
aca3dd1
[broker-141] Rename property interfaces
crazyrokr Jan 3, 2026
0fe97ff
[broker-141] Improve DefaultAuthenticationService instantiation
crazyrokr Jan 3, 2026
7518aaa
[broker-141] Improve AuthenticationProviderTest
crazyrokr Jan 3, 2026
7d96f20
[broker-141] Require empty password by anonymous provider
crazyrokr Jan 4, 2026
44b8a4c
[broker-141] Apply formatting
crazyrokr Jan 4, 2026
6914d2e
[broker-141] Rename CredentialsSource.getCredentialsSourceType()
crazyrokr Jan 4, 2026
bbcf4ad
[broker-141] Separate FileProperties and DatabaseProperties
crazyrokr Jan 4, 2026
9bbc182
[broker-141] Remove db related dependencies from authentication-service
crazyrokr Jan 5, 2026
8c73b0a
[broker-141] Remove not implemented credentials source types
crazyrokr Jan 5, 2026
ce8684e
[broker-141] Extract onDuplicateProviderErrorHandler
crazyrokr Jan 5, 2026
e9b7f27
[broker-141] Refactoring of authentication properties structure
crazyrokr Jan 5, 2026
cfede3d
[broker-141] Do not keep AnonymousAuthenticationProvider separately
crazyrokr Jan 5, 2026
97b2755
[broker-141] Move database properties classes
crazyrokr Jan 5, 2026
34adf8e
[broker-141] Refactoring of authentication properties structure
crazyrokr Jan 5, 2026
6f39c74
[broker-141] Refactoring of authentication provider properties
crazyrokr Jan 6, 2026
2bb41d9
[broker-141] Refactoring of default provider properties
crazyrokr Jan 6, 2026
e59e6e3
[broker-141] Revert unnecessary changes
crazyrokr Jan 6, 2026
2bdee9c
[broker-141] Add error handlers to DefaultAuthenticationService
crazyrokr Jan 6, 2026
7d14448
[broker-141] Add test
crazyrokr Jan 6, 2026
9a64374
[broker-141] Rework DefaultAuthenticationService according review com…
crazyrokr Jan 10, 2026
20a7168
Merge branch 'develop' into feature/141-implement-db-vesioning-with-f…
crazyrokr Jan 10, 2026
3d30649
[broker-141] Rework Database Properties
crazyrokr Jan 10, 2026
b43b2b6
[broker-141] Improve authentication service properties
crazyrokr Jan 11, 2026
ab3c865
[broker-141] Improve property validation
crazyrokr Jan 11, 2026
76f7af4
[broker-141] Rename Spring beans related to Credentials Source
crazyrokr Jan 11, 2026
fc269eb
[broker-141] Revert unnecessary changes
crazyrokr Jan 11, 2026
8bb6c58
[broker-141] Introduce PropertyAssert
crazyrokr Jan 12, 2026
b7526ba
[broker-141] Move InMemoryCredentialsSource to credentials-source-file
crazyrokr Jan 12, 2026
df14a98
[broker-141] Optimize DatabaseCredentialsSource query
crazyrokr Jan 13, 2026
f9ac55d
[broker-141] Move PropertyAssert to base module
crazyrokr Jan 13, 2026
6cb6f30
[broker-141] Rename databaseCredentialsSourceProperties autowired can…
crazyrokr Jan 13, 2026
c05fea4
[broker-141] Rename DatabaseCredentialsSourceBuilder
crazyrokr Jan 13, 2026
1b3875d
[broker-141] Separate Flyway and DatabaseCredentialsSource builders
crazyrokr Jan 13, 2026
3bc1bdd
[broker-141] Remove unnecessary log4j2.xml
crazyrokr Jan 13, 2026
c169ca9
[broker-141] Move PostgreSQLContainer to Spring cpnfig
crazyrokr Jan 13, 2026
09568c2
[broker-141] Improve logging
crazyrokr Jan 13, 2026
1b544a9
[broker-141] Improve logging and naming
crazyrokr Jan 13, 2026
98f3cd2
[broker-141] Refactoring
crazyrokr Jan 14, 2026
bea0179
[broker-141] Initialize FileCredentialsSource in constructor
crazyrokr Jan 15, 2026
56cc9f1
[broker-141] Introduce NoOpAuthenticationService
crazyrokr Jan 15, 2026
aac1ce9
[broker-141] Replace EmptyProviderTest with NoOpAuthenticationService…
crazyrokr Jan 15, 2026
51d3462
[broker-141] Rename method
crazyrokr Jan 18, 2026
a8bbfec
Merge branch 'develop' into feature/141-implement-db-vesioning-with-f…
crazyrokr Jan 18, 2026
b391f93
[broker-141] Make database migration location configurable
crazyrokr Jan 18, 2026
e059fbe
[broker-141] Improve enum API
crazyrokr Jan 18, 2026
27e6e83
[broker-141] Use method reference for log printing
crazyrokr Jan 18, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public boolean authorizeSubscribe(MqttUser user, TopicFilter topicFilter) {
}

// we know that writing this to not volatile field will not apply it for all threads immediately,
// but for us it's not critical comparing to cost of reading volatile field
// but for us, it's not critical comparing to cost of reading volatile field
protected synchronized void switchTo(AclEngine newEngine) {
this.engine = newEngine;
}
Expand Down
3 changes: 3 additions & 0 deletions application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ dependencies {
implementation projects.coreService
implementation projects.aclService
implementation projects.aclGroovyDsl
implementation projects.authenticationService
implementation libs.rlib.logger.slf4j
implementation libs.springboot.starter.core
implementation libs.springboot.starter.log4j2

testImplementation projects.testSupport
testImplementation testFixtures(projects.network)
testImplementation projects.credentialsSourceFile
testImplementation projects.authenticationProviderBasic
}

tasks.withType(GroovyCompile).configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.net.InetSocketAddress;
import java.util.Collection;
import javasabr.mqtt.acl.service.conifg.GroovyDslBasedAclServiceSpringConfig;
import javasabr.mqtt.auth.api.AuthenticationService;
import javasabr.mqtt.auth.service.config.AuthenticationServiceSpringConfig;
import javasabr.mqtt.model.MqttProperties;
import javasabr.mqtt.model.MqttServerConnectionConfig;
import javasabr.mqtt.model.QoS;
Expand All @@ -11,11 +13,9 @@
import javasabr.mqtt.network.handler.NetworkMqttUserReleaseHandler;
import javasabr.mqtt.network.impl.ExternalNetworkMqttUser;
import javasabr.mqtt.network.user.NetworkMqttUserFactory;
import javasabr.mqtt.service.AuthenticationService;
import javasabr.mqtt.service.AuthorizationService;
import javasabr.mqtt.service.ClientIdRegistry;
import javasabr.mqtt.service.ConnectionService;
import javasabr.mqtt.service.CredentialSource;
import javasabr.mqtt.service.MessageOutFactoryService;
import javasabr.mqtt.service.PublishDeliveringService;
import javasabr.mqtt.service.PublishReceivingService;
Expand All @@ -31,11 +31,9 @@
import javasabr.mqtt.service.impl.DefaultTopicService;
import javasabr.mqtt.service.impl.DisabledAuthorizationService;
import javasabr.mqtt.service.impl.ExternalNetworkMqttUserFactory;
import javasabr.mqtt.service.impl.FileCredentialsSource;
import javasabr.mqtt.service.impl.InMemoryClientIdRegistry;
import javasabr.mqtt.service.impl.InMemoryRetainMessageService;
import javasabr.mqtt.service.impl.InMemorySubscriptionService;
import javasabr.mqtt.service.impl.SimpleAuthenticationService;
import javasabr.mqtt.service.message.handler.MqttInMessageHandler;
import javasabr.mqtt.service.message.handler.impl.ConnectInMqttInMessageHandler;
import javasabr.mqtt.service.message.handler.impl.DisconnectMqttInMessageHandler;
Expand Down Expand Up @@ -75,6 +73,7 @@
import org.springframework.core.env.Environment;

@Import({
AuthenticationServiceSpringConfig.class,
GroovyDslBasedAclServiceSpringConfig.class
})
@CustomLog
Expand All @@ -101,22 +100,9 @@ MqttSessionService mqttSessionService(
return new InMemoryMqttSessionService(cleanInterval);
}

@Bean
CredentialSource credentialSource(
@Value("${credentials.source.file.name:credentials}") String fileName) {
return new FileCredentialsSource(fileName);
}

@Bean
AuthenticationService authenticationService(
CredentialSource credentialSource,
@Value("${authentication.allow.anonymous:false}") boolean allowAnonymousAuth) {
return new SimpleAuthenticationService(credentialSource, allowAnonymousAuth);
}

@Bean
@ConditionalOnProperty(
name = "acl.engine.type",
name = "acl.engine.type",
havingValue = "disabled",
matchIfMissing = true)
AuthorizationService authorizationService() {
Expand Down Expand Up @@ -178,7 +164,7 @@ MqttInMessageHandler publishAckMqttInMessageHandler(MessageOutFactoryService mes
MqttInMessageHandler publishCompleteMqttInMessageHandler(MessageOutFactoryService messageOutFactoryService) {
return new PublishCompleteMqttInMessageHandler(messageOutFactoryService);
}

@Bean
MqttInMessageHandler publishMqttInMessageHandler(
PublishReceivingService publishReceivingService,
Expand Down
3 changes: 1 addition & 2 deletions application/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
authentication.allow.anonymous=false
credentials.source.file.name=credentials
authentication.provider.anonymous.enabled=false
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import com.hivemq.client.mqtt.mqtt5.message.subscribe.suback.Mqtt5SubAckReasonCo

import java.util.concurrent.CompletableFuture

import static javasabr.mqtt.broker.application.MqttClientFactory.generateClientId

class ConnectSubscribePublishTest extends IntegrationSpecification {

def "should deliver publish message QoS 0 using mqtt 3.1.1"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ import com.hivemq.client.mqtt.mqtt3.message.connect.connack.Mqtt3ConnAckReturnCo
import com.hivemq.client.mqtt.mqtt5.exceptions.Mqtt5ConnAckException
import com.hivemq.client.mqtt.mqtt5.message.connect.connack.Mqtt5ConnAckReasonCode
import javasabr.mqtt.model.MqttProperties
import javasabr.mqtt.model.QoS
import javasabr.mqtt.model.reason.code.ConnectAckReasonCode
import javasabr.mqtt.network.message.in.ConnectAckMqttInMessage
import javasabr.mqtt.network.message.out.ConnectMqtt311OutMessage
import javasabr.rlib.common.util.ArrayUtils
import spock.lang.Ignore

import java.nio.charset.StandardCharsets
import java.util.concurrent.CompletionException

class ExternalConnectionTest extends IntegrationSpecification {
Expand Down Expand Up @@ -139,33 +133,7 @@ class ExternalConnectionTest extends IntegrationSpecification {
cause.mqttMessage.returnCode == Mqtt3ConnAckReturnCode.BAD_USER_NAME_OR_PASSWORD
}

@Ignore
def "client should not connect to broker without username and with pass using MQTT 3.1.1"() {
given:
def client = buildMqtt311MockClient()
def clientId = generateClientId()
when:

client.connect()
client.send(new ConnectMqtt311OutMessage(
"",
"",
clientId,
"wrongPassword".getBytes(StandardCharsets.UTF_8),
ArrayUtils.EMPTY_BYTE_ARRAY,
QoS.AT_MOST_ONCE,
keepAlive,
false,
false
))

def connectAck = client.readNext() as ConnectAckMqttInMessage

then:
connectAck.reasonCode == ConnectAckReasonCode.BAD_USER_NAME_OR_PASSWORD
}

def "client should not connect to broker with wrong pass using MQTT 5"() {
def "client should not connect to broker with wrong pass using mqtt 5"() {
given:
def client = buildExternalMqtt5Client()
when:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package javasabr.mqtt.broker.application

import com.hivemq.client.mqtt.MqttClient
import com.hivemq.client.mqtt.mqtt3.Mqtt3AsyncClient
import com.hivemq.client.mqtt.mqtt5.Mqtt5AsyncClient
import javasabr.mqtt.broker.application.config.MqttBrokerTestConfig
Expand All @@ -17,7 +16,6 @@ import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig

import java.nio.charset.StandardCharsets
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.atomic.AtomicReference

@TestPropertySource("classpath:application-test.properties")
Expand All @@ -30,74 +28,30 @@ class IntegrationSpecification extends BaseSpecification {
public static final clientId = "testClientId"
public static final keepAlive = 120

private static final idGenerator = new AtomicInteger(1)

@Autowired
InetSocketAddress externalNetworkAddress

@Autowired
MqttServerConnectionConfig externalConnectionConfig

def buildExternalMqtt311Client() {
return buildMqtt311Client(generateClientId(), externalNetworkAddress)
return buildExternalMqtt311Client(generateClientId())
}

def buildExternalMqtt5Client() {
return buildMqtt5Client(generateClientId(), externalNetworkAddress)
return buildExternalMqtt5Client(generateClientId())
}

def buildExternalMqtt311Client(String clientId) {
return MqttClient.builder()
.identifier(clientId)
.serverHost(externalNetworkAddress.getHostName())
.serverPort(externalNetworkAddress.getPort())
.useMqttVersion3()
.build()
.toAsync()
}

def buildMqtt311Client(String clientId, InetSocketAddress address) {
return MqttClient.builder()
.identifier(clientId)
.serverHost(address.getHostName())
.serverPort(address.getPort())
.useMqttVersion3()
.addDisconnectedListener {
println "[${clientId}|mqtt311] disconnected:[${it.cause.message}]"
}
.build()
.toAsync()
return MqttClientFactory.buildMqtt311Client(clientId, externalNetworkAddress)
}

def buildExternalMqtt5Client(String clientId) {
return MqttClient.builder()
.identifier(clientId)
.serverHost(externalNetworkAddress.getHostName())
.serverPort(externalNetworkAddress.getPort())
.useMqttVersion5()
.build()
.toAsync()
}

def buildMqtt5Client(String clientId, InetSocketAddress address) {
return MqttClient.builder()
.identifier(clientId)
.serverHost(address.getHostName())
.serverPort(address.getPort())
.useMqttVersion5()
.addDisconnectedListener {
println "[${clientId}|mqtt5] disconnected:[${it.cause.message}]"
}
.build()
.toAsync()
return MqttClientFactory.buildMqtt5Client(clientId, externalNetworkAddress)
}

def generateClientId() {
return generateClientId("Default")
}

def generateClientId(String prefix) {
return prefix + "_" + idGenerator.incrementAndGet()
return MqttClientFactory.generateClientId("Default")
}

def connectWith(Mqtt3AsyncClient client, String user, String pass) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package javasabr.mqtt.broker.application

import com.hivemq.client.mqtt.MqttClient
import com.hivemq.client.mqtt.mqtt3.Mqtt3AsyncClient
import com.hivemq.client.mqtt.mqtt5.Mqtt5AsyncClient

import java.util.concurrent.atomic.AtomicInteger

class MqttClientFactory {

private static final ID_GENERATOR = new AtomicInteger(1)

static Mqtt5AsyncClient buildMqtt5Client(String clientId, InetSocketAddress address) {
return MqttClient.builder()
.identifier(clientId)
.serverHost(address.getHostName())
.serverPort(address.getPort())
.useMqttVersion5()
.addDisconnectedListener {
println "[${clientId}|mqtt5] disconnected:[${it.cause.message}]"
}
.build()
.toAsync()
}

static Mqtt3AsyncClient buildMqtt311Client(String clientId, InetSocketAddress address) {
return MqttClient.builder()
.identifier(clientId)
.serverHost(address.getHostName())
.serverPort(address.getPort())
.useMqttVersion3()
.addDisconnectedListener {
println "[${clientId}|mqtt311] disconnected:[${it.cause.message}]"
}
.build()
.toAsync()
}

static String generateClientId(String prefix) {
return prefix + "_" + ID_GENERATOR.incrementAndGet()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import javasabr.mqtt.service.session.MqttSessionService
import javasabr.rlib.collections.array.Array
import org.springframework.beans.factory.annotation.Autowired

import static javasabr.mqtt.broker.application.MqttClientFactory.generateClientId

class PublishRetryTest extends IntegrationSpecification {

private static final int testSessionExpiryIntervalInSecs = 120
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//file:noinspection SpringJavaInjectionPointsAutowiringInspection
package javasabr.mqtt.broker.application.config

import javasabr.mqtt.network.MqttConnection
Expand All @@ -12,7 +13,7 @@ import org.springframework.context.annotation.Import
import java.util.concurrent.ThreadLocalRandom

@Import([
MqttBrokerSpringConfig,
MqttBrokerSpringConfig
])
@Configuration(proxyBeanMethods = false)
class MqttBrokerTestConfig {
Expand All @@ -25,7 +26,7 @@ class MqttBrokerTestConfig {
try {
externalNetwork.start(address)
return address;
} catch (RuntimeException e) {
} catch (RuntimeException ignored) {
}
}
throw new RuntimeException()
Expand All @@ -41,6 +42,6 @@ class MqttBrokerTestConfig {
ConnectionService connectionService,
InetSocketAddress externalNetworkAddress) {
externalNetwork.onAccept(connectionService::processAcceptedConnection);
return null;
return null
}
}
8 changes: 6 additions & 2 deletions application/src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
authentication.allow.anonymous=true
credentials.source.file.name=credentials-test
authentication.provider.default.method=basic
authentication.provider.anonymous.enabled=true
authentication.provider.basic.enabled=true
authentication.credentials-source.file.enabled=true
authentication.credentials-source.file.path=classpath:auth/credentials-test

mqtt.external.connection.shared.subscription.available=true
mqtt.external.connection.wildcard.subscription.available=true

Expand Down
2 changes: 2 additions & 0 deletions application/src/test/resources/auth/credentials-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
user=correct-password
user1=password
2 changes: 0 additions & 2 deletions application/src/test/resources/credentials-test

This file was deleted.

14 changes: 14 additions & 0 deletions authentication-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id("java-library")
id("configure-java")
id("groovy")
}

description = "Authentication API"

dependencies {
api projects.base

testImplementation projects.testSupport
testFixturesApi projects.testSupport
}
Loading
Loading