First of all, I’ll apologize because this is going to be more of a
general setup question rather than a specific coding question. I’m
relatively new to Rails and I’ve never built a web service before. So,
here’s my problem:
I’m building 3 new applications that all relate to one another, but can
also be stand-alone. Meaning a user can register with each one
individually. However, one of the requirements is to only have one
login. So once a user registers with any of the 3 applications, they
are then in the system and can use the same username/password they’ve
registered.
Now, it seems to me that this is a perfect situation to have a web
service to manage users. If not, you can stop here and possibly explain
a better solution? (Note: I don’t want to use openID).
Here are the things I would want to do in the web service:
- Register a user, saving all information to the webservice (but only
email and password will be required). - Login a user, returning their user_id to be held in session. This
would require a call to the webservice to verify that the user exists,
and if not, prompt them to register.
Those are the absolute minimum requirements. Now, what else should I
have? I want to keep track of last logins and login attempts as well,
so I was thinking about having the following tables: Users, Audits,
Logs. Users is obvious, Audits would keep track of logins and attempts,
Logs would record eroneous errors (or should I use a flat file for
that?).
If you’ve made it this far, and that sounds reasonable, what type of
code needs to be written to connect to the webservice? I’m not
completely sure I know how it works. Would I have a method like
“verify_user(email, pwd)” that would return xml data if the user exists,
and an error code if they don’t?
I’ll stop here for now, and ask more coding-type questions once I figure
out the general idea of how to accomplish this. If someone can explain
the basics of an implementation to have one way to track multiple users
across 3 applications, I’m open to suggestions.
Again, I’m sorry this is kind of general, but I didn’t know which forum
would be most appropriate. Thanks for any help on this matter.