Thibault Tigeon created SHIRO-455:
-------------------------------------
Summary: Allowing to cache WildcarPermission in
WildcardPermissionResolver class
Key: SHIRO-455
URL: https://issues.apache.org/jira/browse/SHIRO-455
Project: Shiro
Issue Type: Improvement
Components: Authorization (access control) , Caching
Affects Versions: 1.2.1, 1.2.2
Reporter: Thibault Tigeon
Attachments: shiro-core.patch
Hello,
I am benching Shiro, tahnks this method:
public void bench() {
final Subject subject = SecurityUtils.getSubject();
subject.login(new UsernamePasswordToken(LOGIN+i, PWD));
for (int ind = 0; ind < 100000; ind++) { // a lot of authorizations
assertTrue(subject.isPermitted("medias:album:read"));
}
subject.logout();
}
I see that I waste my time in the methode WildCardPermissionResolver which
create a new instance of permission each time even if it is the same String in
parameter.
I added a map which allows to cache WildcardPermission.
You can find in attachement the patch.
PS : the cache for authorisation is activated:
cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $cacheManager
Regards,
Thibault
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira