Commit Graph

121 Commits

Author SHA1 Message Date
Cody Cutrer 794d59eef9 add method for plugins to easily inject into the delegated auth workflow
refs #5948

adjust specs so that if a login does inject themselves in by adding
additonal redirects, we keep following them

Change-Id: I16e616066ea1bef1aa5ed97718cbd8ddbd2c27c5
Reviewed-on: https://gerrit.instructure.com/6536
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-10-28 09:07:54 -06:00
Cody Cutrer c59c0f593f refactor user creation/invitations closes #5833
fixes #5573, #5572, #5753

 * communication channels are now only unique within a single user
 * UserList changes
   * Always resolve pseudonym#unique_ids
   * Support looking up by SMS CCs
   * Option to either require e-mails match an existing CC,
     or e-mails that don't match a Pseudonym will always be
     returned unattached (relying on better merging behavior
     to not have a gazillion accounts created)
   * Method to return users, creating new ones (*without* a
     Pseudonym) if necessary. (can't create with a pseudonym,
     since Pseudonym#unique_id is still unique, I can't have
     multiple outstanding users with the same unique_id)
 * EnrollmentsFromUserList is mostly gutted, now using UserList's
   functionality directy.
 * Use UserList for adding account admins, removing the now
   unused Account#add_admin => User#find_by_email/User#assert_by_email
   codepath
 * Update UsersController#create to not worry about duplicate
   communication channels
 * Remove AccountsController#add_user, and just use
   UsersController#create
 * Change SIS::UserImporter to send out a merge opportunity
   e-mail if a conflicting CC is found (but still create the CC)
 * In /profile, don't worry about conflicting CCs (the CC confirmation
   process will now allow merging)
   * Remove CommunicationChannelsController#try_merge and #merge
 * For the non-simple case of CoursesController#enrollment_invitation
   redirect to /register (CommunicationsChannelController#confirm)
   * Remove CoursesController#transfer_enrollment
 * Move PseudonymsController#registration_confirmation to
   CommunicationChannelsController#confirm (have to be able to
   register an account without a Pseudonym yet)
   * Fold the old direct confirm functionality in, if there are
     no available merge opportunities
   * Allow merging the new account with the currently logged in user
   * Allow changing the Pseudonym#unique_id when registering a new
     account (since there might be conflicts)
   * Display a list of merge opportunities based on conflicting
     communication channels
     * Provide link(s) to log in as the other user,
       redirecting back to the registration page after login is
       complete (to complete the merge as the current user)
   * Remove several assert_* methods that are no longer needed
 * Update PseudonymSessionsController a bit to deal with the new
   way of dealing with conflicting CCs (especially CCs from LDAP),
   and to redirect back to the registration/confirmation page when
   attempting to do a merge
 * Expose the open_registration setting; use it to control if
   inviting users to a course is able to create new users

Change-Id: If2f38818a71af656854d3bf8431ddbf5dcb84691
Reviewed-on: https://gerrit.instructure.com/6149
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-10-24 12:07:08 -06:00
Zach Pendleton 9fefc7a264 add sis_user_id option to as_user_id param in API.
Admins can now masquerade users by giving an SIS id in
the as_user_id param, e.g.: as_user_id=sis_user_id:1234.

Change-Id: I9bb03ecf53c4ceba574dd4d196c0281ac8dd3141
Reviewed-on: https://gerrit.instructure.com/6335
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-20 16:35:33 -06:00
Cody Cutrer 48b920db01 support as_user_id for api requests closes #5809
Change-Id: I67eb36f10c9a751d657ed94ccf3c76e780556c09
Reviewed-on: https://gerrit.instructure.com/6017
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-06 16:42:43 -06:00
Cody Cutrer 41abe5259a don't bother looking up the current pseudonym in a cache
Authlogic has already read it out of the database at this point, so
the cache doesn't gain us anything.

Change-Id: I4bd21ddf17dbbe0efe288a26a4281440e6e932ad
Reviewed-on: https://gerrit.instructure.com/5972
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-10-05 21:11:53 -06:00
JT Olds fbbdf75693 use the current account domain in context_host saml settings lookups
Change-Id: I53729d77055e8225583e612ca81fc578f948ff5f
Reviewed-on: https://gerrit.instructure.com/5965
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-10-05 15:59:57 -06:00
Brian Palmer 6f65fa37f8 only allow api_key to replace authenticity_token if basic auth is used
allowing api_key to replace authenticity_token for normal cookie
sessions would open us up to a CSRF attack, by allowing a malicious user
to use the api_key without explicitly having the user credentials.

fixes #5162

Change-Id: Ia2604a6930d660dd04a8783fc983a3fe381ff48d
Reviewed-on: https://gerrit.instructure.com/5028
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-08-10 13:02:26 -06:00
Brian Palmer d22878be0e continue to allow the previous api behavior when the user has a canvas session
Change-Id: Ibf65f01d8dc180eea78b9e8812c2dace000ae63b
Reviewed-on: https://gerrit.instructure.com/4830
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2011-08-03 12:43:54 -06:00
Brian Palmer eb214fabf4 don't require api_key when access_token is given to api request
refs #5029

For now we're going to continue to support api key+basic auth as an
alternative to oauth and access tokens, though eventually this will be
phased out.

This also switches all the api specs to using oauth tokens, except for
the new specs that explicitly test the old method is still supported.
There is one change: GET requests now require the api_key as well, if
using the api_key auth method.

