panda_pal 5.12.5 → 5.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: be64d2d47a1932b2f58c2cd9c1af70a794c59fa5d99e80595d08e24d013621fc
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8823800b73cd31a9e1d2b52c53974319e1aec59820145e58fe0f9fff88aec05c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c552dab8f057acf5a3e4f0431d4f0e3d4a8f951e79efefebe33319ff0eadb75ed4404f448d7e4b6680179df7eb9185afe71bcfd4b27c0bb882aa2da6dabeee7b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 71a5aedceac72a992da1081a1b77b3fee22f173080820a9467bbb6d1b52a048a6ad8f41423c7f19d65e7a8768f1afc24109cc55f96aced6b82f10efc54cfbe6f
         
     | 
| 
         @@ -5,10 +5,10 @@ module PandaPal 
     | 
|
| 
       5 
5 
     | 
    
         
             
              class Platform
         
     | 
| 
       6 
6 
     | 
    
         
             
                require_relative "platform/canvas"
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
                def public_jwks
         
     | 
| 
      
 8 
     | 
    
         
            +
                def public_jwks(force: false)
         
     | 
| 
       9 
9 
     | 
    
         
             
                  require "json/jwt"
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  jwk_json = Rails.cache.fetch("panda_pal/jwks/#{jwks_url}")
         
     | 
| 
      
 11 
     | 
    
         
            +
                  jwk_json = Rails.cache.fetch("panda_pal/jwks/#{jwks_url}").presence unless force
         
     | 
| 
       12 
12 
     | 
    
         
             
                  jwk_json ||= begin
         
     | 
| 
       13 
13 
     | 
    
         
             
                    response = HTTParty.get(jwks_url)
         
     | 
| 
       14 
14 
     | 
    
         
             
                    response.success? ? response.body : nil
         
     | 
| 
         @@ -4,6 +4,26 @@ module PandaPal::Concerns 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module AbilityHelper
         
     | 
| 
       5 
5 
     | 
    
         
             
                extend ActiveSupport::Concern
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
                class_methods do
         
     | 
| 
      
 8 
     | 
    
         
            +
                  def cache_on_session(method_sym)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    mthd = instance_method(mthd_sym)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    pmthd_sym = :"_scache_#{mthd_sym}"
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                    alias_method pmthd_sym, mthd_sym
         
     | 
| 
      
 13 
     | 
    
         
            +
                    private pmthd_sym
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    class_eval <<~RUBY
         
     | 
| 
      
 16 
     | 
    
         
            +
                      def #{method_sym}()
         
     | 
| 
      
 17 
     | 
    
         
            +
                        cache_on_session(:#{pmthd_sym}) do
         
     | 
| 
      
 18 
     | 
    
         
            +
                          #{pmthd_sym}()
         
     | 
| 
      
 19 
     | 
    
         
            +
                        end
         
     | 
| 
      
 20 
     | 
    
         
            +
                      end
         
     | 
| 
      
 21 
     | 
    
         
            +
                    RUBY
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                    method_sym
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       7 
27 
     | 
    
         
             
                # @return PandaPal::Session
         
     | 
| 
       8 
28 
     | 
    
         
             
                def panda_pal_session
         
     | 
| 
       9 
29 
     | 
    
         
             
                  unless defined?(@panda_pal_session) || @controller.present? || method(:panda_pal_session).owner == PandaPal::Concerns::AbilityHelper
         
     | 
| 
         @@ -75,7 +75,11 @@ module PandaPal::Helpers 
     | 
|
| 
       75 
75 
     | 
    
         
             
                  raise JSON::JWT::VerificationFailed, 'Unrecognized Organization' unless @organization.present?
         
     | 
| 
       76 
76 
     | 
    
         
             
                  raise JSON::JWT::VerificationFailed, 'Organization does not trust platform' unless @organization.trusted_platform?(current_lti_platform)
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
                   
     | 
| 
      
 78 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 79 
     | 
    
         
            +
                    decoded_jwt.verify!(current_lti_platform.public_jwks)
         
     | 
| 
      
 80 
     | 
    
         
            +
                  rescue JSON::JWK::Set::KidNotFound
         
     | 
| 
      
 81 
     | 
    
         
            +
                    decoded_jwt.verify!(current_lti_platform.public_jwks(force: true))
         
     | 
| 
      
 82 
     | 
    
         
            +
                  end
         
     | 
| 
       79 
83 
     | 
    
         | 
| 
       80 
84 
     | 
    
         
             
                  raise JSON::JWT::VerificationFailed, 'State is invalid' unless current_session_data[:lti_oauth_nonce] == decoded_jwt['nonce']
         
     | 
| 
       81 
85 
     | 
    
         | 
    
        data/lib/panda_pal/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: panda_pal
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 5.12. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 5.12.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Instructure CustomDev
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-02-14 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails
         
     |