Another design question:

I'm working on storing my account data into MongoDB. For a while, I've had two Subject objects--Shiro's, and my own.

This is getting ugly fast. I just refactored such that my app's primary principal is the MongoDB ObjectId of the subject, and this vastly simplifies many of my use cases. I no longer need my own Subject class to reference subjects from other documents, and can just stash the primary principal or use it for record lookups. My one remaining case is modifying subjects to create a new account or change principal values, then saving the subject to the database.

I see there is a SubjectDAO with basic save and delete methods. DefaultSubjectDAO appears to persist subjects in sessions though, and I'm wondering if this DAO isn't intended to be modified for saving subjects in a database?

I was thinking of calling getSecurityManager().getSubjectDAO().save(subject) rather than my Mongo-specific code. Then my app wouldn't really care what persisted its subjects, and I could potentially migrate to something else in the future. Is this not what SubjectDAO was intended for, though?

Reply via email to