Not sure if it's better to start a new thread or just extend this one, but:

Geert Bevin wrote:
http://thread.gmane.org/gmane.comp.java.rife.user/2767/focus=2767
...
Emmanuel also gives a good summary of how to use database authentication, with clear code snippets.

I am probably just slow, but it took me several readings of his code before I even figured out what it was for: he was demonstrating how to create a user and attach it to additional account data, not how to use an existing database of users. Once I figured that out, I took his example, expanded on it, and added lots of explanation and code comments which I hope are correct; the result is here:

http://rifers.org/wiki/display/RIFE/GuideCookbookAuthentication

(The new sections are "Creating users" and "Managing additional user data".) I also added a link to that page from the authentication chapter of the user's guide, since when I was first reading the guide it kind of felt like database authentication was mentioned in passing then forgotten and at first I didn't even notice it stuffed down in an appendix at the end of the guide.

If someone can give the new material a quick read and make sure it's accurate and that my adaptation of Emmanuel's code is the right way to do things, that'd be super. In particular I tried and failed to make the Account object use the RIFE user ID as its identifier, which I feel is the right data model since it's a one-to-one mapping. If there's some way to do foreign primary keys I wouldn't mind knowing, but I couldn't get RIFE to stop trying to assign a fresh ID value to my Account object.

I also didn't see a more elegant way to do the many-to-one constraint between Account and RoleUser, but it's entirely possible there is one I'm not aware of. At the very least I imagine there's a more elegant way to look up the RoleUser table name.

-Steve
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to