@@ -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 *
0 commit comments