I'm using Authlogic for authentication in my app, using the standard User and UserSession models. I'm building an API into my app, and I want to authenticate API access with a single access token. In my app, every User belongs_to
a Company, which has_many
users. The API is for access to resources belonging to the company, so I'd like to use one single access token for the whole company.
My initial thought was to add a dummy user to Company that only has permission to access the API, whose single access token the company would then use to grant access to the API. It doesn't appear that I can set a user's e-mail and password blank with AuthLogic, so this isn't panning out. My next thought was perhaps I could add acts_as_authentic
to the company itself, but I'm not sure how this would work.
I really want to use Authlogic for the solution because it integrates nicely with my ACL, and appears to have the functionallity I'm looking for mostly built in.
Is it possible to have two models that act_as_authentic
? Is there an easier way that I'm not thinking of, built into Authlogic? Is there a way I can use a dummy user for their API key? Which way should I do this?