Temporary Solution for Updating LTI 1.3 on beta/test servers

agschmid
Community Contributor

We have a temporary solution for updating LTI 1.3 tools on beta and test, until Instructure comes up with a solution.

I'm QA, not a developer, so this is really simple code using ruby, watir and a csv file, but it does the job.

I have a class which contains the login information, browser info, and the base urls. I have a csv file for each server, (beta and test), which contains the data we need for each tool to update, and because we have tools in different nodes, it also has the account id which needs to be in the URL when accessing the developer keys.

require_relative 'connect'
require 'csv'
server = 'beta'
# class with the browser/login information
c = Connection.new(server)
browser = c.browser

#file containing values that need to be updated
use_file = 'update_files/beta_updates.csv'

# Canvas login code goes here

# After successful login, this starts the key updates

CSV.foreach(use_file, headers:true) do |row|
  account = row['account']
  key_edit = row['key_edit']
  key_name = row['key_name']
  redirect_uris = row['redirect_uris']
  target_link_uri = row['target_link_uri']
  oidc_initiation_url = row['oidc_initiation_url']
  public_jwk_url = row['public_jwk_url']
  domain = row['domain']

  dev_keys_url = "#{c.dev_keys_base}#{account}/developer_keys"

  # dev keys
  browser.goto dev_keys_url

  browser.button(value: "#{key_edit}").scroll.to
  browser.button(value: "#{key_edit}").click

  #on dev key page - make sure key name matches
  if browser.text_field(name: 'developer_key[name]').value == "#{key_name}"
    #Redirect URIs
    browser.textarea(name: 'developer_key[redirect_uris]').set "#{redirect_uris}"
    #Target Link URI
    browser.text_field(name: 'target_link_uri').set "#{target_link_uri}"
    #OpenID Connect Initiation Url
    browser.text_field(name: 'oidc_initiation_url').set "#{oidc_initiation_url}"
    #Public JWK URL
    browser.text_field(name: 'public_jwk_url').set "#{public_jwk_url}"
    #Additional Settings
    browser.button(visible_text: 'Additional Settings').click
    sleep 1
    #Domain
    browser.text_field(name: 'domain').set "#{domain}"
    #Close the Canvas warning banner
    browser.button(class: "element_toggler Button--icon-action").click
    #Save
    browser.button(visible_text: 'Save').click
    sleep 1
  end
end

 

Please add your vote to the following ideas:

https://community.canvaslms.com/t5/Idea-Conversations/Support-environment-variables-for-LTI-1-3/idi-...

https://community.canvaslms.com/t5/Idea-Conversations/Provide-an-API-endpoint-for-updating-LTI-1-3-t...

 

Labels (3)