Change-Id: I97d6c71be7afaa655da521d774930b2649961ffe
Reviewed-on: https://gerrit.instructure.com/4720
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-07-19 13:43:26 -06:00
Brian Palmer 65ed1dac46 implement oauth2 native app flow, closes #5029
Change-Id: Ieb6c7f10190775efb9a0c8adf6cd2928bca8af1c
Reviewed-on: https://gerrit.instructure.com/4683
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-07-18 22:27:36 -06:00
Cody Cutrer 07c17ea38e expand masquerade capabilities to root account admins
closes #4332

 * Allow :become_user to be granted to any root account admin role,
   not just site admin roles.
 * Adjust policy on User objects to properly grant :become_user:
   * You can always become yourself (stop masquerading)
   * Site admins can become any user besides other site admins
   * Root account admins can only become users that are not account
     admins, and that belong to accounts that this root account admin
     has permissions to
 * Adjust masquerading code to check for :become_user on the user
   object itself, rather than checking just on the site admin account
   * This means we have to figure out the target user before checking
     permissions
   * Because the permission check already checks for becoming another
     site admin user, that special case was removed in the
     masquerading code
   * Special case the UI to not show the "become" link for the
     current user (i.e. you can't become yourself, and you can't
     become the user that you already are)

Change-Id: I69bc855b8ee24098b9a63b0b1c8d7edf2063b625
Reviewed-on: https://gerrit.instructure.com/4614
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-07-12 14:46:54 -06:00
Brian Palmer 45a4266dd4 teacher activity / student interaction report, closes #4316
Change-Id: I116c9130c3af9a7c2891cf6387de7e2b361c8d4b
Reviewed-on: https://gerrit.instructure.com/4481
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-06-29 16:24:24 -06:00
Cody Cutrer 144e78c98b make sure delegated auth gets a stab at first-login. fixes #4773
URLs that might not require a user were using
render_unauthorized_action, which just rendered the login partial,
rather than redirecting to login_url.  This meant that delegated auth
logic in PseudoSessionsController#new was getting skipped.  So for
render_unauthorized_action in the specific case that there is no user,
call a method to kick of delegated auth, if necessary.

Also fix a problem that session[:return_to] was getting wiped for
delegated auth, so you'd end up at the dashboard, rather than where
you wanted to go.

Change-Id: I42c24e31ca58cccc33d349bcb451defd3aaa5c9c
Reviewed-on: https://gerrit.instructure.com/3993
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-06-08 14:13:39 -06:00
Jon Jensen 58a25bd462 preliminary i18n setup, closes #4124
* i18n key scoping for controller/model/js/etc.
 * inline English translation support
 * rdiscount gem for markdown'ed translations
 * html_safe interpolation tweaks
 * label helpers
 * crummy tweak to translate symbol keys
 * internationalized most of lib, and some plugins/messages
 * conference i18n (view/model/controller/js)

Change-Id: I42772b9e19a110efbe855dc83a681be49ec98df2
Reviewed-on: https://gerrit.instructure.com/4080
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-06-06 14:19:03 -06:00
Brian Palmer 50c4687c84 oauth 2 requests via access tokens
Added support for oauth 2 API requests.  HTTP Basic
only works for Canvas-auth and LDAP accounts, but
oauth 2 will also work with SSO accounts.  Also added
ability for users to create access tokens from the
profile page.

Change-Id: I13581b4e77bfa77bf11dbb732900012dd1e50ede
Reviewed-on: https://gerrit.instructure.com/3775
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-06-02 09:15:11 -06:00
Zach Wily 23360636f5 add confirmation to become_user_id operations; fixes #4689
Now when adding ?become_user_id=XXXX to a URL, the admin will be redirected to
a page where they confirm that they want to masquerade as that user. This is
to prevent people from being able to change who an admin is logged in as with
simple img links.

It also adds a "Stop Masquerading" link to the identity bar.

Thanks to Patrick Michaud for pointing this out. Fixed gh issue 22.

Change-Id: I196f9f1412022de371da7a8f4670bcd4a1c35653
Reviewed-on: https://gerrit.instructure.com/3904
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-05-27 14:31:46 -06:00
Brian Palmer dbfdd06e34 remove the hidden course_role divs and db lookup
These are no longer used and can have a significant db cost.

Change-Id: I8fcf7cfe3a20e056310d760d97ca3a04ca387bb7
Reviewed-on: https://gerrit.instructure.com/2825
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-03-25 13:46:08 -06:00
Brian Palmer 6dc173330d don't show 'you must be logged in' for root path login redirect
Change-Id: Iabbfd782ec8d4850fe7c9c2eaf1ce02179a110a9
Reviewed-on: https://gerrit.instructure.com/2687
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-03-17 16:04:23 -06:00
Jon Jensen 757bcb2c60 fix a couple file upload problems
Change-Id: I6c8bfb22709655a8bd2cff2375ab0e4be9dcc5ec
Reviewed-on: https://gerrit.instructure.com/2604
Reviewed-by: JT Olds <jt@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-03-10 17:12:42 -07:00
Jon Jensen ec51f1dfe2 policy/signature auth for local uploads instead of session cookie fu, refs #3762
Change-Id: I64c6446c36c253235b86ba9edfc411a20c2812fc
Reviewed-on: https://gerrit.instructure.com/2546
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-03-09 12:11:34 -07:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00