Optimize SecurityContext#isInOneOf#1874
Conversation
This method was iterating over a set to find matching entries instead of just using contains(). This updates switches to using contains() which will be faster and also cleans up the code with a for each loop. A small test was added but there are several other authorization tests that already exist that also exercise this method.
bf09c56 to
db8c589
Compare
aa14c8c to
daf2b9f
Compare
|
I removed the copying of the set from getPrincipals() because this was not only inefficient but also not thread safe. I looked around and the sub classes of |
tabish121
left a comment
There was a problem hiding this comment.
LGTM definitely an improvement on overall code quality.
|
No reason to back port this to older branches really as it's just some optimization and cleanup so we can just keep it for 6.3.0 |
This reverts commit b404e1e.
This reverts commit b404e1e. This change needs more work because DefaultAuthorizationMap requires equals() to be used the way it handles a wildcard Principal. This needs to be fixed before the change can be made
|
This is being reverted in #1875 because it needs some more work |
This is an update to apache#1874 which fixes the previous issue with wildcard principal handling which caused things to break This method was iterating over a set to find matching entries instead of just using contains(). This update switches to using contains() which will be faster and also cleans up the code with a for each loop. The wildcard principal handling was simplified inside DefaultAuthorizationMap by just using a predefined static object to mark that everything should be allowed if the name is "*" A small test was added but there are several other authorization tests that already exist that also exercise this method.
This is an update to apache#1874 which fixes the previous issue with wildcard principal handling which caused things to break This method was iterating over a set to find matching entries instead of just using contains(). This update switches to using contains() which will be faster and also cleans up the code with a for each loop. The wildcard principal handling was simplified by using a predefined static object inside SecurityContext to mark that everything should be allowed if the name is "*". DefaultAuthorizationMap now references this and uses this object when parsing ACLs if a wildcard is used. Because it's been moved to SecurityContext it's flexible and can be used by other impls as well. A small test was added but there are several other authorization tests that already exist that also exercise this method.
This is an update to apache#1874 which fixes the previous issue with wildcard principal handling which caused things to break This method was iterating over a set to find matching entries instead of just using contains(). This update switches to using contains() which will be faster and also cleans up the code with a for each loop. The wildcard principal handling was simplified by using a predefined static object inside SecurityContext to mark that everything should be allowed if the name is "*". DefaultAuthorizationMap now references this and uses this object when parsing ACLs if a wildcard is used. Because it's been moved to SecurityContext it's flexible and can be used by other impls as well. A small test was added but there are several other authorization tests that already exist that also exercise this method.
This is an update to #1874 which fixes the previous issue with wildcard principal handling which caused things to break This method was iterating over a set to find matching entries instead of just using contains(). This update switches to using contains() which will be faster and also cleans up the code with a for each loop. The wildcard principal handling was simplified by using a predefined static object inside SecurityContext to mark that everything should be allowed if the name is "*". DefaultAuthorizationMap now references this and uses this object when parsing ACLs if a wildcard is used. Because it's been moved to SecurityContext it's flexible and can be used by other impls as well. A small test was added but there are several other authorization tests that already exist that also exercise this method.
This method was iterating over a set to find matching entries instead of just using contains(). This updates switches to using contains() which will be faster and also cleans up the code with a for each loop.
A small test was added but there are several other authorization tests that already exist that also exercise this method.