Salting can have an impact on the database structure. It's up to you whether you want to keep salt in a separate field or prepend it to the password hash (Xnix style).
This is a Tynamo example really (using Shiro), but same difference. For an example of Hibernate/JPA EntityRealm with per-user-salt, take a look at: http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/src/test/java/org/tynamo/security/federatedaccounts/testapp/entities/User.java http://svn.codehaus.org/tynamo/trunk/tynamo-federatedaccounts/src/test/java/org/tynamo/security/federatedaccounts/testapp/services/UserRealm.java (if interested in background info on the module, see http://tynamo.org/tynamo-federatedaccounts+guide) Kalle On Thu, Jun 2, 2011 at 8:25 AM, Phil Steitz <[email protected]> wrote: > I am just getting started myself with Shiro, so please take below > with a grain of salt (pun intended ;) > > On 6/2/11 12:23 AM, set321go wrote: >> Hello, >> >> I have read the documentation but its lacking a bit when it comes to how to >> set up salting. I am just trying to get a basic web app working on glassfish >> using shiro. I have done some of the examples in the links that are on the >> website but I am still unclear on a few things. > > See Eduard's response as well as the SaltAwareJdbcRealm example in > /samples/spring in svn. Maybe someone can chime in with some > guidance on a better way to generate and persist the salt than to > use the username. > >> By default I need a users table with username and password if I am not using >> salting, is there a default pattern for a database when using salting? > > Salting should have no impact on the database structure, just what > is stored in the database. > >> If I am not using the default tables how do I tell shiro what the table and >> structure is? > > Looks to me like the way to do this is to override the default > queries used by the JdbcRealm via its query setters: > setAuthenticationQuery, setUserRolesQuery, setPermissionsQuery. See > the javadoc for JdbcRealm. > > > Phil >> thanks >> >> >> -- >> View this message in context: >> http://shiro-user.582556.n2.nabble.com/Default-Salt-Database-structure-tp6430158p6430158.html >> Sent from the Shiro User mailing list archive at Nabble.com. >> > >
