Module: AtomicTenant::CanvasContentMigration

Defined in:
lib/atomic_tenant/canvas_content_migration.rb

Defined Under Namespace

Classes: InvalidTokenError

Constant Summary collapse

ALGORITHM =
"HS256".freeze
HEADER =
1

Class Method Summary collapse

Class Method Details

.decode(token, algorithm = ALGORITHM) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/atomic_tenant/canvas_content_migration.rb', line 11

def self.decode(token,  algorithm = ALGORITHM)
  unverified = JWT.decode(token, nil, false)
  kid = unverified[HEADER]["kid"]
  app_instance = ApplicationInstance.find_by!(lti_key: kid)
  # We don't validate because we're only setting the tenant for the request. The app
  # must validate the JWT.
  app_instance
end