Skip to content
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

Broker Security Plugin enhancements #3066

Merged
merged 3 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions assembly/broker/configurations/activemq.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
<transportConnectors>
<transportConnector name="mqtt"
uri="mqtt+nio://0.0.0.0:1883?transport.defaultKeepAlive=60000&amp;transport.maximumConnections=1000&amp;transport.socketBufferSize=131072&amp;transport.ioBufferSize=16384&amp;transport.activeMQSubscriptionPrefetch=32766&amp;transport.publishDollarTopics=true&amp;transport.subscriptionStrategy=mqtt-virtual-topic-subscriptions"/>
<transportConnector name="internalMqtt"
uri="mqtt+nio://0.0.0.0:1893?transport.defaultKeepAlive=60000&amp;transport.maximumConnections=1000&amp;transport.socketBufferSize=131072&amp;transport.ioBufferSize=16384&amp;transport.activeMQSubscriptionPrefetch=32766&amp;transport.publishDollarTopics=true&amp;transport.subscriptionStrategy=mqtt-virtual-topic-subscriptions"/>
<transportConnector name="mqtts"
uri="mqtt+nio+ssl://0.0.0.0:8883?transport.defaultKeepAlive=60000&amp;transport.maximumConnections=1000&amp;transport.socketBufferSize=131072&amp;transport.ioBufferSize=16384&amp;transport.activeMQSubscriptionPrefetch=32766&amp;transport.publishDollarTopics=true&amp;transport.subscriptionStrategy=mqtt-virtual-topic-subscriptions"/>
<transportConnector name="tcp"
Expand Down
2 changes: 1 addition & 1 deletion assembly/broker/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ENV ACTIVEMQ_OPTS "-Dcommons.db.schema.update=true \
-Dcertificate.jwt.certificate=file:///var/opt/activemq/cert.pem \
-Dbroker.ip=broker"

EXPOSE 1883 8883 61614 61615 8161
EXPOSE 1883 1893 8883 61614 61615 8161

VOLUME /opt/activemq/data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import java.util.Map;

import org.eclipse.kapua.broker.core.plugin.KapuaConnectionContext;
import org.eclipse.kapua.broker.core.plugin.KapuaSecurityContext;

import com.google.common.base.Splitter;

Expand All @@ -31,11 +31,11 @@ public class DefaultSystemMessageCreator implements SystemMessageCreator {
private static final String USERNAME_KEY = "Username";

@Override
public String createMessage(SystemMessageType systemMessageType, KapuaConnectionContext kbc) {
public String createMessage(SystemMessageType systemMessageType, KapuaSecurityContext kapuaSecurityContext) {
StringBuilder builder = new StringBuilder();
builder.append(EVENT_KEY).append(PAIR_SEPARATOR).append(systemMessageType.name());
builder.append(FIELD_SEPARATOR).append(DEVICE_ID_KEY).append(PAIR_SEPARATOR).append(kbc.getClientId());
builder.append(FIELD_SEPARATOR).append(USERNAME_KEY).append(PAIR_SEPARATOR).append(kbc.getUserName());
builder.append(FIELD_SEPARATOR).append(DEVICE_ID_KEY).append(PAIR_SEPARATOR).append(kapuaSecurityContext.getClientId());
builder.append(FIELD_SEPARATOR).append(USERNAME_KEY).append(PAIR_SEPARATOR).append(kapuaSecurityContext.getUserName());
return builder.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*******************************************************************************/
package org.eclipse.kapua.broker.core.message.system;

import org.eclipse.kapua.broker.core.plugin.KapuaConnectionContext;
import org.eclipse.kapua.broker.core.plugin.KapuaSecurityContext;

/**
* System message creator (i.e message sent by the broker on device connect)
Expand All @@ -29,9 +29,9 @@ enum SystemMessageType {
* Create a system message
*
* @param systemMessageType
* @param kbc
* @param kapuaSecurityContext
* @return
*/
String createMessage(SystemMessageType systemMessageType, KapuaConnectionContext kbc);
String createMessage(SystemMessageType systemMessageType, KapuaSecurityContext kapuaSecurityContext);

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2020 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.broker.core.plugin;

import org.apache.activemq.security.AuthorizationMap;

public class KapuaSecurityAclChecker {

private AuthorizationMap authMap;
private boolean hasDataView;
private boolean hasDataManage;
private boolean hasDeviceView;
private boolean hasDeviceManage;

}
Loading