What database tables does Apache Shiro require?

mehdi shahdoost picture mehdi shahdoost · Mar 30, 2011 · Viewed 9k times · Source

I want to use Apache Shiro and MySQL for my Realm. What tables and fields does Shiro need to work?

Answer

Les Hazlewood picture Les Hazlewood · Mar 30, 2011

Shiro doesn't require database tables to function. Shiro users can use whatever datastore they want to model or manage users, groups, permissions etc.

It is a Shiro Realm's responsibility to act as the bridge to your data (however you want to represent it) and return it in a format that Shiro understands.

Because Shiro does not impose a data model upon you, this is what allows it to work with so many backends (LDAP, Active Directory, RDBMS, File System, etc).

If you want to use an RDBMS as your backing data store, check out Shiro's JdbcRealm source code to give you an idea of what your tables might look like. This is just an example though. You could have any table structure you wish.