FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

JCL-394: AccessRequest builder by acoburn · Pull Request #577 · inrupt/solid-client-java · GitHub

Repository navigation

JCL-394: AccessRequest builder - #577

Merged
acoburn merged 5 commits into
mainfrom
JCL-394-access-request-builder
Jul 11, 2023
Merged

acoburn merged 5 commits into
mainfrom
JCL-394-access-request-builder

Conversation

acoburn commented Jul 7, 2023 •
edited
Loading

Copy link
Copy Markdown
Contributor

This adds the implementation code for a builder pattern for access requests. In particular, this makes it possible to set an issuance date in the future, which is otherwise not possible in the current API.

The first commit just adds the boilerplate code for the new AccessRequest.RequestParameter class and connects that to the AccessGrantClient.requestAccess method (adding a new overload). The getIssuedAt value is then propagated through the rest of the methods (e.g. grantAccess() and denyAccess()).

Note: I re-ordered the parameters for some internal (private) methods to group the arguments into a more logical order. This does not affect the public API.

Some items still needed here include:

  • javadocs
  • tests

The way this would be used is like so:

var req = AccessRequest.RequestParameters.newBuilder()
        .recipient(agent)
        .resource(uri)
        .modes(modes)
        .purposes(purposes)
        .expiration(expiration)
        .issuedAt(issuance).build();

agclient.requestAccess(req);

acoburn requested a review from a team July 7, 2023 19:39

Copy link
Copy Markdown
Contributor

Looks good to me.
CI fails because of other known CI problems. (once we merge my PR, we should see clearer any problem).

NSeydoux commented Jul 10, 2023 •
edited
Loading

Copy link
Copy Markdown
Contributor

Just to make sure I understand this pattern: the Builder constructor being package-private means that the only way to go is to do

var req = AccessRequest.RequestParameters.Builder().....build()

? I expected the AccessRequest.RequestParameters class to have a static method to instantiate the builder, like it is done in e.g. SolidSyncClient, and as your initial code snippet hinted @acoburn .

acoburn commented Jul 10, 2023

Copy link
Copy Markdown
Contributor Author

@NSeydoux you are right, we're missing a static method: newBuilder(), which I would have seen as soon as I started writing tests, and which I will get to today :-)

acoburn force-pushed the JCL-394-access-request-builder branch from 68fd974 to c396c0e Compare July 10, 2023 22:06
* @return this builder
*/
public Builder purposes(final Collection<URI> purposes) {
if (purposes != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't think there is a test case for a collection cleared this way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

acoburn enabled auto-merge (squash) July 11, 2023 11:45
acoburn merged commit cbb3e22 into main Jul 11, 2023
acoburn deleted the JCL-394-access-request-builder branch July 11, 2023 12:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL