You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Vijay Kumar <vi...@rackspace.com> on 2009/08/19 18:04:32 UTC

Invalid property 'modularAuthenticationStrategy' of bean class [org.apache.shiro.web.DefaultWebSecurityManager]

Peter,
I uninstalled my jsecurity-0.3 plugin and installed the shiro-1.0-SNAPSHOT plugin.
I am sure I have changed all the class referecences, taglibs, and name of the security manager to point to the new plugin.
Also, from your earlier response to my  post, I changed in Config.groovy

security.shiro.authentication.strategy = new org.apache.shiro.authc.pam.AtLeastOneSuccessfulStrategy()


However I am still getting the following error on startup

     [exec] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroSecurityManager': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'modularAuthenticationStrategy' of bean class [org.apache.shiro.web.DefaultWebSecurityManager]: Bean property 'modularAuthenticationStrategy' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
     [exec]     at java.security.AccessController.doPrivileged(Native Method)

But when I remove the above line that sets the auth strategy from Config.groovy, the app starts normally and seems to be working correctly.

My question is, if we need to change the authentication strategy to a non-default value, or if you want to explicitly specify a auth strategy,  how do I get rid of the above exception.

I am on grails 1.1.1


Thanks
Vijay Kumar




Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@rackspace.com, and delete the original message.
Your cooperation is appreciated.


Re: Invalid property 'modularAuthenticationStrategy' of bean class [org.apache.shiro.web.DefaultWebSecurityManager]

Posted by Les Hazlewood <lh...@apache.org>.
On Fri, Aug 21, 2009 at 3:47 AM, Peter Ledbrook<pe...@cacoethes.co.uk> wrote:
>
> One other thing: I may make AtLeastOneSuccessfulStrategy the default
> for the plugin. If you have more than one realm, I'm convinced it's
> the more common strategy to use.

You probably won't have to do that.  I'm convinced as well this should
be the default for Shiro anyway.  Everyone seems to ask for this w/
multi-realm configurations, so I'll pose this on the dev list.  If
there are no objections, I'll update it sometime this weekend.

- Les

Re: Invalid property 'modularAuthenticationStrategy' of bean class [org.apache.shiro.web.DefaultWebSecurityManager]

Posted by Peter Ledbrook <pe...@cacoethes.co.uk>.
> It's a bug. Line 118 of ShiroGrailsPlugin.groovy should read:
>
>  authenticationStrategy =
> application.config.security.shiro.authentication.strategy
>
> In other words, the "modularAuthenticationStrategy" property was
> renamed to "authenticationStrategy".

I'm going to change the way this works. Setting the strategy via
Config.groovy effectively bypasses the standard Spring configuration
mechanism, which isn't a great idea in my view. Instead, you will be
able to provide your own bean configuration for
"shiroAuthenticationStrategy" in either resources.groovy or
resources.xml. This has the added benefit that dependent plugins can
easily provide their own defaults (think of the Nimble plugin).

In other words, you'll be able to add something like:

beans = {
    shiroAuthenticationStrategy(org.apache.shiro.authc.pam.AtLeastOneSuccessfulStrategy)
}

to resources.groovy.

One other thing: I may make AtLeastOneSuccessfulStrategy the default
for the plugin. If you have more than one realm, I'm convinced it's
the more common strategy to use.

Cheers,

Peter

Re: Invalid property 'modularAuthenticationStrategy' of bean class [org.apache.shiro.web.DefaultWebSecurityManager]

Posted by Peter Ledbrook <pe...@cacoethes.co.uk>.
> However I am still getting the following error on startup
>
>      [exec] org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'shiroSecurityManager': Error setting property
> values; nested exception is
> org.springframework.beans.NotWritablePropertyException: Invalid property
> 'modularAuthenticationStrategy' of bean class
> [org.apache.shiro.web.DefaultWebSecurityManager]: Bean property
> 'modularAuthenticationStrategy' is not writable or has an invalid setter
> method. Does the parameter type of the setter match the return type of the
> getter?
>      [exec]     at java.security.AccessController.doPrivileged(Native
> Method)

It's a bug. Line 118 of ShiroGrailsPlugin.groovy should read:

  authenticationStrategy =
application.config.security.shiro.authentication.strategy

In other words, the "modularAuthenticationStrategy" property was
renamed to "authenticationStrategy".

You can temporarily modify the plugin by creating (or editing) the
grails-app/conf/BuildConfig.groovy file and adding the line:

  grails.project.plugins.dir = "plugins"

This will install the plugin into the project's "plugins" directory
(which will be created) and then you can modify the
ShiroGrailsPlugin.groovy file directly.

Cheers,

Peter