canvas-lms/app
Jacob Fugal 7f301937ea legacy api claims in inst-fs jwts for API clients
fixes RECNVS-471
fixes RECNVS-479

allows API requests from access tokens issued by whitelisted developer
keys to receive additional claims in the JWTs of inst-fs links in the
response. these additional claims are a workaround to cause inst-fs to
accept the link as if authenticated despite the client not having an
inst-fs session or presenting inst-fs with the access token.

updated API clients will need to present their API token when accessing
inst-fs links. once the clients associated with a developer key are
updated, the developer key will be removed from the whitelist. this is
only a temporary workaround.

test-plan:
- have inst-fs configured and enabled with your canvas instance
- generate a new access token for your user
- in the rails console of your canvas instance, set:
  Setting.set('instfs.whitelist_all_developer_keys', 'true')
- using something without a session, like postman, POST to
  /api/v1/courses/:course_id/files with a valid preflight and
  authenticated via the access token (e.g. using the `Authorization`
  header)
  - the `upload_url` in the response should be an inst-fs link
  - the `upload_url` should include a `token` query parameter with a JWT
    as the value
  - decoding the JWT from the `upload_url`, it should include
    `legacy_api_developer_key_id` and a `legacy_api_root_account_id`
    claims
- in the rails console of your canvas instance:
  Setting.remove('instfs.whitelist_all_developer_keys')
- repeat the upload preflight attempt from above
- this time, the JWT should not include the `legacy_api_*` claims

Change-Id: I911d18c031d9ba90de808e260e4644beaef69ff9
Reviewed-on: https://gerrit.instructure.com/151690
Tested-by: Jenkins
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-06-04 17:04:06 +00:00
..
coffeescripts hide grades for AMM in individual gradebook 2018-06-04 15:18:24 +00:00
controllers fix api documentation for sis restore states 2018-06-04 16:36:05 +00:00
graphql graphql: add lock info type 2018-05-24 21:23:39 +00:00
helpers legacy api claims in inst-fs jwts for API clients 2018-06-04 17:04:06 +00:00
jsx hide grades for AMM in individual gradebook 2018-06-04 15:18:24 +00:00
messages Revert "fix footer logo in footer of emails" 2018-03-09 00:16:53 +00:00
middleware set Attachment.current_root_account during jobs 2018-03-07 17:18:24 +00:00
models allow all observers 2018-06-02 01:57:34 +00:00
observers Qti import from Canvas to Quizzes.Next 2018-05-31 16:57:32 +00:00
presenters restrict access to submission details page 2018-05-15 21:20:41 +00:00
serializers Qti import from Canvas to Quizzes.Next 2018-05-31 16:57:32 +00:00
stylesheets update styling on edit rubric 2018-06-04 15:57:06 +00:00
views remove incorrect caching of grade summary 2018-05-31 16:46:46 +00:00