-
Notifications
You must be signed in to change notification settings - Fork 14
US77579: Created an interface that connectors should implement to get… #88
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
Conversation
| import java.util.Set; | ||
|
|
||
| public interface AttributeStore { | ||
| Set<Attribute> getAttributes(String identifier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extend this interface to DefaultAttributeStore with method Set getAttributesByCriteria(String identifier, Set criteria)
| .thenReturn(subject); | ||
| Set<String> criteria = Collections.singleton("someCriteria"); | ||
| this.defaultSubjectAttributeStore.getAttributesByCriteria(subject.getSubjectIdentifier(), criteria); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This expectedException would change with the new DefaultAttributeStore interface. See above comment
| private PolicyEvaluationCacheCircuitBreaker cache; | ||
|
|
||
| @SuppressWarnings("unchecked") | ||
| @Test(enabled = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why explicitly enable the test?
| testSubject.setSubjectIdentifier("/test/subject"); | ||
|
|
||
| Set<Attribute> supplementalSubjectAttributes = new HashSet<>(); | ||
| supplementalSubjectAttributes.add(new Attribute("https://acs.attributes.int", "site", "sanramon")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this test isn't asserting anything nor expecting any exceptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FrankGasparovic , this test is asserting that if subject doesn't have any attributes but supplemental attributes are passed in, then supplemental attributes are returned by the attribute resolver.
|
|
||
| public interface AttributeStore { | ||
| Set<Attribute> getAttributes(String identifier); | ||
| Set<Attribute> getAttributesByCriteria(String identifier, Set<?> criteria); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- getting subject attributes by 'scope' has a specific meaning, so i suggest we keep that naming.
getAttributesByScope(String identified, Set<Attribute> scopes). - keep the criteria to a specific type (
Set<Attribute>) and name(scopes) as well. When we have another usecase, we can add a new method for it. - also raises the question if we should have 2 separate interfaces at this level for Subject and Resource - the underlying implementation can still be shared.
|
|
||
| import java.util.Set; | ||
|
|
||
| public interface AttributeStore { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use a name which implies that is is read-only. AttributeReader or similar ?
| this.privilegeService = privilegeService; | ||
| public ResourceAttributeResolver(final AttributeStore resourceAttributeStore, | ||
| final String requestResourceUri, | ||
| final Set<Attribute> supplementalResourceAttributes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this format is better, though is not per our current project settings. pls re-concile
| MockitoAnnotations.initMocks(this); | ||
| } | ||
|
|
||
| @Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add a test for existing resource as well. (and subject for DefaultSubject store)
| } | ||
|
|
||
| @Test | ||
| public void testGetAttributesByCriteriaForNonExistentSubject() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for all criteria related test, isn't it sufficient to test that DefaultSubjectAttributeStore calls the corresponding call on the PrivilegeManagementService with the appropriate criteria/scopes ?
| } | ||
|
|
||
| @Test | ||
| public void testGetSubjectAttributesSubjectFoundWithAttributesAndNoSupplementalAttributes() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testGetResourceAttributesWithAttributesAndNoSupplementalAttributes ?
6fce478 to
978fc28
Compare
… attributes and refactored existing code to adhere to said interface Signed-off-by: Irina <[email protected]>
978fc28 to
9afbb6d
Compare
All your comments have been addressed
… attributes and refactored existing code to adhere to said interface
Signed-off-by: Irina [email protected]