Skip to content

Commit

Permalink
Include client certificates in KapuaConnectionContext
Browse files Browse the repository at this point in the history
Signed-off-by: Elbert Evangelista <elbert.evangelista@eurotech.com>
  • Loading branch information
elbert3 authored and Coduz committed Nov 6, 2018
1 parent b0b3f95 commit ddbb4f1
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit ddbb4f1

Please sign in to comment.