You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by tarka <in...@tarka.tv> on 2012/05/03 17:04:54 UTC

Configuring with NoSQL (DynamoDB)

I've been exploring Shiro for about a month now and it really is a joy to
work with. Up until now I have been using a MySQL DB with the following
config:

jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.authenticationQuery = SELECT password FROM users WHERE username =
?
jdbcRealm.userRolesQuery = SELECT role_name FROM roles LEFT JOIN
users_has_roles ON role_id = roles_role_id LEFT JOIN users ON users_user_id
= user_id WHERE username = ?
jdbcRealm.permissionsQuery = SELECT role_permission FROM roles WHERE
role_name = ?

ds = com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
ds.url=jdbc:mysql://localhost/Web2Core
ds.user = root
ds.password = 111111
jdbcRealm.dataSource=$ds

Having got to grips with the basics I have been trying to see if I can get
Shiro to work with a NoSQL DB, specifically Amazons DynamoDB. Has anybody
had any success with this? Any help would be really appreciated.

--
View this message in context: http://shiro-user.582556.n2.nabble.com/Configuring-with-NoSQL-DynamoDB-tp7523917.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Configuring with NoSQL (DynamoDB)

Posted by Warren Bell <wa...@gmail.com>.
You can always write your own Realm by extending AuthorizingRealm. Then
override doGetAuthenticationInfo(AuthenticationToken token) and
doGetAuthorizationInfo(PrincipalCollection principals). Look at the code
of org.apache.shiro.realm.jdbc.JdbcRealm for help. Inject your daos or
connect to your db in this new class.

Thanks,

Warren Bell

On 5/3/12 8:04 AM, tarka wrote:
> I've been exploring Shiro for about a month now and it really is a joy to
> work with. Up until now I have been using a MySQL DB with the following
> config:
> 
> jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
> jdbcRealm.authenticationQuery = SELECT password FROM users WHERE username =
> ?
> jdbcRealm.userRolesQuery = SELECT role_name FROM roles LEFT JOIN
> users_has_roles ON role_id = roles_role_id LEFT JOIN users ON users_user_id
> = user_id WHERE username = ?
> jdbcRealm.permissionsQuery = SELECT role_permission FROM roles WHERE
> role_name = ?
> 
> ds = com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
> ds.url=jdbc:mysql://localhost/Web2Core
> ds.user = root
> ds.password = 111111
> jdbcRealm.dataSource=$ds
> 
> Having got to grips with the basics I have been trying to see if I can get
> Shiro to work with a NoSQL DB, specifically Amazons DynamoDB. Has anybody
> had any success with this? Any help would be really appreciated.
> 
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Configuring-with-NoSQL-DynamoDB-tp7523917.html
> Sent from the Shiro User mailing list archive at Nabble.com.