use of com.adeptj.modules.security.shiro.listener.ExtEnvironmentLoaderListener 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);
}
Aggregations