Repository navigation
Generate allowed permissions per request + more - #962
Merged
Merged
Conversation
RubenVerborgh
approved these changes
Sep 24, 2021
RubenVerborgh
left a comment
Member
There was a problem hiding this comment.
Excellent work.
My suggestions:
- Only realized this when everything was done, but we now have
PermissionsExtractor,PermissionReader,PermissionsandPermissionSet(notice thesdifferences). The reader and the set are the new ones. The extractor we might get rid off when moving permission handling to the operator handlers. Any preference on where to go with this? Similarly we haveCredentialsExtractor,CredentialsandCredentialSet.
-
Permissions=>Modes -
PermissionSet=>Permissions -
PermissionsExtractor=> keep -
PermissionReader=>PermissionsReaderorPermissionsManager(I dislike the termManager, but it does clear up the confusion "where does it read from? from the request?') orPermissionsStore -
Credentials=>Credential -
CredentialSet=> either keep orCredentials -
CredentialsExtractor=> either keep orCredentialExtractor
- The new class for adding the WAC-Allow metadata has interface
PermissionMetadataWriterand instanceWebAclMetadataWriter. But we already have aMetadataWriterinterface (that converts metadata to response headers, such as theWacAllowMetadataWriter) which might cause some confusion here. Any other suggestions?
PermissionMetadataWriter=>PermissionMetadataCollectorWebAclMetadataWriter=>WebAclMetadataCollector
These readers will determine which permissions are available for the incoming credentials. Their results then get combined in a UnionReader and authorized in a PermissionBasedAuthorizer
This required AuxiliaryStrategy to have a new function indicating if the auxiliary resource just used its associated resource authorization or its own.
jvherweg
force-pushed
the
feat/permissions
branch
from
September 28, 2021 10:02
98eb587 to
2328db5
Compare
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #953
Description of what was changed:
CredentialsExtractorsnow return aCredentialSet. This is a map with the keys being "credential types" (current options being AGENT and EVERYONE), and the values being the correspondingCredentialsfor that type.CredentialSets are then used by the newPermissionReaders to generate the allowed permissions per credential type. The output is aPermissionSet, with the same keys as aCredentialSetbut the values being aPermissionsobject indicating what is allowed.Authorizerwas created that matches the permissions required for the request with the output of thePermissionReadersPermissionMetadataWriterinterface was created to convert permissions to metadata. This is needed for theWAC-Allowheader. This is now a new parameter for the GET and HEAD operator handlers.Permissionsobject was changed to have more standard CRUD permissions:controlwas removed andcreate/deletewere added. In practice we don't use those permissions yet though, they just get the values ofwrite. The acl handler still adds acontrolvalue to the object so we can write the correctWAC-Allowheader.AuxiliaryStrategyhas a new functionusesAssociatedAuthorizationthat indicates if the auxiliary resources should use the authorization of the associated resource or not (true for standard aux resources, false for acl since different fields need to be checked).I'm not sure yet about the
CredentialSetin 1 and thinking of perhaps undoing that and going back to a singleCredentialsobject that we can extend in the future to have more fields (e.g. client so we can support specific access for certain clients). The current solution requires a specific configuration to make sure we have the correct set. On the other hand, the main advantage is that this way we tell thePermissionReaders what keys they need to output for. Otherwise we'll need to do this in a different way.The
AuxiliaryReaderis actually never used since the only auxiliary resource we have are acl resources and those do not use the associated authorization.ldp/permissionsconfig options were changed since theacl.json/no-acl.jsonsplit wasn't relevant anymore due to the changes above. This was changed todefault.json. Perhaps we can remove it. Only relevant case would be if someone wants to support a new PATCH input type.Also asking for some naming suggestions:
PermissionsExtractor,PermissionReader,PermissionsandPermissionSet(notice thesdifferences). The reader and the set are the new ones. The extractor we might get rid off when moving permission handling to the operator handlers. Any preference on where to go with this? Similarly we haveCredentialsExtractor,CredentialsandCredentialSet.PermissionMetadataWriterand instanceWebAclMetadataWriter. But we already have aMetadataWriterinterface (that converts metadata to response headers, such as theWacAllowMetadataWriter) which might cause some confusion here. Any other suggestions?