List of usage examples for org.apache.shiro.mgt RealmSecurityManager setCacheManager
public void setCacheManager(CacheManager cacheManager)
From source file:com.josue.kingdom.security.CustomEnvironmentLoaderListener.java
@Override protected WebEnvironment createEnvironment(ServletContext pServletContext) { LOG.log(Level.INFO, "########## INITIALIZING CUSTOMENVIRONMENTLOADERLISTENER ##########"); WebEnvironment environment = super.createEnvironment(pServletContext); RealmSecurityManager rsm = (RealmSecurityManager) environment.getSecurityManager(); //TODO check for how to read from shiro.ini // PasswordService passwordService = new DefaultPasswordService(); // PasswordMatcher passwordMatcher = new PasswordMatcher(); // passwordMatcher.setPasswordService(passwordService); // jpaRealm.setCredentialsMatcher(passwordMatcher); //TODO add another realms here Set<Realm> realms = new HashSet<>(); realms.add(apiCredentialJPARealm);/*from w w w . ja va 2 s . c om*/ realms.add(managerJPARealm); rsm.setRealms(realms); rsm.setCacheManager(new MemoryConstrainedCacheManager()); ((DefaultWebEnvironment) environment).setSecurityManager(rsm); return environment; }