Re: Tapestry-security CacheManager

Kalle Korhonen <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <CA+=EWnCe7UeReko05X4drkori_EvjWPC1WQ1JSD7pB5Rw57gEw@mail.gmail.com>
Typically, you'd set the desired cachemanager in the realm itself, e.g.:

public class UserRealm extends AuthorizingRealm {
    public UserRealm(...) {
        super(new MemoryConstrainedCacheManager());


Kalle

On Wed, Dec 21, 2016 at 12:47 AM, Charlouze <[email protected]> wrote:

> Hello tapestry users,
>
> I wanted to get rid of the log message that says "*No cache or cacheManager
> properties have been set. Authorization cache cannot be obtained.*".
>
> I read that shiro offers an implementation of their CacheManager using
> EhCache so I tried to set it up.
>
> In order to set the CacheManager I had to override
> TapestryRealmSecurityManager with one of my own (see below) using a
> ServiceOverride contribution. I don't really like using ServiceOverride as
> it feels i'm hacking something. Is there a better way to achieve what I
> want tot do ?
>
> Regards,
> Charles
>
> import org.apache.shiro.cache.CacheManager;
> import org.apache.shiro.mgt.RememberMeManager;
> import org.apache.shiro.mgt.SubjectFactory;
> import org.apache.shiro.realm.Realm;
> import org.tynamo.security.Authenticator;
> import org.tynamo.security.services.TapestryRealmSecurityManager;
>
> import java.util.Collection;
>
> public class MySecurityManager extends TapestryRealmSecurityManager {
>     public MySecurityManager(final Authenticator authenticator, final
> SubjectFactory subjectFactory,
>                                     final RememberMeManager
> rememberMeManager, final Collection<Realm> realms,
>                                     final CacheManager cacheManager) {
>         super(authenticator, subjectFactory, rememberMeManager, realms);
>         setCacheManager(cacheManager);
>     }
> }
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.