-
Notifications
You must be signed in to change notification settings - Fork 57
Non-CAS authentication #2
Comments
I'm a big fan of using external authentication like omniauth for a google account, etc |
I've implemented omniauth version of cas.. Adam and I decided that it would be too much to enable both simultaneously so we will make it a setting only settable at install time. Stalling until @maltyeva is done with the app settings refactoring |
I am done for the summer but here is the summary fo the current status of the Devise branch and possible problems... The CAS server host adress is setup in devise initializer as I have implemented an extra step in the application setup where the Authorization settings and the LDAP settings are configured. The Devise works as following: It uses authenticate_user! before filter to check if the user is authenticated. It is skipped on public pages. If a user is not authenticated it redirects to sessions#new action which redirects to the CAS authentication or to the sign-in page which is a sessions#new view. Past the sign in page CAS authentication system does not interact at all with devise controllers. They are assigned a random 20 character password and their e-mail confirmation is skipped. The Devise users on the other hand use new, create, and update actions of the devise controller that I have overridden in order to update e-mails and logins properly. All Devise controllers are located inside the gem but the ones that I am overriding are contained in the /controllers/users/ folder. Their views are in the subfolders of the view/users folders, and the rest of the views, controllers for which aren't overridden are in the views/devise folder. The admin user is auto-confirmed but this can be changed in the application_setup controller, all other users that are created are sent a confirmation e-mail, and have to confirm before they can sign in. They can be given a grace period by uncommenting a line in the devise initializer and setting a time period. If Admin edits users profiles regular users CRUD actions are called rather than the registrations controller ones. I don't see any immediate problems other than if the LDAP server settings are not correctly entered search_ldap function will fail and die a horrible death, and bring down the rest of everything so that should probably be handled. In general devise modules are added and removed in the users.rb model and the routes are managed with the devise_for method in the routes.rb. there I have skipped registrations module and manually defined routes for certain calls to prevent devise from overriding old users CRUD actions. Also Devise provides its own App_setup works great if you don't do silly things to it but I wouldn't consider it bomb-proof. Although I won't have my computer with me in Peru I will have my phone and hopefully some form of WiFi so I will be able to answer questions via e-mail if you have any. |
It looks like a lot of work was done with this a while ago; not sure how much of it is still usable. I'm wondering if it might be possible to have CAS as an authentication option along with others, that would probably be best so that it's usable outside of Yale, but there are a lot of other Yale-specific aspects of the app we might want to generalize out. That's discussion for a different issue, leaving this open for further discussion. |
https://github.com/dlindahl/omniauth-cas (?) (solves the Rails4 upgrade problem of RubyCAS #585) (I'll try it out on YaleSTC/pulse and report back!) |
omniauth-cas is a no-go. versions / API-compatibility appears incorrect and it fails to parse the CAS ticket as legitimate. :'( |
This might be even better: https://github.com/biola/rack-cas (Found via rubycas/rubycas-client#78 (comment) - recommended by soupmatt) It runs on Rack, the middleware that runs Rails, so it isn't dependent on Rails or a Rails-dependent gem like the other solutions. This might be the one. |
WOOOOOOOOOOOT! Made some updates to the |
Also, I merged in the recent changes to EDIT basically done, I'd just like to move the call to |
I spent too long trying to get Announcement integration tests working, but now moving on to configuration. I think we're going to skip the |
Ok, TRANSFERRED |
Ok, I tested the |
Note that the currently failing tests have to do with the modifications I made to the |
I've taken out the |
Whew, I think this is basically done. We probably want to add tests for editing users to make sure that respect the rules for editing you own profile vs someone elses and being able to change your own password, but we can leave some of that for #416. Also, we should probably write proper tests for the password reset functionality but I don't really have time to do it and I don't think it's worth it since we're purely using Devise. I'll open a PR now, but it doesn't need to be reviewed until editing functionality has been tested. |
I've started writing the profile specs. Once they're done (hopefully tomorrow), this will be ready for review! |
Ok, wrote a bunch of profile specs. There are still two intermittently failing |
I just want to say that this is a triumph; I'm making a note here, "huge success". It's hard to overstate my satisfaction. |
Thanks @shippy, I really appreciate it :-). Feel free to take a look at the PR if you have free time :-P. |
Changed .nil? on notes to .blank? added markdown to the notes that were missing it (still need to test) Signed-off-by: Alan Liu <[email protected]> Added an absolute link to the reservations in checkin receipt, checkout receipt, checked_in_fine email, and reservation confirmation. Added tests to those four emails to see if they contain a link with reservations in it. fixed travis offenses removed extra spaces, reverted a few changes to requirements notes, improved the test by adding in the full url. added a custom test for one case because @res is an array travis travis try #2
2014-09-28
For now, we're going to implement
Devise
authentication with thedevise_cas_authenticatable
gem for CAS. We will also try to write up example migrations and instructions for alternative Devise authentication schemes.To Do:
devise
gemlaterdevise_cas_authenticatable
gemdevise
authentication before_filters instead of old RubyCAS filterslogin
column name tousername
(delete current migration)login
for ActiveRecord lookups withusername
current_user
method in lieu of built-in Devise method2014-10-12
Most / all of the above was completed today and almost all of the current test suite is passing. My thoughts are outlined in the comment below; I'll try to turn them into a proper to-do list soon.
2014-10-13
All tests now pass. I tried getting
database_authenticatable
working and it was messy, but I think providing example code at least for that case is important. If I'm strugging to get this working, so will future clients. I'd like to see if we can do the following:remove all CAS workflow dependenciesmake sure both authentication methods worknew
hackerydatabase_authenticatable
working, using our currentuser
resourceedit
andupdate
workdevise.rb
, with options for bothusername
oremail
login.example
file extension so they don't run by default)devise.rb
with only required / related options and comment where necessarydatabase_authenticatable
either in the README or wiki or bothdatabase_authenticatable
the default and switching to CAS using the deploy script / variable (related to Document and set up generalized deployment #683)2014-10-19
2014-10-25
:recoverable
devise.rb
again and take out settings that shouldn't be changed :-)README
The text was updated successfully, but these errors were encountered: