Search in sources :

Example 1 with CacheProviderTracker

use of com.adeptj.modules.security.shiro.internal.CacheProviderTracker in project adeptj-modules by AdeptJ.

the class ShiroActivator method start.

/**
 * Initializes the Shiro Security Framework.
 */
@Override
public void start(BundleContext context) throws Exception {
    cacheProviderTracker = new CacheProviderTracker(context, CacheProvider.class);
    cacheProviderTracker.open();
    // Register the Shiro EnvironmentLoaderListener first.
    Dictionary<String, Object> shiroListenerProps = new Hashtable<>();
    shiroListenerProps.put(Constants.SERVICE_VENDOR, "AdeptJ");
    shiroListenerProps.put("osgi.http.whiteboard.listener", "true");
    servRegShiroListener = context.registerService(ServletContextListener.class, new ExtEnvironmentLoaderListener(), shiroListenerProps);
    // Now Register the ShiroFilter.
    Dictionary<String, Object> shiroFilterProps = new Hashtable<>();
    shiroFilterProps.put(Constants.SERVICE_VENDOR, "AdeptJ");
    shiroFilterProps.put("osgi.http.whiteboard.filter.name", "Shiro Filter");
    shiroFilterProps.put("osgi.http.whiteboard.filter.pattern", "/*");
    shiroFilterProps.put("osgi.http.whiteboard.filter.asyncSupported", "true");
    shiroFilterProps.put("osgi.http.whiteboard.filter.dispatcher", new String[] { "REQUEST", "INCLUDE", "FORWARD", "ASYNC", "ERROR" });
    servRegShiroFilter = context.registerService(Filter.class, new ShiroFilter(), shiroFilterProps);
}
Also used : ExtEnvironmentLoaderListener(com.adeptj.modules.security.shiro.listener.ExtEnvironmentLoaderListener) CacheProviderTracker(com.adeptj.modules.security.shiro.internal.CacheProviderTracker) ServletContextListener(javax.servlet.ServletContextListener) ShiroFilter(org.apache.shiro.web.servlet.ShiroFilter) Filter(javax.servlet.Filter) Hashtable(java.util.Hashtable) CacheProvider(com.adeptj.modularweb.cache.api.CacheProvider) ShiroFilter(org.apache.shiro.web.servlet.ShiroFilter)

Aggregations

CacheProvider (com.adeptj.modularweb.cache.api.CacheProvider)1 CacheProviderTracker (com.adeptj.modules.security.shiro.internal.CacheProviderTracker)1 ExtEnvironmentLoaderListener (com.adeptj.modules.security.shiro.listener.ExtEnvironmentLoaderListener)1 Hashtable (java.util.Hashtable)1 Filter (javax.servlet.Filter)1 ServletContextListener (javax.servlet.ServletContextListener)1 ShiroFilter (org.apache.shiro.web.servlet.ShiroFilter)1