Skip to content

Commit 854ba5b

Browse files
authored
JCL-326: Remove deprecated methods and classes (#590)
1 parent 553deb5 commit 854ba5b

File tree

23 files changed

+5
-763
lines changed

23 files changed

+5
-763
lines changed

access-grant/src/main/java/com/inrupt/client/accessgrant/AccessCredential.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,6 @@ public static class CredentialMetadata {
201201
private final Instant expiration;
202202
private final Instant issuedAt;
203203

204-
/**
205-
* A collection of server-managed credential metadata.
206-
*
207-
* @param issuer the issuer
208-
* @param creator the agent who created the credential
209-
* @param types the credential types
210-
* @param expiration the credential expiration
211-
* @param status the credential status
212-
* @deprecated as of Beta4, please use the 6-parameter constructor
213-
*/
214-
@Deprecated
215-
public CredentialMetadata(final URI issuer, final URI creator, final Set<String> types,
216-
final Instant expiration, final Status status) {
217-
this(issuer, creator, types, Instant.now(), expiration, status);
218-
}
219-
220204
/**
221205
* A collection of server-managed credential metadata.
222206
*

access-grant/src/main/java/com/inrupt/client/accessgrant/AccessGrant.java

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -62,30 +62,6 @@ protected AccessGrant(final URI identifier, final String credential, final Crede
6262
super(identifier, credential, data, metadata);
6363
}
6464

65-
/**
66-
* Create an AccessGrant object from a VerifiablePresentation.
67-
*
68-
* @param accessGrant the access grant
69-
* @return a parsed access grant
70-
* @deprecated As of Beta3, please use the {@link AccessGrant#of} method
71-
*/
72-
@Deprecated
73-
public static AccessGrant ofAccessGrant(final String accessGrant) {
74-
return of(accessGrant);
75-
}
76-
77-
/**
78-
* Create an AccessGrant object from a VerifiablePresentation.
79-
*
80-
* @param accessGrant the access grant
81-
* @return a parsed access grant
82-
* @deprecated As of Beta3, please use the {@link AccessGrant#of} method
83-
*/
84-
@Deprecated
85-
public static AccessGrant ofAccessGrant(final InputStream accessGrant) {
86-
return of(accessGrant);
87-
}
88-
8965
/**
9066
* Create an AccessGrant object from a serialized form.
9167
*
@@ -114,50 +90,6 @@ public static AccessGrant of(final InputStream serialization) {
11490
}
11591
}
11692

117-
/**
118-
* Get the purposes of the access grant.
119-
*
120-
* @return the access grant purposes
121-
* @deprecated as of Beta3, please use the {@link #getPurposes()} method
122-
*/
123-
@Deprecated
124-
public Set<String> getPurpose() {
125-
return getPurposes().stream().map(URI::toString).collect(Collectors.toSet());
126-
}
127-
128-
/**
129-
* Get the agent to whom access is granted.
130-
*
131-
* @return the agent that was granted access
132-
* @deprecated As of Beta3, please use {@link #getRecipient}
133-
*/
134-
@Deprecated
135-
public Optional<URI> getGrantee() {
136-
return getRecipient();
137-
}
138-
139-
/**
140-
* Get the agent who granted access.
141-
*
142-
* @return the agent granting access
143-
* @deprecated As of Beta3, please use {@link #getCreator}
144-
*/
145-
@Deprecated
146-
public URI getGrantor() {
147-
return getCreator();
148-
}
149-
150-
/**
151-
* Get the raw access grant.
152-
*
153-
* @return the access grant
154-
* @deprecated as of Beta3, please use the {@link #serialize} method
155-
*/
156-
@Deprecated
157-
public String getRawGrant() {
158-
return serialize();
159-
}
160-
16193
static Set<String> getSupportedTypes() {
16294
final Set<String> types = new HashSet<>();
16395
types.add("SolidAccessGrant");

access-grant/src/main/java/com/inrupt/client/accessgrant/AccessGrantClient.java

Lines changed: 0 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -300,63 +300,6 @@ public CompletionStage<AccessDenial> denyAccess(final AccessRequest request) {
300300
});
301301
}
302302

303-
/**
304-
* Issue an access grant or request.
305-
*
306-
* @param type the credential type
307-
* @param recipient the receiving agent for this credential
308-
* @param resources the resources to which this credential applies
309-
* @param modes the access modes for this credential
310-
* @param purposes the purposes of this credential
311-
* @param expiration the expiration time of this credential
312-
* @return the next stage of completion containing the resulting credential
313-
* @deprecated as of Beta3, please use the {@link #requestAccess} or {@link #grantAccess} methods
314-
*/
315-
@Deprecated
316-
public CompletionStage<AccessGrant> issue(final URI type, final URI recipient, final Set<URI> resources,
317-
final Set<String> modes, final Set<String> purposes, final Instant expiration) {
318-
Objects.requireNonNull(type, "Access Grant type may not be null!");
319-
Objects.requireNonNull(resources, "Resources may not be null!");
320-
Objects.requireNonNull(modes, "Access modes may not be null!");
321-
final Set<URI> uriPurposes = new HashSet<>();
322-
for (final String p : purposes) {
323-
try {
324-
uriPurposes.add(URI.create(p));
325-
} catch (final IllegalArgumentException ex) {
326-
LOGGER.debug("Ignoring non-URI purpose: {}", ex.getMessage());
327-
}
328-
}
329-
return v1Metadata().thenCompose(metadata -> {
330-
final Map<String, Object> data;
331-
if (FQ_ACCESS_GRANT.equals(type)) {
332-
data = buildAccessGrantv1(recipient, resources, modes, uriPurposes, expiration, null);
333-
} else if (FQ_ACCESS_REQUEST.equals(type)) {
334-
data = buildAccessRequestv1(recipient, resources, modes, uriPurposes, expiration, null);
335-
} else {
336-
throw new AccessGrantException("Unsupported grant type: " + type);
337-
}
338-
339-
final Request req = Request.newBuilder(metadata.issueEndpoint)
340-
.header(CONTENT_TYPE, APPLICATION_JSON)
341-
.POST(Request.BodyPublishers.ofByteArray(serialize(data))).build();
342-
343-
return client.send(req, Response.BodyHandlers.ofInputStream())
344-
.thenApply(res -> {
345-
try (final InputStream input = res.body()) {
346-
final int status = res.statusCode();
347-
if (isSuccess(status)) {
348-
return processVerifiableCredential(input, ACCESS_GRANT_TYPES, AccessGrant.class);
349-
}
350-
throw new AccessGrantException("Unable to issue Access Grant: HTTP error " + status,
351-
status);
352-
} catch (final IOException ex) {
353-
throw new AccessGrantException(
354-
"Unexpected I/O exception while processing Access Grant", ex);
355-
}
356-
});
357-
});
358-
}
359-
360303
/**
361304
* Verify an access grant or request.
362305
*
@@ -481,52 +424,6 @@ private <T extends AccessCredential> CompletionStage<List<T>> query(final URI re
481424
});
482425
}
483426

484-
/**
485-
* Perform an Access Grant query and returns 0 to N matching Access Grants.
486-
*
487-
* <p>The {@code type} parameter must be an absolute URI. For Access Requests,
488-
* the URI is {@code http://www.w3.org/ns/solid/vc#SolidAccessRequest}. For Access Grants, the URI
489-
* is {@code http://www.w3.org/ns/solid/vc#SolidAccessGrant}. Other URIs may be defined in the future.
490-
*
491-
* @param type the Access Grant type
492-
* @param agent the agent identifier, may be {@code null}
493-
* @param resource the resource identifier, may be {@code null}
494-
* @param mode the access mode, may be {@code null}
495-
* @return the next stage of completion, including the matched Access Grants
496-
* @deprecated as of Beta3, please use the alternative {@link #query} method
497-
*/
498-
@Deprecated
499-
public CompletionStage<List<AccessGrant>> query(final URI type, final URI agent, final URI resource,
500-
final String mode) {
501-
Objects.requireNonNull(type, "The type parameter must not be null!");
502-
return v1Metadata().thenCompose(metadata -> {
503-
final List<CompletableFuture<List<AccessGrant>>> futures = buildQuery(config.getIssuer(), type,
504-
resource, null, agent, Collections.emptySet(), Collections.singleton(mode)).stream()
505-
.map(data -> Request.newBuilder(metadata.queryEndpoint)
506-
.header(CONTENT_TYPE, APPLICATION_JSON)
507-
.POST(Request.BodyPublishers.ofByteArray(serialize(data))).build())
508-
.map(req -> client.send(req, Response.BodyHandlers.ofInputStream())
509-
.thenApply(res -> {
510-
try (final InputStream input = res.body()) {
511-
final int status = res.statusCode();
512-
if (isSuccess(status)) {
513-
return processQueryResponse(input, ACCESS_GRANT_TYPES, AccessGrant.class);
514-
}
515-
throw new AccessGrantException("Unable to perform Access Grant query: HTTP error " +
516-
status, status);
517-
} catch (final IOException ex) {
518-
throw new AccessGrantException(
519-
"Unexpected I/O exception while processing Access Grant query", ex);
520-
}
521-
}).toCompletableFuture())
522-
.collect(Collectors.toList());
523-
524-
return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
525-
.thenApply(x -> futures.stream().map(CompletableFuture::join).flatMap(List::stream)
526-
.collect(Collectors.toList()));
527-
});
528-
}
529-
530427
/**
531428
* Revoke an access credential.
532429
*
@@ -562,39 +459,6 @@ public CompletionStage<Void> revoke(final AccessCredential credential) {
562459
});
563460
}
564461

565-
/**
566-
* Delete an access credential.
567-
*
568-
* @param credential the access credential
569-
* @return the next stage of completion
570-
* @deprecated as of Beta4
571-
*/
572-
573-
@Deprecated
574-
public CompletionStage<Void> delete(final AccessCredential credential) {
575-
final Request req = Request.newBuilder(credential.getIdentifier()).DELETE().build();
576-
return client.send(req, Response.BodyHandlers.discarding())
577-
.thenAccept(res -> {
578-
final int status = res.statusCode();
579-
if (!isSuccess(status)) {
580-
throw new AccessGrantException("Unable to delete Access Credential: " + credential.getIdentifier(),
581-
status);
582-
}
583-
});
584-
}
585-
586-
/**
587-
* Fetch an access credential by identifier. Return at most one access credential or throws an exception.
588-
*
589-
* @param identifier the access credential identifier
590-
* @return the next stage of completion, containing the access credential
591-
* @deprecated as of Beta3, please use the {@link #fetch(URI, Class)} method
592-
*/
593-
@Deprecated
594-
public CompletionStage<AccessGrant> fetch(final URI identifier) {
595-
return fetch(identifier, AccessGrant.class);
596-
}
597-
598462
/**
599463
* Fetch an access credential by identifier. Return at most one access credential or throws an exception.
600464
*

access-grant/src/main/java/com/inrupt/client/accessgrant/AccessGrantSession.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import java.util.Optional;
4343
import java.util.Set;
4444
import java.util.UUID;
45-
import java.util.concurrent.CompletableFuture;
4645
import java.util.concurrent.CompletionStage;
4746
import java.util.concurrent.ConcurrentSkipListMap;
4847

@@ -158,17 +157,6 @@ public CompletionStage<Optional<Credential>> authenticate(final Authenticator au
158157
});
159158
}
160159

161-
/* deprecated */
162-
@Override
163-
public CompletionStage<Optional<Credential>> authenticate(final Request request,
164-
final Set<String> algorithms) {
165-
final Optional<Credential> grant = getCredential(VERIFIABLE_CREDENTIAL, request.uri());
166-
if (grant.isPresent()) {
167-
return CompletableFuture.completedFuture(grant);
168-
}
169-
return session.authenticate(request, algorithms);
170-
}
171-
172160
@Override
173161
public Optional<Credential> fromCache(final Request request) {
174162
final Credential cachedToken = tokenCache.get(cacheKey(request.uri()));

0 commit comments

Comments
 (0)