devise_cas_authenticatable icon indicating copy to clipboard operation
devise_cas_authenticatable copied to clipboard

Using with both an auto-create model, and non-auto-create model

Open joraff opened this issue 12 years ago • 4 comments

Hi there,

I have a particular need to use CAS to authenticate two different user models in an app, say a user and an admin. The user objects can be auto-created, however, the admin objects need to exist already.

Could a discussion be started on how you think this could be handled? Perhaps adding a :create_user => true|false to devise :cas_authenticatable?

joraff avatar Sep 19 '12 14:09 joraff

That's an interesting use case, and definitely seems reasonable to me.

Unfortunately, we can't currently add a :create_user option to devise_for, because devise_cas_authenticatable supports Devise 1.0 in order to work on Rails 2.3 apps. But it may be time to finally break that support. People can still use old versions of this gem.

The other thing we could do that seems non-awful is allow you to define a class method called, say, create_cas_users?. If defined, this would override the default behavior from the Devise configuration.

I honestly don't have a strong preference which way to go. Opinions welcome.

nbudin avatar Sep 19 '12 14:09 nbudin

That was going to be my second suggestion, similar to cas_extra_attributes=.

Did you mean to write devise_for, as in the route generator?

joraff avatar Sep 19 '12 15:09 joraff

No, sorry - I has a brains. :) Any preference which way to go?

nbudin avatar Sep 19 '12 15:09 nbudin

My vote is still for in the module selector, I think that's much cleaner :) But it will probably be easier to implement using a method and doesn't break Devise 1.0 compatibility.

Github's job queue is borked at the moment - I'll put some stuff in my fork once it's created.

joraff avatar Sep 19 '12 15:09 joraff