Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strawman delegate implementation #8

Closed
wants to merge 26 commits into from
Closed

strawman delegate implementation #8

wants to merge 26 commits into from

Conversation

acoburn
Copy link
Contributor

@acoburn acoburn commented Aug 27, 2015

This doesn't even pretend to be a correct implementation (it doesn't even consider type-based accessToClass resources), but it is a start. Please feel free to tear it apart!


final List<URI> actionURIs = actionsAsURIs(actions);

final Optional<URI> effectiveACL = getEffectiveAcl(new FedoraResourceImpl(userSession.getNode(absPath)));
Copy link
Member

Choose a reason for hiding this comment

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

We may need an "internal-session" as the userSession will likely not have permissions to read the ACL resources.

@awoods
Copy link
Member

awoods commented Aug 27, 2015

@acoburn
Copy link
Contributor Author

acoburn commented Aug 27, 2015

I would also note that I used Optional<boolean> instead of a more straight-forward Predicate because we actually need to differentiate between null, true and false, where true means "permit the operation", false means "deny the operation" and null means try the next authorization mechanism (starting with user, then moving to group and finally trying rdf:type for acl:accessToClass properties). If none of those provide a non-null response, then deny the request (i.e. permit = false).

@@ -15,6 +15,17 @@
*/
package org.fcrepo.auth.webac;

// The WEBAC_HAS_ACL variable does not exist (we don't even have a namespace for it yet).
import static org.fcrepo.auth.webac.URIConstants.WEBAC_HAS_ACL;
Copy link
Member

Choose a reason for hiding this comment

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

Could we use acl:accessControl for this? From the ontology

<rdf:Property rdf:about="http://www.w3.org/ns/auth/acl#accessControl">
    <comment>The Access Control file for this information resource.
    This may of course be a virtual resorce implemented by the access control system.
    Note also HTTP's header  Link:  foo.meta ;rel=meta can be used for this.</comment>
    <domain rdf:resource="http://www.w3.org/2006/gen/ont#InformationResource"/>
    <label>access control</label>
    <range rdf:resource="http://www.w3.org/2006/gen/ont#InformationResource"/>
    <subPropertyOf rdf:resource="http://www.w3.org/2000/01/rdf-schema#seeAlso"/>
</rdf:Property>

Copy link
Member

Choose a reason for hiding this comment

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

@whikloj, that property seems appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 nice call

@awoods
Copy link
Member

awoods commented Aug 28, 2015

@acoburn, are we actually planning on hijacking acl:accessToClass? Do you not have concerns about then changing gears in phase two towards dereferencing those URIs to get the membership of those "groups"?
Unless we do not have such phase-two plans.

@acoburn
Copy link
Contributor Author

acoburn commented Aug 28, 2015

@awoods If you look at the examples in the WebAC wiki, you will see that acl:accessToClass is used, e.g. to reference foaf:Document. The range is any rdfs:Class of resources, so using that to reference ex:AdminImage or ex:ArchivalObject as in:

<> acl:accessToClass ex:ArchivalObject, ex:AdminImage ;
    acl:agent <http://myinstitution.edu/groups/admins> ;
    acl:mode acl:Read, acl:Write .

Do you feel that this diverges from what the WebACL document lays out?

@awoods
Copy link
Member

awoods commented Aug 28, 2015

@acoburn, nevermind... I was mentally hooked on acl:agentClass not acl:accessToClass. Disregard.

map.put("DELETE", WEBAC_MODE_WRITE);
map.put("PATCH", WEBAC_MODE_WRITE);
map.put("OPTIONS", WEBAC_MODE_READ);
actionMap = Collections.unmodifiableMap(map);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea if this matches any type of reality. Is the actions array (below) composed of Strings like "GET", or "POST"? Without knowing any better, that's what I'm assuming.

Copy link
Contributor

Choose a reason for hiding this comment

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

Incidentally, if @acoburn is correct, this is one reason why we don't want to have resources created or updated or deleted by requests to URIs that aren't their own.

@awoods
Copy link
Member

awoods commented Sep 1, 2015

Are we scrapping this PR in favor of a new one? or is there a plan for closure today?

@acoburn
Copy link
Contributor Author

acoburn commented Sep 1, 2015

I'm still working on this PR, though it is dependent on @whikloj and the creation of a WebACRolesProvider interface

@whikloj
Copy link
Member

whikloj commented Sep 2, 2015

Sorry, but I thought @mohideen was going to work on the WebACRolesProvider implementation as he was already working on the AuthHandler interface, I was working on the WebACAuthenticationImpl. Did I get that mixed up?

@acoburn acoburn force-pushed the delegate_impl branch 3 times, most recently from d294e09 to d51d883 Compare September 3, 2015 16:23
@acoburn
Copy link
Contributor Author

acoburn commented Sep 4, 2015

Added unit tests with the provided TTL resources. Added more debugging log output. Need to add more comments, and have support for acls residing on ancestor nodes.

mohideen and others added 13 commits September 4, 2015 11:26
Conflicts:
	src/main/java/org/fcrepo/auth/webac/WebACAuthorizationDelegate.java
	src/main/java/org/fcrepo/auth/webac/impl/WebACAccessRolesProvider.java
	src/test/java/org/fcrepo/auth/webac/impl/WebACAccessRolesProviderTest.java
REGISTER_TYPE
CREATE_WORKSPACE
DELETE_WORKSPACE
RESTORE

Added:
ADD_NODE
Updated the Map with ModeshapePermissions to WebAC access modes.
Removed RBACL-based test class.
Added license header, and move WebACRecipesIT into the correct package.
@acoburn acoburn mentioned this pull request Sep 5, 2015
@acoburn
Copy link
Contributor Author

acoburn commented Sep 5, 2015

This PR is now deprecated in favor of #28 (and other yet-to-be-issued PRs)

@awoods
Copy link
Member

awoods commented Sep 6, 2015

@acoburn, please feel free to close this PR if that is the intent of your previous comment.

@acoburn acoburn closed this Sep 6, 2015
@acoburn acoburn deleted the delegate_impl branch September 8, 2015 11:24
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.

None yet

6 participants