Skip to content

Commit a81d0e5

Browse files
Revert "feat(core): Add attributes client (#118)"
This reverts commit 98ba6a9.
1 parent 6c50bee commit a81d0e5

File tree

6 files changed

+9
-155
lines changed

6 files changed

+9
-155
lines changed

.github/workflows/checks.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
--client-secret=secret \
140140
--platform-endpoint=localhost:8080 \
141141
-i \
142-
encrypt --kas-url=localhost:8080 --mime-type=text/plain --attr https://example.com/attr/attr1/value/value1 -f data -m 'here is some metadata' > test.tdf
142+
encrypt --kas-url=localhost:8080 --mime-type=text/plain -f data -m 'here is some metadata' > test.tdf
143143
144144
java -jar target/cmdline.jar \
145145
--client-id=opentdf-sdk \
@@ -175,7 +175,7 @@ jobs:
175175
--client-secret=secret \
176176
--platform-endpoint=localhost:8080 \
177177
-i \
178-
encryptnano --kas-url=http://localhost:8080 --attr https://example.com/attr/attr1/value/value1 -f data -m 'here is some metadata' > nano.ntdf
178+
encryptnano --kas-url=http://localhost:8080 -f data -m 'here is some metadata' > nano.ntdf
179179
180180
java -jar target/cmdline.jar \
181181
--client-id=opentdf-sdk \

cmdline/src/main/java/io/opentdf/platform/Command.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import java.util.List;
3232
import java.util.Optional;
3333
import java.util.function.Consumer;
34-
import java.util.stream.Stream;
3534

