Skip to content

Commit

Permalink
Merge pull request #166 from carlos-schmidt/fix/trusted-or-unencrypte…
Browse files Browse the repository at this point in the history
…d-urls

Fix unencrypted and trusted services failing registration
  • Loading branch information
carlos-schmidt authored Oct 31, 2024
2 parents 8e516ce + 6ea48dc commit bd85319
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Result<AasDataProcessor> processorFor(URL aasUrl) {
protected abstract Result<Certificate[]> getCertificates(URL url);

protected Result<@Nullable Certificate[]> retrieveCertificates(URL aasUrl) {
if (isTrusted(aasUrl)) {
if (isTrusted(aasUrl) || "http".equalsIgnoreCase(aasUrl.getProtocol())) {
return Result.success(null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import java.security.cert.Certificate;
import java.util.Set;

import static de.fraunhofer.iosb.ssl.impl.DefaultSelfSignedCertificateRetriever.isTrusted;

public class RegisteredAasDataProcessorFactory extends AasDataProcessorFactory {

private final Set<AasAccessUrl> registeredAasServices;
Expand All @@ -43,6 +45,10 @@ public RegisteredAasDataProcessorFactory(SelfSignedCertificateRetriever retrieve

@Override
protected Result<@Nullable Certificate[]> getCertificates(URL url) {
if (isTrusted(url) || "http".equalsIgnoreCase(url.getProtocol())) {
return Result.success(null);
}

if (registeredAasServices == null || !registeredAasServices.contains(new AasAccessUrl(url))) {
return Result.failure("AAS service is not registered and allowing all self-signed certificates is " +
"disabled");
Expand Down

0 comments on commit bd85319

Please sign in to comment.