Sha256: d37f2ea9a0e062ba71361869a19d31790d563f24aeae8c62d81dfc0e423fb959

Contents?: true

Size: 718 Bytes

Versions: 42

Compression:

Stored size: 718 Bytes

Contents

module PandaPal
  class Platform
    def public_jwks
      response = HTTParty.get(jwks_url)
      return nil unless response.success?

      JSON::JWK::Set.new(JSON.parse(response.body))
    rescue
      nil
    end
  end

  class Platform::Canvas < Platform
    attr_accessor :base_url

    def initialize(base_url)
      @base_url = base_url
    end

    def host
      base_url
    end

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

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

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

  class Platform
    CANVAS = Platform::Canvas.new('https://canvas.instructure.com')
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
panda_pal-5.4.11 app/models/panda_pal/platform.rb
panda_pal-5.4.10 app/models/panda_pal/platform.rb
panda_pal-5.4.9 app/models/panda_pal/platform.rb
panda_pal-5.4.8 app/models/panda_pal/platform.rb
panda_pal-5.4.7 app/models/panda_pal/platform.rb
panda_pal-5.4.6 app/models/panda_pal/platform.rb
panda_pal-5.4.5 app/models/panda_pal/platform.rb
panda_pal-5.4.4 app/models/panda_pal/platform.rb
panda_pal-5.4.3 app/models/panda_pal/platform.rb
panda_pal-5.4.2 app/models/panda_pal/platform.rb
panda_pal-5.4.1 app/models/panda_pal/platform.rb
panda_pal-5.4.0 app/models/panda_pal/platform.rb
panda_pal-5.4.0.beta10 app/models/panda_pal/platform.rb
panda_pal-5.4.0.beta9 app/models/panda_pal/platform.rb
panda_pal-5.4.0.beta8 app/models/panda_pal/platform.rb
panda_pal-5.4.0.beta7 app/models/panda_pal/platform.rb
panda_pal-5.4.0.beta6 app/models/panda_pal/platform.rb
panda_pal-5.4.0.beta5 app/models/panda_pal/platform.rb
panda_pal-5.4.0.beta4 app/models/panda_pal/platform.rb
panda_pal-5.4.0.beta3 app/models/panda_pal/platform.rb