diff --git a/access-grant/src/main/java/com/inrupt/client/accessgrant/AccessGrantClient.java b/access-grant/src/main/java/com/inrupt/client/accessgrant/AccessGrantClient.java
index 538bb128e44..459dd4b8669 100644
--- a/access-grant/src/main/java/com/inrupt/client/accessgrant/AccessGrantClient.java
+++ b/access-grant/src/main/java/com/inrupt/client/accessgrant/AccessGrantClient.java
@@ -65,7 +65,6 @@
* {@link Session} object, typically an OpenID-based session:
*
*
{@code
- URI SOLID_ACCESS_GRANT = URI.create("http://www.w3.org/ns/solid/vc#SolidAccessGrant");
URI issuer = URI.create("https://issuer.example");
Session openid = OpenIdSession.ofIdToken(idToken);
@@ -73,7 +72,7 @@
URI resource = URI.create("https://storage.example/data/resource");
URI purpose = URI.create("https://purpose.example/1");
- client.query(null, resource, purpose, "Read", AccessGrant.class)
+ client.query(resource, null, openid.getPrincipal().orElse(null), purpose, "Read", AccessGrant.class)
.thenApply(grants -> AccessGrantSession.ofAccessGrant(openid, grants.toArray(new AccessGrant[0])))
.thenApply(session -> SolidClient.getClient().session(session))
.thenAccept(cl -> {
@@ -89,6 +88,7 @@ public class AccessGrantClient {
private static final String VC_CONTEXT_URI = "https://www.w3.org/2018/credentials/v1";
private static final String INRUPT_CONTEXT_URI = "https://schema.inrupt.com/credentials/v1.jsonld";
private static final String VERIFIABLE_CREDENTIAL = "verifiableCredential";
+ private static final String SOLID_VC_NAMESPACE = "http://www.w3.org/ns/solid/vc#";
private static final String TYPE = "type";
private static final String APPLICATION_JSON = "application/json";
private static final String CONTENT_TYPE = "Content-Type";
@@ -102,9 +102,12 @@ public class AccessGrantClient {
private static final String FOR_PURPOSE = "forPurpose";
private static final String EXPIRATION_DATE = "expirationDate";
private static final String CREDENTIAL = "credential";
- private static final URI ACCESS_GRANT = URI.create("http://www.w3.org/ns/solid/vc#SolidAccessGrant");
- private static final URI ACCESS_REQUEST = URI.create("http://www.w3.org/ns/solid/vc#SolidAccessRequest");
- private static final URI ACCESS_DENIAL = URI.create("http://www.w3.org/ns/solid/vc#SolidAccessDenial");
+ private static final String SOLID_ACCESS_GRANT = "SolidAccessGrant";
+ private static final String SOLID_ACCESS_REQUEST = "SolidAccessRequest";
+ private static final String SOLID_ACCESS_DENIAL = "SolidAccessDenial";
+ private static final URI FQ_ACCESS_GRANT = URI.create(SOLID_VC_NAMESPACE + SOLID_ACCESS_GRANT);
+ private static final URI FQ_ACCESS_REQUEST = URI.create(SOLID_VC_NAMESPACE + SOLID_ACCESS_REQUEST);
+ private static final URI FQ_ACCESS_DENIAL = URI.create(SOLID_VC_NAMESPACE + SOLID_ACCESS_DENIAL);
private static final Set ACCESS_GRANT_TYPES = getAccessGrantTypes();
private static final Set ACCESS_REQUEST_TYPES = getAccessRequestTypes();
private static final Set ACCESS_DENIAL_TYPES = getAccessDenialTypes();
@@ -301,9 +304,9 @@ public CompletionStage issue(final URI type, final URI agent, final
}
return v1Metadata().thenCompose(metadata -> {
final Map data;
- if (ACCESS_GRANT.equals(type)) {
+ if (FQ_ACCESS_GRANT.equals(type)) {
data = buildAccessGrantv1(agent, resources, modes, expiration, uriPurposes);
- } else if (ACCESS_REQUEST.equals(type)) {
+ } else if (FQ_ACCESS_REQUEST.equals(type)) {
data = buildAccessRequestv1(agent, resources, modes, expiration, uriPurposes);
} else {
throw new AccessGrantException("Unsupported grant type: " + type);
@@ -377,27 +380,28 @@ public CompletionStage verify(final AccessCredenti
* Perform an Access Grant query.
*
* @param the AccessCredential type
- * @param agent the agent identifier, may be {@code null}
* @param resource the resource identifier, may be {@code null}
+ * @param creator the identifier for the agent who created the credential, may be {@code null}
+ * @param recipient the identifier for the agent who is the recipient for the credential, may be {@code null}
* @param purpose the access purpose, may be {@code null}
* @param mode the access mode, may be {@code null}
* @param clazz the AccessCredential type, either {@link AccessGrant} or {@link AccessRequest}
- * @return the next stage of completion, including the matched Access Grants
+ * @return the next stage of completion, including the matched Access Credentials
*/
- public CompletionStage> query(final URI agent, final URI resource,
- final URI purpose, final String mode, final Class clazz) {
+ public CompletionStage> query(final URI resource, final URI creator,
+ final URI recipient, final URI purpose, final String mode, final Class clazz) {
Objects.requireNonNull(clazz, "The clazz parameter must not be null!");
final URI type;
final Set supportedTypes;
if (AccessGrant.class.isAssignableFrom(clazz)) {
- type = URI.create("SolidAccessGrant");
+ type = URI.create(SOLID_ACCESS_GRANT);
supportedTypes = ACCESS_GRANT_TYPES;
} else if (AccessRequest.class.isAssignableFrom(clazz)) {
- type = URI.create("SolidAccessRequest");
+ type = URI.create(SOLID_ACCESS_REQUEST);
supportedTypes = ACCESS_REQUEST_TYPES;
} else if (AccessDenial.class.isAssignableFrom(clazz)) {
- type = URI.create("SolidAccessDenial");
+ type = URI.create(SOLID_ACCESS_DENIAL);
supportedTypes = ACCESS_DENIAL_TYPES;
} else {
throw new AccessGrantException("Unsupported type " + clazz + " in query request");
@@ -405,7 +409,7 @@ public CompletionStage> query(final URI age
return v1Metadata().thenCompose(metadata -> {
final List>> futures = buildQuery(config.getIssuer(), type,
- agent, resource, purpose, mode).stream()
+ resource, creator, recipient, purpose, mode).stream()
.map(data -> Request.newBuilder(metadata.queryEndpoint)
.header(CONTENT_TYPE, APPLICATION_JSON)
.POST(Request.BodyPublishers.ofByteArray(serialize(data))).build())
@@ -451,7 +455,7 @@ public CompletionStage> query(final URI type, final URI agent,
Objects.requireNonNull(type, "The type parameter must not be null!");
return v1Metadata().thenCompose(metadata -> {
final List>> futures = buildQuery(config.getIssuer(), type,
- agent, resource, null, mode).stream()
+ resource, null, agent, null, mode).stream()
.map(data -> Request.newBuilder(metadata.queryEndpoint)
.header(CONTENT_TYPE, APPLICATION_JSON)
.POST(Request.BodyPublishers.ofByteArray(serialize(data))).build())
@@ -683,26 +687,26 @@ static Collection