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

Include client certificates in KapuaConnectionContext #1950

Merged
merged 1 commit into from
Sep 18, 2018
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.security.cert.Certificate;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -47,6 +48,7 @@ public class KapuaConnectionContext {
private ConnectorDescriptor connectorDescriptor;
private boolean[] hasPermissions;
private String brokerIpOrHostName;
private Certificate[] clientCertificates;

// use to track the allowed destinations for debug purpose
private List<String> authDestinations;
Expand All @@ -64,6 +66,9 @@ public KapuaConnectionContext(String brokerId, ConnectionInfo info) {
clientId = info.getClientId();
clientIp = info.getClientIp();
connectionId = info.getConnectionId().getValue();
if(info.getTransportContext() instanceof Certificate[]) {
clientCertificates = (Certificate[]) info.getTransportContext();
}
}

public KapuaConnectionContext(String brokerId, KapuaPrincipal kapuaPrincipal, ConnectionInfo info, String fullClientIdPattern) {
Expand Down Expand Up @@ -125,6 +130,10 @@ public String getBrokerId() {
return brokerId;
}

public Certificate[] getClientCertificates() {
return clientCertificates;
}

public String getUserName() {
return userName;
}
Expand Down