3635
@CommandLine.Command(name = "tdf")
3736
class Command {
@@ -53,8 +52,6 @@ void encrypt(
5352
@Option(names = {"-f", "--file"}, defaultValue = Option.NULL_VALUE) Optional<File> file,
5453
@Option(names = {"-k", "--kas-url"}, required = true, split = ",") List<String> kas,
5554
@Option(names = {"-m", "--metadata"}, defaultValue = Option.NULL_VALUE) Optional<String> metadata,
56-
// cant split on optional parameters
57-
@Option(names = {"-a", "--attr"}, defaultValue = Option.NULL_VALUE) Optional<String> attributes,
5855
@Option(names = {"--mime-type"}, defaultValue = Option.NULL_VALUE) Optional<String> mimeType) throws
5956
IOException, JOSEException {
6057

@@ -69,9 +66,6 @@ void encrypt(
6966
configs.add(Config.withKasInformation(kasInfos));
7067
metadata.map(Config::withMetaData).ifPresent(configs::add);
7168
mimeType.map(Config::withMimeType).ifPresent(configs::add);
72-
attributes.ifPresent(attr -> {
73-
configs.add(Config.withDataAttributes(attr.split(",")));
74-
});
7569

7670
var tdfConfig = Config.newTDFConfig(configs.toArray(Consumer[]::new));
7771
try (var in = file.isEmpty() ? new BufferedInputStream(System.in) : new FileInputStream(file.get())) {
@@ -119,8 +113,7 @@ void readMetadata(@Option(names = {"-f", "--file"}, required = true) Path tdfPat
119113
void createNanoTDF(
120114
@Option(names = {"-f", "--file"}, defaultValue = Option.NULL_VALUE) Optional<File> file,
121115
@Option(names = {"-k", "--kas-url"}, required = true) List<String> kas,
122-
@Option(names = {"-m", "--metadata"}, defaultValue = Option.NULL_VALUE) Optional<String> metadata,
123-
@Option(names = {"-a", "--attr"}, defaultValue = Option.NULL_VALUE) Optional<String> attributes) throws Exception {
116+
@Option(names = {"-m", "--metadata"}, defaultValue = Option.NULL_VALUE) Optional<String> metadata) throws Exception {
124117

125118
var sdk = buildSDK();
126119
var kasInfos = kas.stream().map(k -> {
@@ -131,9 +124,6 @@ void createNanoTDF(
131124

132125
List<Consumer<Config.NanoTDFConfig>> configs = new ArrayList<>();
133126
configs.add(Config.withNanoKasInformation(kasInfos));
134-
attributes.ifPresent(attr -> {
135-
configs.add(Config.witDataAttributes(attr.split(",")));
136-
});
137127

138128
var nanoTDFConfig = Config.newNanoTDFConfig(configs.toArray(Consumer[]::new));
139129
try (var in = file.isEmpty() ? new BufferedInputStream(System.in) : new FileInputStream(file.get())) {

sdk/src/main/java/io/opentdf/platform/sdk/AttributesClient.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

sdk/src/main/java/io/opentdf/platform/sdk/SDK.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import io.opentdf.platform.authorization.AuthorizationServiceGrpc;
66
import io.opentdf.platform.authorization.AuthorizationServiceGrpc.AuthorizationServiceFutureStub;
77
import io.opentdf.platform.policy.attributes.AttributesServiceGrpc;
8-
import io.opentdf.platform.policy.attributes.GetAttributeValuesByFqnsRequest;
98
import io.opentdf.platform.policy.attributes.AttributesServiceGrpc.AttributesServiceFutureStub;
109
import io.opentdf.platform.policy.namespaces.NamespaceServiceGrpc;
1110
import io.opentdf.platform.policy.namespaces.NamespaceServiceGrpc.NamespaceServiceFutureStub;
@@ -14,9 +13,6 @@
1413
import io.opentdf.platform.policy.subjectmapping.SubjectMappingServiceGrpc;
1514
import io.opentdf.platform.policy.subjectmapping.SubjectMappingServiceGrpc.SubjectMappingServiceFutureStub;
1615
import io.opentdf.platform.sdk.nanotdf.NanoTDFType;
17-
import io.opentdf.platform.policy.attributes.GetAttributeValuesByFqnsResponse;
18-
19-
import java.util.List;
2016
import org.slf4j.Logger;
2117
import org.slf4j.LoggerFactory;
2218

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

52-
public interface AttributesService extends AutoCloseable {
53-
GetAttributeValuesByFqnsResponse getAttributeValuesByFqn(GetAttributeValuesByFqnsRequest request);
54-
}
55-
5648
// TODO: add KAS
5749
public interface Services extends AutoCloseable {
5850
AuthorizationServiceFutureStub authorization();
59-
AttributesService attributes();
51+
AttributesServiceFutureStub attributes();
6052
NamespaceServiceFutureStub namespaces();
6153
SubjectMappingServiceFutureStub subjectMappings();
6254
ResourceMappingServiceFutureStub resourceMappings();
6355
KAS kas();
6456

65-
static Services newServices(ManagedChannel channel, KAS kas, AttributesService attributeService) {
57+
static Services newServices(ManagedChannel channel, KAS kas) {
58+
var attributeService = AttributesServiceGrpc.newFutureStub(channel);
6659
var namespaceService = NamespaceServiceGrpc.newFutureStub(channel);
6760
var subjectMappingService = SubjectMappingServiceGrpc.newFutureStub(channel);
6861
var resourceMappingService = ResourceMappingServiceGrpc.newFutureStub(channel);
@@ -72,12 +65,11 @@ static Services newServices(ManagedChannel channel, KAS kas, AttributesService a
7265
@Override
7366
public void close() throws Exception {
7467
channel.shutdownNow();
75-
attributeService.close();
7668
kas.close();
7769
}
7870

7971
@Override
80-
public AttributesService attributes() {
72+
public AttributesServiceFutureStub attributes() {
8173
return attributeService;
8274
}
8375

sdk/src/main/java/io/opentdf/platform/sdk/SDKBuilder.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,24 +193,20 @@ ServicesAndInternals buildServices() {
193193

194194
var authInterceptor = getGrpcAuthInterceptor(dpopKey);
195195
ManagedChannel channel;
196-
ManagedChannel attributesChannel;
197196
Function<String, ManagedChannel> managedChannelFactory;
198197
if (authInterceptor == null) {
199198
channel = getManagedChannelBuilder(platformEndpoint).build();
200-
attributesChannel = getManagedChannelBuilder(platformEndpoint).build();
201199
managedChannelFactory = (String endpoint) -> getManagedChannelBuilder(endpoint).build();
202200

203201
} else {
204202
channel = getManagedChannelBuilder(platformEndpoint).intercept(authInterceptor).build();
205-
attributesChannel = getManagedChannelBuilder(platformEndpoint).intercept(authInterceptor).build();
206203
managedChannelFactory = (String endpoint) -> getManagedChannelBuilder(endpoint).intercept(authInterceptor).build();
207204
}
208-
var kasclient = new KASClient(managedChannelFactory, dpopKey);
209-
var attrclient = new AttributesClient(attributesChannel);
205+
var client = new KASClient(managedChannelFactory, dpopKey);
210206
return new ServicesAndInternals(
211207
authInterceptor,
212208
sslFactory == null ? null : sslFactory.getTrustManager().orElse(null),
213-
SDK.Services.newServices(channel, kasclient, attrclient)
209+
SDK.Services.newServices(channel, client)
214210
);
215211
}
216212

sdk/src/test/java/io/opentdf/platform/sdk/AttributeClientTest.java

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)