shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Les Hazlewood <lhazlew...@apache.org>
Subject Request for feedback - name for Shiro component Map?
Date Sun, 15 May 2011 19:39:40 GMT
While working on SHIRO-293 [1], I realized that the typical way of
setting up a Shiro web environment with the current Factory mechanism
isn't right.  That is, the following code for a web application isn't
sufficient:

Factory<SecurityManager> secMgrFactory = new
IniSecurityManagerFactory("classpath:shiro.ini");
SecurityManager secMgr = secMgrFactory.getInstance();

The reason is that web environments require more objects than just the
SecurityManager.  At a minimum, in addition to the SecurityManager, we
must be able to acquire the various Servlet Filters that might be
configured (authc, login, etc).

So, instead it makes more sense to have this for web apps:

Factory<Map<String,?>> environmentFactory = ....

where the map is composed of an object name in the INI config (the
key) to object (the value) mapping.  From there we can acquire
anything that was created as a result of INI config.

However, referencing Map<String,?> all over the place imposes a
sloppy-looking API.  So I believe we should create an interface that
represents that Map<String,?> of Shiro objects.

What should it be called?

In the Spring world, this concept is called an 'ApplicationContext',
which more or less makes sense.  But what should we call this one?
ApplicationEnvironment?  Keep in mind that this map of objects is
application-specific (i.e. static memory not necessary).

Any ideas?

Thanks,

Les

[1] https://issues.apache.org/jira/browse/SHIRO-291

Mime
View raw message