Skip to content

Commit

Permalink
Bug 572366 verify product's public key on hc-fls interaction
Browse files Browse the repository at this point in the history
Supply Hashes registry through  Framework facility

Signed-off-by: eparovyshnaya <[email protected]>
  • Loading branch information
eparovyshnaya committed Mar 30, 2021
1 parent 769bfad commit 63ef7bd
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import org.eclipse.passage.lic.internal.api.conditions.mining.MiningEquipment;
import org.eclipse.passage.lic.internal.api.inspection.RuntimeEnvironment;
import org.eclipse.passage.lic.internal.api.inspection.RuntimeEnvironmentRegistry;
import org.eclipse.passage.lic.internal.api.io.Hashes;
import org.eclipse.passage.lic.internal.api.io.HashesRegistry;
import org.eclipse.passage.lic.internal.api.io.KeyKeeper;
import org.eclipse.passage.lic.internal.api.io.KeyKeeperRegistry;
import org.eclipse.passage.lic.internal.api.io.StreamCodec;
Expand Down Expand Up @@ -187,4 +189,9 @@ public final LicenseAcquisitionServicesRegistry acquirers() {
return () -> acquirers;
}

@Override
public HashesRegistry hashes() {
return () -> new ReadOnlyRegistry<StringServiceId, Hashes>();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package org.eclipse.passage.lbc.internal.fls.seal;

import java.util.Arrays;
import java.util.Collections;
import java.util.function.Supplier;

import org.eclipse.passage.lic.internal.api.AccessCycleConfiguration;
Expand All @@ -33,6 +34,8 @@
import org.eclipse.passage.lic.internal.api.conditions.mining.MiningEquipment;
import org.eclipse.passage.lic.internal.api.inspection.RuntimeEnvironment;
import org.eclipse.passage.lic.internal.api.inspection.RuntimeEnvironmentRegistry;
import org.eclipse.passage.lic.internal.api.io.Hashes;
import org.eclipse.passage.lic.internal.api.io.HashesRegistry;
import org.eclipse.passage.lic.internal.api.io.KeyKeeper;
import org.eclipse.passage.lic.internal.api.io.KeyKeeperRegistry;
import org.eclipse.passage.lic.internal.api.io.StreamCodec;
Expand Down Expand Up @@ -71,6 +74,7 @@ abstract class BaseAccessCycleConfiguration implements AccessCycleConfiguration
private final Registry<EvaluationType, ExpressionTokenAssessmentService> tokenAssessors;
private final Registry<EvaluationType, RuntimeEnvironment> environments;
private final Registry<StringServiceId, PermissionsExaminationService> examinators;
private final Registry<StringServiceId, Hashes> hashes;

protected BaseAccessCycleConfiguration(Supplier<LicensedProduct> product, Supplier<Bundle> bundle) {
requirements = new ReadOnlyRegistry<>(Arrays.asList(//
Expand Down Expand Up @@ -107,6 +111,7 @@ protected BaseAccessCycleConfiguration(Supplier<LicensedProduct> product, Suppli
examinators = new ReadOnlyRegistry<>(Arrays.asList(//
new BasePermissionsExaminationService()//
));
hashes = new ReadOnlyRegistry<>(Collections.emptyList());
}

@Override
Expand Down Expand Up @@ -164,4 +169,9 @@ public final PermissionsExaminationServicesRegistry examinators() {
return () -> examinators;
}

@Override
public HashesRegistry hashes() {
return () -> hashes;
}

}
3 changes: 2 additions & 1 deletion bundles/org.eclipse.passage.lic.api/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ Export-Package: org.eclipse.passage.lic.internal.api;
org.eclipse.passage.loc.operator.gear,
org.eclipse.passage.loc.products.core,
org.eclipse.passage.seal.demo,
org.eclipse.passage.loc.api",
org.eclipse.passage.loc.api,
org.eclipse.passage.lic.net",
org.eclipse.passage.lic.internal.api.observatory;x-friends:="org.eclipse.passage.lic.base",
org.eclipse.passage.lic.internal.api.registry;
x-friends:="org.eclipse.passage.lic.base,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.passage.lic.internal.api.conditions.mining.MinedConditionsRegistry;
import org.eclipse.passage.lic.internal.api.conditions.mining.MiningEquipment;
import org.eclipse.passage.lic.internal.api.inspection.RuntimeEnvironmentRegistry;
import org.eclipse.passage.lic.internal.api.io.HashesRegistry;
import org.eclipse.passage.lic.internal.api.io.KeyKeeperRegistry;
import org.eclipse.passage.lic.internal.api.io.StreamCodecRegistry;
import org.eclipse.passage.lic.internal.api.requirements.ResolvedRequirementsRegistry;
Expand Down Expand Up @@ -57,4 +58,6 @@ public interface AccessCycleConfiguration {

LicenseAcquisitionServicesRegistry acquirers();

HashesRegistry hashes();

}
3 changes: 2 additions & 1 deletion bundles/org.eclipse.passage.lic.net/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ Export-Package: org.eclipse.passage.lic.internal.net;
org.eclipse.passage.lbc.base,
org.eclipse.passage.lbc.base.tests,
org.eclipse.passage.lbc.jetty,
org.eclipse.passage.lic.jetty"
org.eclipse.passage.lic.jetty",
org.eclipse.passage.lic.internal.net.io;x-friends:="org.eclipse.passage.lbc.base,org.eclipse.passage.lic.hc"
Bundle-ActivationPolicy: lazy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
import org.eclipse.passage.lic.internal.api.conditions.ConditionMiningTarget;
import org.eclipse.passage.lic.internal.api.conditions.mining.MinedConditions;
import org.eclipse.passage.lic.internal.api.conditions.mining.MinedConditionsRegistry;
import org.eclipse.passage.lic.internal.api.io.Hashes;
import org.eclipse.passage.lic.internal.api.io.HashesRegistry;
import org.eclipse.passage.lic.internal.api.registry.Registry;
import org.eclipse.passage.lic.internal.api.registry.StringServiceId;
import org.eclipse.passage.lic.internal.base.acquire.PathLicenseAcquisitionService;
import org.eclipse.passage.lic.internal.base.conditions.mining.PathResidentConditions;
import org.eclipse.passage.lic.internal.base.registry.ReadOnlyRegistry;
Expand Down Expand Up @@ -49,4 +52,9 @@ public final LicenseAcquisitionServicesRegistry acquirers() {
return () -> acquirers;
}

@Override
public HashesRegistry hashes() {
return () -> new ReadOnlyRegistry<StringServiceId, Hashes>();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
import org.eclipse.passage.lic.internal.api.conditions.ConditionMiningTarget;
import org.eclipse.passage.lic.internal.api.conditions.mining.MinedConditions;
import org.eclipse.passage.lic.internal.api.conditions.mining.MinedConditionsRegistry;
import org.eclipse.passage.lic.internal.api.io.Hashes;
import org.eclipse.passage.lic.internal.api.io.HashesRegistry;
import org.eclipse.passage.lic.internal.api.registry.Registry;
import org.eclipse.passage.lic.internal.api.registry.StringServiceId;
import org.eclipse.passage.lic.internal.base.io.MD5Hashes;
import org.eclipse.passage.lic.internal.base.registry.ReadOnlyRegistry;
import org.eclipse.passage.lic.internal.hc.remote.impl.NetConnection;
import org.eclipse.passage.lic.internal.hc.remote.impl.acquire.RemoteAcquisitionService;
Expand All @@ -32,11 +36,13 @@ final class RemoteAccessCycleConfiguration extends BaseAccessCycleConfiguration

private final Registry<ConditionMiningTarget, MinedConditions> conditions;
private final Registry<ConditionMiningTarget, LicenseAcquisitionService> acquirers;
private final Registry<StringServiceId, Hashes> hashes;

RemoteAccessCycleConfiguration(Supplier<LicensedProduct> product) {
super(product, () -> FrameworkUtil.getBundle(RemoteAccessCycleConfiguration.class));
conditions = new ReadOnlyRegistry<>(new RemoteConditions<NetConnection>(keyKeepers(), codecs(), transports()));
acquirers = new ReadOnlyRegistry<>(new RemoteAcquisitionService<NetConnection>(keyKeepers(), codecs()));
hashes = new ReadOnlyRegistry<>(new MD5Hashes());
}

@Override
Expand All @@ -49,4 +55,9 @@ public LicenseAcquisitionServicesRegistry acquirers() {
return () -> acquirers;
}

@Override
public HashesRegistry hashes() {
return () -> hashes;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
import org.eclipse.passage.lic.internal.api.conditions.ConditionMiningTarget;
import org.eclipse.passage.lic.internal.api.conditions.mining.MinedConditions;
import org.eclipse.passage.lic.internal.api.conditions.mining.MinedConditionsRegistry;
import org.eclipse.passage.lic.internal.api.io.Hashes;
import org.eclipse.passage.lic.internal.api.io.HashesRegistry;
import org.eclipse.passage.lic.internal.api.registry.Registry;
import org.eclipse.passage.lic.internal.api.registry.StringServiceId;
import org.eclipse.passage.lic.internal.base.acquire.UserHomeLicenseAcquisitionService;
import org.eclipse.passage.lic.internal.base.conditions.mining.UserHomeResidentConditions;
import org.eclipse.passage.lic.internal.base.registry.ReadOnlyRegistry;
Expand Down Expand Up @@ -61,4 +64,9 @@ public LicenseAcquisitionServicesRegistry acquirers() {
return () -> acquirers;
}

@Override
public HashesRegistry hashes() {
return () -> new ReadOnlyRegistry<StringServiceId, Hashes>();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.passage.lic.internal.api.conditions.mining.MinedConditionsRegistry;
import org.eclipse.passage.lic.internal.api.conditions.mining.MiningEquipment;
import org.eclipse.passage.lic.internal.api.inspection.RuntimeEnvironmentRegistry;
import org.eclipse.passage.lic.internal.api.io.HashesRegistry;
import org.eclipse.passage.lic.internal.api.io.KeyKeeperRegistry;
import org.eclipse.passage.lic.internal.api.io.StreamCodecRegistry;
import org.eclipse.passage.lic.internal.api.registry.Registry;
Expand Down Expand Up @@ -123,6 +124,11 @@ public MiningEquipment miningEquipment() {
return null;
}

@Override
public HashesRegistry hashes() {
return () -> noService();
}

}

}

0 comments on commit 63ef7bd

Please sign in to comment.