Application Registration
To Register
Authenticate with Client Credentials
/**
* **Note** 1: OpenIdSession.ofClientCredentials
* Using the client credentials, create an authenticated session.
*/
final Session session = OpenIdSession.ofClientCredentials(
URI.create(System.getenv("MY_SOLID_IDP")).normalize(),
System.getenv("MY_SOLID_CLIENT_ID"),
System.getenv("MY_SOLID_CLIENT_SECRET"),
"client_secret_basic");
/**
* **Note** 2: SolidSyncClient
* Instantiates a synchronous client for the authenticated session.
* The client has methods to perform CRUD operations.
*/
final SolidSyncClient client = SolidSyncClient.getClient().session(session);
/**
* **Note** 3: SolidSyncClient.read()
* Using the SolidSyncClient client.read() method,
* - Reads the RDF resource into the Expense class, which extends SolidRDFSource class
*/
final URI uri = URI.create(resourceURL).normalize();
try (Expense resource = client.read(uri, Expense.class)) {
// Various Processing
} catch (NotFoundException e1) {
// ...
} catch(ForbiddenException e2) {
// ...
} catch(Exception e) {
// ...
}Configuration
Last updated