Skip to content

Commit

Permalink
Fix credential creation
Browse files Browse the repository at this point in the history
  • Loading branch information
grafnu committed Feb 1, 2025
1 parent 8622e5b commit d857f4c
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public void loadCredentials() {
if (isProxied() && hasAuthType()) {
throw new RuntimeException("Proxied devices should not have cloud.auth_type defined");
}
if (!isDirectConnect()) {
if (!hasCloudConnection()) {
return;
}
if (!hasAuthType()) {
Expand Down Expand Up @@ -449,6 +449,10 @@ private Set<String> getCertFiles() {
: Set.of();
}

boolean hasCloudConnection() {
return isDirectConnect() || isGateway();
}

boolean isGateway() {
return config != null && config.isGateway();
}
Expand Down Expand Up @@ -534,7 +538,7 @@ private void setLastActive(Date lastEventTime) {
}

public byte[] getKeyBytes() {
if (!isDirectConnect() && !isGateway()) {
if (!hasCloudConnection()) {
return null;
}
String keyFile = PRIVATE_PKCS8_MAP.get(getAuthType());
Expand Down

0 comments on commit d857f4c

Please sign in to comment.