@@ -461,90 +461,6 @@ <T extends AccessCredential> T cast(final Map<String, Object> data, final Class<
461461 return null ;
462462 }
463463
464- /**
465- * Perform an Access Credentials query and returns 0 to N matching access credentials.
466- *
467- * @param <T> the AccessCredential type
468- * @param resource the resource identifier, may be {@code null}
469- * @param creator the identifier for the agent who created the credential, may be {@code null}
470- * @param recipient the identifier for the agent who is the recipient for the credential, may be {@code null}
471- * @param purpose the access purpose, may be {@code null}
472- * @param mode the access mode, may be {@code null}
473- * @param clazz the AccessCredential type, either {@link AccessGrant} or {@link AccessRequest}
474- * @return the next stage of completion, including the matched Access Credentials
475- * @deprecated As of 1.3, replaced by {@link #query(CredentialFilter)}
476- */
477- @ Deprecated
478- public <T extends AccessCredential > CompletionStage <List <T >> query (final URI resource , final URI creator ,
479- final URI recipient , final URI purpose , final String mode , final Class <T > clazz ) {
480-
481- final Set <String > modes = mode != null ? Collections .singleton (mode ) : Collections .emptySet ();
482- final Set <URI > purposes = purpose != null ? Collections .singleton (purpose ) : Collections .emptySet ();
483-
484- return query (resource , creator , recipient , purposes , modes , clazz );
485- }
486-
487- /**
488- * Perform an Access Credentials query and returns 0 to N matching access credentials.
489- *
490- * @param <T> the AccessCredential type
491- * @param query the access credential query, never {@code null}
492- * @return the next stage of completion, including the matched Access Credentials
493- * @deprecated As of 1.3, replaced by {@link #query(CredentialFilter)}
494- */
495- @ Deprecated
496- public <T extends AccessCredential > CompletionStage <List <T >> query (final AccessCredentialQuery <T > query ) {
497- Objects .requireNonNull (query , "The query may not be null!" );
498- return query (query .getResource (), query .getCreator (), query .getRecipient (), query .getPurposes (),
499- query .getModes (), query .getAccessCredentialType ());
500- }
501-
502- private <T extends AccessCredential > CompletionStage <List <T >> query (final URI resource , final URI creator ,
503- final URI recipient , final Set <URI > purposes , final Set <String > modes , final Class <T > clazz ) {
504- Objects .requireNonNull (clazz , "The clazz parameter must not be null!" );
505-
506- final URI type ;
507- final Set <String > supportedTypes ;
508- if (AccessGrant .class .isAssignableFrom (clazz )) {
509- type = URI .create (SOLID_ACCESS_GRANT );
510- supportedTypes = ACCESS_GRANT_TYPES ;
511- } else if (AccessRequest .class .isAssignableFrom (clazz )) {
512- type = URI .create (SOLID_ACCESS_REQUEST );
513- supportedTypes = ACCESS_REQUEST_TYPES ;
514- } else if (AccessDenial .class .isAssignableFrom (clazz )) {
515- type = URI .create (SOLID_ACCESS_DENIAL );
516- supportedTypes = ACCESS_DENIAL_TYPES ;
517- } else {
518- throw new AccessGrantException ("Unsupported type " + clazz + " in query request" );
519- }
520-
521- return v1Metadata ().thenApply (metadata -> {
522- if (metadata .deriveEndpoint == null ) {
523- throw new AccessGrantException ("Server does not support queries via AccessCredentialQuery objects" );
524- }
525- final List <T > responses = new ArrayList <>();
526- for (final Map <String , Object > data :
527- buildQuery (config .getIssuer (), type , resource , creator , recipient , purposes , modes )) {
528- final Request req = Request .newBuilder (metadata .deriveEndpoint )
529- .header (CONTENT_TYPE , APPLICATION_JSON )
530- .POST (Request .BodyPublishers .ofByteArray (serialize (data ))).build ();
531- final Response <InputStream > response = client .send (req , Response .BodyHandlers .ofInputStream ())
532- .toCompletableFuture ().join ();
533-
534- try (final InputStream input = response .body ()) {
535- final int status = response .statusCode ();
536- if (isSuccess (status )) {
537- responses .addAll (processQueryResponse (input , supportedTypes , clazz ));
538- }
539- } catch (final IOException ex ) {
540- throw new AccessGrantException (
541- "Unexpected I/O exception while processing Access Grant query" , ex );
542- }
543- }
544- return responses ;
545- });
546- }
547-
548464 /**
549465 * Revoke an access credential.
550466 *
@@ -682,7 +598,6 @@ CompletionStage<Metadata> v1Metadata() {
682598 })
683599 .thenApply (metadata -> {
684600 final Metadata m = new Metadata ();
685- m .deriveEndpoint = asUri (metadata .get ("derivationService" ));
686601 m .queryEndpoint = asUri (metadata .get ("queryService" ));
687602 m .issueEndpoint = asUri (metadata .get ("issuerService" ));
688603 m .verifyEndpoint = asUri (metadata .get ("verifierService" ));
0 commit comments