Skip to content

Commit

Permalink
LTI-393: follow-up patch to get over old fbug in RailsLti2Provider gem (
Browse files Browse the repository at this point in the history
  • Loading branch information
jfederico authored Jun 28, 2024
1 parent a179098 commit 95e4cbf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ gem 'repost', '~> 0.3.8'
gem 'lodash-rails'
gem 'react-rails', '>= 3.2.1'

gem 'rails_lti2_provider', git: 'https://github.com/blindsidenetworks/rails_lti2_provider.git', tag: '0.2.1'
gem 'rails_lti2_provider', git: 'https://github.com/blindsidenetworks/rails_lti2_provider.git', tag: '0.2.1.1'

gem 'ims-lti', git: 'https://github.com/blindsidenetworks/ims-lti.git', tag: 'v2.3.2.1'

Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ GIT

GIT
remote: https://github.com/blindsidenetworks/rails_lti2_provider.git
revision: b95288778985f3d2fd833bd726d9f4f6b63f3faf
tag: 0.2.1
revision: a054554891d8ff5c2c2b1e877f89b9988358dcf5
tag: 0.2.1.1
specs:
rails_lti2_provider (0.2.1)
rails_lti2_provider (0.2.1.1)
ims-lti (~> 2.3.2.1)

GIT
Expand Down
17 changes: 13 additions & 4 deletions app/controllers/auth_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ class AuthController < ApplicationController
skip_before_action :verify_authenticity_token
before_action :validate_oidc_login

rescue_from ExceptionHandler::CustomError do |ex|
@error = { code: '520',
key: t('error.http._520.code'),
message: t('error.http._520.message'),
suggestion: t('error.http._520.suggestion'),
status: '520', }
logger.debug("ExceptionHandler::CustomError #{ex.error}")
render 'errors/index'
end

# first touch point for lti 1.3
# ensures platform is registered
def login
Expand Down Expand Up @@ -67,12 +77,11 @@ def validate_oidc_login
raise CustomError, :could_not_find_login_hint unless params.key?('login_hint')
raise CustomError, :could_not_find_client_id unless params.key?('client_id')

lti_registration = RailsLti2Provider::Tool.find_by_issuer(iss, { client_id: params[:client_id] })
lti_registration = RailsLti2Provider::Tool.find_by_issuer(params['iss'], { client_id: params['client_id'] })

if lti_registration.blank?
render(file: Rails.root.join('public/500.html'), layout: false, status: :not_found)
logger.error('ERROR: The app is not currently registered within the lti broker.')
return
logger.error("ERROR: Could not find a registration for issuer '#{params['iss']}' and client_id '#{params['client_id']}'.")
raise CustomError, :could_not_find_registration
end

@registration = JSON.parse(lti_registration.tool_settings)
Expand Down

0 comments on commit 95e4cbf

Please sign in to comment.