Skip to content

Commit

Permalink
fix(core): Revert "feat(core): Add attributes client" (#124)
Browse files Browse the repository at this point in the history
Reverts #118
  • Loading branch information
elizabethhealy committed Aug 20, 2024
1 parent 6c50bee commit 3d1ef2b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 143 deletions.
1 change: 0 additions & 1 deletion cmdline/src/main/java/io/opentdf/platform/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Stream;

@CommandLine.Command(name = "tdf")
class Command {
Expand Down
40 changes: 0 additions & 40 deletions sdk/src/main/java/io/opentdf/platform/sdk/AttributesClient.java

This file was deleted.

16 changes: 4 additions & 12 deletions sdk/src/main/java/io/opentdf/platform/sdk/SDK.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import io.opentdf.platform.authorization.AuthorizationServiceGrpc;
import io.opentdf.platform.authorization.AuthorizationServiceGrpc.AuthorizationServiceFutureStub;
import io.opentdf.platform.policy.attributes.AttributesServiceGrpc;
import io.opentdf.platform.policy.attributes.GetAttributeValuesByFqnsRequest;
import io.opentdf.platform.policy.attributes.AttributesServiceGrpc.AttributesServiceFutureStub;
import io.opentdf.platform.policy.namespaces.NamespaceServiceGrpc;
import io.opentdf.platform.policy.namespaces.NamespaceServiceGrpc.NamespaceServiceFutureStub;
Expand All @@ -14,9 +13,6 @@
import io.opentdf.platform.policy.subjectmapping.SubjectMappingServiceGrpc;
import io.opentdf.platform.policy.subjectmapping.SubjectMappingServiceGrpc.SubjectMappingServiceFutureStub;
import io.opentdf.platform.sdk.nanotdf.NanoTDFType;
import io.opentdf.platform.policy.attributes.GetAttributeValuesByFqnsResponse;

import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -49,20 +45,17 @@ public interface KAS extends AutoCloseable {
byte[] unwrapNanoTDF(NanoTDFType.ECCurve curve, String header, String kasURL);
}

public interface AttributesService extends AutoCloseable {
GetAttributeValuesByFqnsResponse getAttributeValuesByFqn(GetAttributeValuesByFqnsRequest request);
}

// TODO: add KAS
public interface Services extends AutoCloseable {
AuthorizationServiceFutureStub authorization();
AttributesService attributes();
AttributesServiceFutureStub attributes();
NamespaceServiceFutureStub namespaces();
SubjectMappingServiceFutureStub subjectMappings();
ResourceMappingServiceFutureStub resourceMappings();
KAS kas();

static Services newServices(ManagedChannel channel, KAS kas, AttributesService attributeService) {
static Services newServices(ManagedChannel channel, KAS kas) {
var attributeService = AttributesServiceGrpc.newFutureStub(channel);
var namespaceService = NamespaceServiceGrpc.newFutureStub(channel);
var subjectMappingService = SubjectMappingServiceGrpc.newFutureStub(channel);
var resourceMappingService = ResourceMappingServiceGrpc.newFutureStub(channel);
Expand All @@ -72,12 +65,11 @@ static Services newServices(ManagedChannel channel, KAS kas, AttributesService a
@Override
public void close() throws Exception {
channel.shutdownNow();
attributeService.close();
kas.close();
}

@Override
public AttributesService attributes() {
public AttributesServiceFutureStub attributes() {
return attributeService;
}

Expand Down
8 changes: 2 additions & 6 deletions sdk/src/main/java/io/opentdf/platform/sdk/SDKBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,24 +193,20 @@ ServicesAndInternals buildServices() {

var authInterceptor = getGrpcAuthInterceptor(dpopKey);
ManagedChannel channel;
ManagedChannel attributesChannel;
Function<String, ManagedChannel> managedChannelFactory;
if (authInterceptor == null) {
channel = getManagedChannelBuilder(platformEndpoint).build();
attributesChannel = getManagedChannelBuilder(platformEndpoint).build();
managedChannelFactory = (String endpoint) -> getManagedChannelBuilder(endpoint).build();

} else {
channel = getManagedChannelBuilder(platformEndpoint).intercept(authInterceptor).build();
attributesChannel = getManagedChannelBuilder(platformEndpoint).intercept(authInterceptor).build();
managedChannelFactory = (String endpoint) -> getManagedChannelBuilder(endpoint).intercept(authInterceptor).build();
}
var kasclient = new KASClient(managedChannelFactory, dpopKey);
var attrclient = new AttributesClient(attributesChannel);
var client = new KASClient(managedChannelFactory, dpopKey);
return new ServicesAndInternals(
authInterceptor,
sslFactory == null ? null : sslFactory.getTrustManager().orElse(null),
SDK.Services.newServices(channel, kasclient, attrclient)
SDK.Services.newServices(channel, client)
);
}

Expand Down
84 changes: 0 additions & 84 deletions sdk/src/test/java/io/opentdf/platform/sdk/AttributeClientTest.java

This file was deleted.

0 comments on commit 3d1ef2b

Please sign in to comment.