panda_pal 5.16.6 → 5.16.7

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: fb2e310fa2edf0bc70f0a4f4e91bc2358b3489cb472571e8f3cc18ee387a04fb
4
- data.tar.gz: 6baaf5e388cea773faee2f8d65defa4ea64b9feb28412e5f900fc9bbb62d5e34
3
+ metadata.gz: 2dc69090531d872e50b4bf8414fdca02abaeada29fb82a0da811f3c3cfce95dc
4
+ data.tar.gz: 86dda2b637be102247d9d400437e2c8a641287ef6003a47a72cfaac2ad3ee82e
5
5
  SHA512:
6
- metadata.gz: b19c8454c7333ee1397c78f068db3d1557d422ac8487167d24458ad4e4e6f1857e2c1e16e7ee1793bf50a20fc0a88836e4a4a30cc74a0f6556d970172accde1f
7
- data.tar.gz: 63fbc3723c539588adf9c312da99a55cd559874913ed2a4e0ea6f13f1ad0850f4d580e199055ffaf2f0b5eb99b00a55df83294272557e2b1129e07d5eedcd25f
6
+ metadata.gz: 93dab2296f05be33a67c346b1fd61c7e62de04e714f9dfae1d88cb40b1123794453e3093e0c81fd147f5fb29c189d41b7e0454c76abbbf70dc1d845a1454e473
7
+ data.tar.gz: 8df5d04c2bbe0b62ff302dd1115b70650cd16bb940013b62cc404014aff0046fe0e9afc016d679d4cb63d852dc63169df1bacdaacde7d28adace939ad4028a13
data/README.md CHANGED
@@ -38,10 +38,26 @@ LTI 1.3 has some additional configuration steps required to setup an LTI:
38
38
 
39
39
  1. If you're running Canvas locally, make sure the `config/redis.yml` and `config/dynamic_settings.yml` files exist in Canvas.
40
40
  2. Also make sure `config/security.yml` is present and set `development.lti_iss` to `'http://localhost:3000'` (where 3000 is the port you're running Canvas on).
41
- 3. In prod, you'll need to generate a RSA Private Key for the LTI to use. You can set the `LTI_PRIVATE_KEY` ENV variable, or manually set `PandaPal.lti_private_key = OpenSSL::PKey::RSA.new(key)`.
41
+ 3. In prod, you'll need to generate a RSA Private Key for the LTI to use. You have several options:
42
+ - Set the `LTI_PRIVATE_KEY` environment variable with the PEM-encoded private key content
43
+ - Set the `LTI_PRIVATE_KEY_PATH` environment variable with the path to your private key file (relative to Rails.root or absolute path)
44
+ - For encrypted private keys, set the `LTI_PRIVATE_KEY_PASSWORD` environment variable with the decryption password
45
+ - Manually set `PandaPal.lti_private_key = OpenSSL::PKey::RSA.new(key)`
42
46
  4. Make sure you have Redis installed and linked correctly
43
47
  5. Your PandaPal::Organization's `key` should be `CLIENT_ID/DEPLOYMENT_ID` (which can be found in Canvas). If a Deployment ID is not given, the key should just be `CLIENT_ID`.
44
48
 
49
+
50
+ To generate an encrypted private key using OpenSSL:
51
+ ```bash
52
+ # Generate new encrypted private key
53
+ openssl genrsa -aes256 -out encrypted_private_key.pem 2048
54
+
55
+ # Or encrypt existing private key
56
+ openssl rsa -aes256 -in existing_private_key.pem -out encrypted_private_key.pem
57
+ ```
58
+
59
+ **Note**: The private key file path supports both relative paths (relative to Rails.root) and absolute paths.
60
+
45
61
  ### Launch URL property
46
62
  LTI Spec: `The launch_url contains the URL to which the LTI Launch is to be sent. The secure_launch_url is the URL to use if secure http is required. One of either the launch_url or the secure_launch_url must be specified.`
47
63
 
@@ -1,3 +1,3 @@
1
1
  module PandaPal
2
- VERSION = "5.16.6"
2
+ VERSION = "5.16.7"
3
3
  end
data/lib/panda_pal.rb CHANGED
@@ -76,11 +76,19 @@ module PandaPal
76
76
  def self.lti_private_key
77
77
  key = @@lti_private_key.presence
78
78
  key ||= ENV['LTI_PRIVATE_KEY'].presence
79
+
80
+ if key.blank? && ENV['LTI_PRIVATE_KEY_PATH'].present?
81
+ key_path = File.expand_path(ENV['LTI_PRIVATE_KEY_PATH'], Rails.root)
82
+ key = File.read(key_path) if File.exist?(key_path)
83
+ end
84
+
79
85
  key ||= File.read(File.join( File.dirname(__FILE__), "../config/dev_lti_key.key")) if Rails.env.development?
80
86
  return nil unless key.present?
81
87
 
82
- key = OpenSSL::PKey::RSA.new(key) if key.is_a?(String)
83
- key
88
+ return key unless key.is_a?(String)
89
+
90
+ password = ENV['LTI_PRIVATE_KEY_PASSWORD']
91
+ OpenSSL::PKey::RSA.new(key, password)
84
92
  end
85
93
 
86
94
  def self.lti_private_key=(v)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda_pal
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.16.6
4
+ version: 5.16.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure CustomDev