Class: PandaPal::Platform::Canvas

Inherits:
PandaPal::Platform show all
Defined in:
app/models/panda_pal/platform/canvas.rb

Defined Under Namespace

Modules: OrgExtension

Constant Summary collapse

TRUSTED_ISSUERS =
[
  "https://sso.canvaslms.com",
  "https://sso.beta.canvaslms.com",
  "https://sso.test.canvaslms.com",

  # Deprecated (but still secure):
  "https://canvas.instructure.com",
  "https://canvas.beta.instructure.com",
  "https://canvas.test.instructure.com",
]

Instance Method Summary collapse

Methods inherited from PandaPal::Platform

deserialize, from_serialized, organization_api, #public_jwks, resolve_platform, resolve_platform_class, resolve_raw_platform

Constructor Details

#initialize(options) ⇒ Canvas

Returns a new instance of Canvas.



19
20
21
# File 'app/models/panda_pal/platform/canvas.rb', line 19

def initialize(options)
  @issuer = options[:iss]
end

Instance Method Details

#authentication_redirect_urlObject



31
32
33
# File 'app/models/panda_pal/platform/canvas.rb', line 31

def authentication_redirect_url
  "#{lti_api_domain}/api/lti/authorize_redirect"
end

#grant_urlObject



35
36
37
# File 'app/models/panda_pal/platform/canvas.rb', line 35

def grant_url
  "#{lti_api_domain}/login/oauth2/token"
end

#is_trusted_env?Boolean

Returns:

  • (Boolean)


39
40
41
42
43
# File 'app/models/panda_pal/platform/canvas.rb', line 39

def is_trusted_env?
  return true unless Rails.env.production?

  TRUSTED_ISSUERS.include?(platform_uri)
end

#jwks_urlObject



27
28
29
# File 'app/models/panda_pal/platform/canvas.rb', line 27

def jwks_url
  "#{lti_api_domain}/api/lti/security/jwks"
end

#platform_uriObject



23
24
25
# File 'app/models/panda_pal/platform/canvas.rb', line 23

def platform_uri
  @issuer
end

#serializeObject



45
46
47
# File 'app/models/panda_pal/platform/canvas.rb', line 45

def serialize
  super.merge(iss: @issuer)
end