Skip to content

Conversation

@acoburn
Copy link
Collaborator

@acoburn acoburn commented Jun 14, 2023

This adds an AccessCredentialQuery class to make it easier to add permutations to the query interface. In particular, this makes it possible to add multiple access modes ("Read", "Write") and purpose identifiers to a query.

Otherwise, one needs to make multiple requests with the client and manage the set operations manually.

This builder looks like this:

var q = AccessCredentialQuery.newBuilder()
        .resource(uri)
        .recipient(agent)
        .purpose(purpose1)
        .purpose(purpose2)
        .mode("Read")
        .mode("Write")
        .build(AccessGrant.class);

client.query(q)
        .toCompletableFuture()
        .join();

@acoburn acoburn requested a review from kay-kim June 14, 2023 21:04
@acoburn acoburn requested a review from a team as a code owner June 14, 2023 21:04
Copy link

@kay-kim kay-kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me!

Copy link
Contributor

@timea-solid timea-solid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elegant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the tests cover cases where either multiple modes or purposes are set, would it be worth adding one?

* @return the resource, may be {@code null}
*/
public URI getResource() {
return resource;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if it may not be supported by all Access Management Applications, an Access Grant may cover multiple resources. Is it something that should be reflected in the querying capabilities? Or do we want to push this constraint down to the client libraries, in which case we should consider the same for the JC client.

@acoburn acoburn enabled auto-merge (squash) June 15, 2023 13:12
@acoburn acoburn merged commit 2265c44 into main Jun 15, 2023
@acoburn acoburn deleted the JCL-382-query-builder branch June 15, 2023 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants