You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by kreca <jo...@gmail.com> on 2010/12/21 17:42:44 UTC

RealmFactory not working properly

Hi,
Im trying to use a realmFactory to register a realm.

The config is quite simple:

[main]
realmFactory = se.example.init.MyRealmFactory
authc.loginUrl = /

After debugging the problem I stumbled upon the following lines in 

org.apache.shiro.config.IniSecurityManagerFactory (Line 173 in version
1.1.0)

private void addToRealms(Collection<Realm> realms, RealmFactory factory) {
        LifecycleUtils.init(factory);
        Collection<Realm> factoryRealms = factory.getRealms();
        if (!CollectionUtils.isEmpty(realms)) {
            realms.addAll(factoryRealms);
        }
}


Of particular interest is the 
if (!CollectionUtils.isEmpty(realms)) 
line. 
How come the realms defined in my factory should not be added unless there
already exists defined realms?


Best regards
Jonas
-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/RealmFactory-not-working-properly-tp5855695p5855695.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: RealmFactory not working properly

Posted by Les Hazlewood <lh...@apache.org>.
Hi Jonas,

Please open a Jira issue and we can get this committed.  This stuff
tends to get lost on mailing lists.

Thanks!

Cheers,

Les

On Fri, Dec 31, 2010 at 4:38 AM, kreca <jo...@gmail.com> wrote:
>
> On Fri, Dec 31, 2010 at 10:24 AM, mmix [via Shiro User]
> <ml...@n2.nabble.com> wrote:
>> Hi Jonas,
>> I came across the same problem. Seems to me that this is really a bug.
>
> Yah, I changed
> if (!CollectionUtils.isEmpty(realms)) {
> to
> if (!CollectionUtils.isEmpty(factoryRealms)) {
>
> and it all works fine now. Hopefully this can be committed so we do
> not have to roll our own packages
>
> Regards,
> Jonas
>
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/RealmFactory-not-working-properly-tp5855695p5877902.html
> Sent from the Shiro User mailing list archive at Nabble.com.

Re: RealmFactory not working properly

Posted by kreca <jo...@gmail.com>.
On Fri, Dec 31, 2010 at 10:24 AM, mmix [via Shiro User]
<ml...@n2.nabble.com> wrote:
> Hi Jonas,
> I came across the same problem. Seems to me that this is really a bug.

Yah, I changed
if (!CollectionUtils.isEmpty(realms)) {
to
if (!CollectionUtils.isEmpty(factoryRealms)) {

and it all works fine now. Hopefully this can be committed so we do
not have to roll our own packages

Regards,
Jonas

-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/RealmFactory-not-working-properly-tp5855695p5877902.html
Sent from the Shiro User mailing list archive at Nabble.com.