-
Notifications
You must be signed in to change notification settings - Fork 11
Auto-registration without "Optimistic Saving" #15
Comments
It is a bit knobly. If you have better suggestions, would be really interested to hear. Here are a few notes to explain the current approach. The basic problem is that the authentication takes place in phases. When we receive the callback from rpxnow - assuming it was "success" - authlogic_rpx wants to establish an authenticated session. If at this point, the profile information returned from rpx doesn't meet the application's validity requirements (e.g. username not unique ) then we have a dilemma. If the unique username constraint is implemented at the database level, then authlogic cannot create the user. The contraint will be violated, authlogic login will fail, and the user's login will be rejected. The approach I've taken with authlogic_rpx is to recommend basically this (if you want to have auto-registration):
If you don't want auto-registration, then this is all moot. However, I personally think auto-registration is one of the big benefits that rpx can let you deliver to your users. |
I think I've got it, as of last night. I'll put together a fork of the rails example app adjusted to work with my changes. The basic flow is this:
The big win being that this keeps our dbs clean and constrainable. Any thoughts on this approach? I'll have the example together tonight. |
Great! Look forward to going through it when you've pushed the fork |
Alright, I have the fixes up at: One change which ought to be scrutinized & discussed is that it was necessary to monkey-patch authlogic to remove the save_record call from Session#valid? http://github.com/Empact/authlogic_rpx/commit/91b3faa18d280a63229d271691615be0b6703aeb There may be good alternatives to this. For example, changing calls to save_without_session_management to not pass false (and by doing so, to respect validation errors). |
Thanks for the patch! I've been a bit busy to check it out so far, but this weekend hopefully.. |
I'm still unsure about the authlogic valid? monkey patch. We should look at how the authlogic_openid plugin handles auto-reg, as I believe it has binarylogic's involvement. |
The docs say:
However, looking at the code it seems possible that a more general auto-registration feature could be built for Authlogic, which doesn't save bad data to the db (e.g. violating uniqueness constraints on username and such).
I'm going to look into this for my own sake, but would appreciate your thoughts if you have any opinion on the matter.
The text was updated successfully, but these errors were encountered: