Add client login/passcode to broker relay
Issue: SPR-11154
This commit is contained in:
@@ -303,11 +303,19 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
|
||||
if(!relayPort.isEmpty()) {
|
||||
mpvs.add("relayPort", Integer.valueOf(relayPort));
|
||||
}
|
||||
String attrValue = brokerRelayElem.getAttribute("login");
|
||||
String attrValue = brokerRelayElem.getAttribute("client-login");
|
||||
if(!attrValue.isEmpty()) {
|
||||
mpvs.add("clientLogin",attrValue);
|
||||
}
|
||||
attrValue = brokerRelayElem.getAttribute("client-passcode");
|
||||
if(!attrValue.isEmpty()) {
|
||||
mpvs.add("clientPasscode", attrValue);
|
||||
}
|
||||
attrValue = brokerRelayElem.getAttribute("system-login");
|
||||
if(!attrValue.isEmpty()) {
|
||||
mpvs.add("systemLogin",attrValue);
|
||||
}
|
||||
attrValue = brokerRelayElem.getAttribute("passcode");
|
||||
attrValue = brokerRelayElem.getAttribute("system-passcode");
|
||||
if(!attrValue.isEmpty()) {
|
||||
mpvs.add("systemPasscode", attrValue);
|
||||
}
|
||||
|
||||
@@ -243,17 +243,39 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="login" type="xsd:string">
|
||||
<xsd:attribute name="client-login" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler"><![CDATA[
|
||||
The login for the "system" connection used to send messages to the STOMP broker.
|
||||
The login to use when creating connections to the STOMP broker on behalf of connected clients.
|
||||
By default this is set to "guest".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="passcode" type="xsd:string">
|
||||
<xsd:attribute name="client-passcode" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler"><![CDATA[
|
||||
The passcode for the "system" connection used to send messages to the STOMP broker.
|
||||
The passcode to use when creating connections to the STOMP broker on behalf of connected clients.
|
||||
By default this is set to "guest".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="system-login" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler"><![CDATA[
|
||||
The login for the shared "system" connection used to send messages to
|
||||
the STOMP broker from within the application, i.e. messages not associated
|
||||
with a specific client session (e.g. REST/HTTP request handling method).
|
||||
By default this is set to "guest".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="system-passcode" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler"><![CDATA[
|
||||
The passcode for the shared "system" connection used to send messages to
|
||||
the STOMP broker from within the application, i.e. messages not associated
|
||||
with a specific client session (e.g. REST/HTTP request handling method).
|
||||
By default this is set to "guest".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
|
||||
@@ -168,8 +168,10 @@ public class MessageBrokerBeanDefinitionParserTests {
|
||||
|
||||
StompBrokerRelayMessageHandler messageBroker = this.appContext.getBean(StompBrokerRelayMessageHandler.class);
|
||||
assertNotNull(messageBroker);
|
||||
assertEquals("login", messageBroker.getSystemLogin());
|
||||
assertEquals("pass", messageBroker.getSystemPasscode());
|
||||
assertEquals("clientlogin", messageBroker.getClientLogin());
|
||||
assertEquals("clientpass", messageBroker.getClientPasscode());
|
||||
assertEquals("syslogin", messageBroker.getSystemLogin());
|
||||
assertEquals("syspass", messageBroker.getSystemPasscode());
|
||||
assertEquals("relayhost", messageBroker.getRelayHost());
|
||||
assertEquals(1234, messageBroker.getRelayPort());
|
||||
assertEquals("spring.io", messageBroker.getVirtualHost());
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
<websocket:sockjs/>
|
||||
</websocket:stomp-endpoint>
|
||||
<websocket:stomp-broker-relay prefix="/topic,/queue" relay-host="relayhost" relay-port="1234"
|
||||
login="login" passcode="pass" heartbeat-send-interval="5000" heartbeat-receive-interval="5000"
|
||||
client-login="clientlogin" client-passcode="clientpass"
|
||||
system-login="syslogin" system-passcode="syspass"
|
||||
heartbeat-send-interval="5000" heartbeat-receive-interval="5000"
|
||||
virtual-host="spring.io"/>
|
||||
</websocket:message-broker>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user