You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Timothy Sparg <Ti...@corefreight.com> on 2010/11/10 11:02:13 UTC

invalid configuration

Hi all I'm trying to use the jdbcRealm of Shiro, but I seem to be
configuring it incorrectly.

 

 

    <filter>

        <filter-name>ShiroFilter</filter-name>

 
<filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>

        <init-param>

            <param-name>config</param-name>

            <param-value>

                [main]

                coreFreightRealm = org.apache.shiro.realm.jdbc.JdbcRealm

                coreFreightRealm.permissionsLookupEnabled = true

                coreFreightRealm.authenticationQuery = "SELECT password
FROM User WHERE userCode = ?"

                coreFreightRealm.userRolesQuery = "SELECT ActorCode FROM
UserActor WHERE UserCode = ?"

                coreFreightRealm.permissionsQuery = "SELECT ActorDesc
FROM actor WHERE ActorCode = ?"

 

                ds = com.microsoft.sqlserver.jdbc.SQLServerDataSource

                ds.serverName = databaseServer

                ds.user = user

                ds.password = password

                ds.portNumber = 1433

                ds.databaseName = development

                coreFreightRealm.dataSource = $ds

            </param-value>

        </init-param>

    </filter>

 

 

 

Can somebody see what I'm doing wrong?

 

And on another note would it be possible to use a jndi resource instead
of having to configure the database manually?

 

Thanks

Tim


Re: invalid configuration

Posted by "tim.sparg" <ti...@corefreight.com>.
Hi Les

I ended up being a silly error, I forgot to put the [urls] section in, so
Shiro didn't know what to do when a request came in.

I think the idea of the jndi lookups is pretty neat - all my config is
already in my app server, so i would prefer not to have to duplicate it. 
Also the less places that I have to remember to make changes the better!

cheers
Tim
-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/invalid-configuration-tp5724090p5728680.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: invalid configuration

Posted by "tim.sparg" <ti...@corefreight.com>.
Hi Les

It ended up being a user error!

I forgot the [urls] section, so Shiro didn't know how to bind the
SecurityManager.


JNDI lookups would definitely be neat - especially in this case, as the db
pools are going to be set up / administered via the app Server. 
I'm all for reducing the places that I can forget to make changes to!

thanks
Tim
-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/invalid-configuration-tp5724090p5728203.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: invalid configuration

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

The realm config looks good to me - perhaps configuring the DataSource is
where the problem is?  What kind of error are you getting?

In regards to JNDI lookups, we have a JndiRealmFactory that can look up
entire Realms from JNDI, but we don't have a generic JndiObjectFactory that
can look up any type of object.  This would be really easy for us to
implement (and I will have a need of this myself in the next few weeks I
think), so I created the following Jira issue to track it:

https://issues.apache.org/jira/browse/SHIRO-217

<https://issues.apache.org/jira/browse/SHIRO-217>Please feel free to
watch/vote for it if this would be valuable for you.

Regards,

-- 
Les Hazlewood
Founder, Katasoft, Inc.
Application Security Products & Professional Apache Shiro Support and
Training:
http://www.katasoft.com

On Wed, Nov 10, 2010 at 2:02 AM, Timothy Sparg <
Timothy.Sparg@corefreight.com> wrote:

>  Hi all I’m trying to use the jdbcRealm of Shiro, but I seem to be
> configuring it incorrectly.
>
>
>
>
>
>     <filter>
>
>         <filter-name>ShiroFilter</filter-name>
>
>
> <filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
>
>         <init-param>
>
>             <param-name>config</param-name>
>
>             <param-value>
>
>                 [main]
>
>                 coreFreightRealm = org.apache.shiro.realm.jdbc.JdbcRealm
>
>                 coreFreightRealm.permissionsLookupEnabled = true
>
>                 coreFreightRealm.authenticationQuery = "SELECT password
> FROM User WHERE userCode = ?"
>
>                 coreFreightRealm.userRolesQuery = "SELECT ActorCode FROM
> UserActor WHERE UserCode = ?"
>
>                 coreFreightRealm.permissionsQuery = "SELECT ActorDesc FROM
> actor WHERE ActorCode = ?"
>
>
>
>                 ds = com.microsoft.sqlserver.jdbc.SQLServerDataSource
>
>                 ds.serverName = databaseServer
>
>                 ds.user = user
>
>                 ds.password = password
>
>                 ds.portNumber = 1433
>
>                 ds.databaseName = development
>
>                 coreFreightRealm.dataSource = $ds
>
>             </param-value>
>
>         </init-param>
>
>     </filter>
>
>
>
>
>
>
>
> Can somebody see what I’m doing wrong?
>
>
>
> And on another note would it be possible to use a jndi resource instead of
> having to configure the database manually?
>
>
>
> Thanks
>
> Tim
>