David Brown
David Brown

Reputation: 3061

How do we configure the grails shiro plugin v1.1.3?

I'm finding it very difficult in discovering the correct method to configure my app to work with the plug, I am using grails 1.3.6 and the Shiro plugin 1.1.3

I've setup my application according the quick-start guide on the plugin docs site but when I want to configure things further, i.e. set the login success URL I'm finding myself hitting roadblocks.

What I don't understand is after research I see 3 ways of setting options..

  1. setting explicit options as single lines in config.groovy i.e. security.shiro.redirectUrl = "/blah"

  2. Quite often I see this type of block on nabble and Stack Overflow but with no hint where it goes:

    security { shiro { filter { successUrl:"/blah/" } } }

I tried this approach to set the successUrl but it has no effect.

  1. I've seen references to the SecurityFilters.groovy file but cannot see where I would put a successUrl in this file..

So if anyone can clear this up for me, that'd be great :-)

Thanks,

Upvotes: 3

Views: 513

Answers (1)

julx
julx

Reputation: 9091

Well, it's a shame, but reading through the source code of ShiroFilters, it seems like controller: "auth", action: "login" is hardcoded. So basically when you hit a secured address the redirect will fire. After you handle the authentication action you may choose whatever address you like for your destination, using or not the targetUri value that is supplied in params.

If you really need to customize that, I'd suggest editing the sources. You could even add some more configurability here supplying grailsApplication though dependency injection and reading from its ".config" parameter.

Upvotes: 3

Related Questions