Package com.inrupt.client.accessgrant
Classes for working with Access Grants.
This module provides utilities for using Access Grants in Solid Applications. There are three primary classes used for this.
AccessGrant: this class represents either a SolidAccessGrant
or a
SolidAccessRequest
. A developer can parse an AccessGrant
from a String
or
InputStream
in the following way:
try (InputStream stream = fetchAccessGrant()) {
AccessGrant accessGrant = AccessGrant.ofAccessGrant(data);
}
AccessGrantSession: this class can be used to build a Session
object that uses Access Grants when negotiating for access tokens. These sessions will also need an
OpenID-based session.
AccessGrant accessGrant1 = AccessGrant.ofAccessGrant(data1);
AccessGrant accessGrant2 = AccessGrant.ofAccessGrant(data2);
Session openid = OpenIdSession.ofIdToken(idToken);
Session session = AccessGrantSession.ofAccessGrant(openid, accessGrant1, accessGrant2);
SolidClient client = SolidClient.getClient().session(session);
AccessGrantClient: this class can be used for managing the lifecycle of Access Grants:
creation, deletion, revocation and query. This client will require a suitable
Session
object, typically an OpenID-based session:
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);
AccessGrantClient client = new AccessGrantClient(issuer).session(session);
URI resource = URI.create("https://storage.example/data/resource");
client.query(SOLID_ACCESS_GRANT, null, resource, null)
.thenApply(grants -> AccessGrantSession.ofAccessGrant(openid, grants.toArray(new AccessGrant[0])))
.thenApply(session -> SolidClient.getClient().session(session))
.thenAccept(cl -> {
// Do something with the Access Grant-scoped client
});
-
Class Summary Class Description AccessGrant An Access Grant abstraction, for use with interacting with Solid resources.AccessGrantClient A client for interacting with and managing Access Grant Resources.AccessGrantSession A session implementation that makes use of Access Grants.Status A class for representing status information of an Access Grant. -
Exception Summary Exception Description AccessGrantException A runtime exception for use with Access Grants.