faria-launchpad-api 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: 141b8fba57f02ac17ef852773ddf56acb6fbc9ec
4
- data.tar.gz: e61ca8770a32d3104bed67fb303cf0e1000d2194
3
+ metadata.gz: 83d8f5483e9d09348b69ee459d246e3097c9cacf
4
+ data.tar.gz: 6879e2cf106c9fba214e3a3949a06174ecb1ed6e
5
5
  SHA512:
6
- metadata.gz: 4deb81abb926841e0fa08f536d101dff4ba50dab9418d40c8e7d3f02f3df58a9ce5d7b247f9a87b826fc721804081819eee52d141b148dfd5e82d3f19867c8e3
7
- data.tar.gz: 9dadac9c644080901b0b77da335e5729fb5ba4cd4718fd92d92ac56bdf94fafc9130900f0a9fb3345cc084e2c2e763bf084fb588d393e27660717e36aced5812
6
+ metadata.gz: 34f5889ccc831569547183d3e90f48840308ae0242efc1bc57c63bac5234435fd3e63778b2c8e7add7a07bc232a9d379336fb774b9079cad29aab7815dce56f9
7
+ data.tar.gz: d0daf6985bad5984e22706d0d2fc7972fd069ba92cc8707341201cff918d81fb970b8d4056da2c691f83743c04b9cf75d622f7d1e5ee224a3ced1fca3ef916fd
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Release History:
2
+
3
+ ## 0.2.1 - 26 September 2016
4
+
5
+ - First public release
6
+
7
+ ## 0.2.2 - 3 January 2017
8
+
9
+ - Updated JWE/JWT dependencies
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Josh Goebel
3
+ Copyright (c) 2016 Faria Education Group
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -61,7 +61,7 @@ kQIDAQAB
61
61
 
62
62
  #### Serving your public key inside your application
63
63
 
64
- The LaunchPad spec also requires that your web application serve this public key (text/plaintext) over HTTPs as part of the API your application must furnish to fully support LaunchPad.
64
+ The LaunchPad spec also requires that your web application serve this public key (text/plaintext) over HTTPS as part of the API your application must furnish to fully support LaunchPad.
65
65
 
66
66
  GET https://yourapplication.com/apis/launchpad/pubkey
67
67
  -----BEGIN PUBLIC KEY-----
@@ -79,17 +79,17 @@ Here is a quick example. This example presumes you've already generated a 2,048
79
79
 
80
80
 
81
81
  ```ruby
82
- # fetch the LaunchPad public key
83
- # (you should probably save it locally rather than constantly fetch it)
84
- uri = "https://devel.launchpad.managebac.com/api/v1/"
85
- launchpad_key = Net::HTTP.get_response(URI.parse(url + "pubkey")).body
82
+ # fetch the LaunchPad public key
83
+ # (you should save it locally rather than constantly fetch it)
84
+ uri = "https://launchpad.launchpad-staging.managebac.com/api/v1/"
85
+ launchpad_key = Net::HTTP.get_response(URI.parse(uri + "pubkey")).body
86
86
  local_key = OpenSSL::PKey::RSA.new(File.read("./secure/private_key"))
87
87
 
88
- @service = Faria::Launchpad::Service.new(
89
- "https://devel.launchpad.managebac.com/api/v1/",
88
+ service = Faria::Launchpad::Service.new(
89
+ "https://launchpad.launchpad-staging.managebac.com/api/v1/",
90
90
  {
91
91
  keys: { local: local_key, remote: launchpad_key },
92
- # the application name and URI issued to you during your
92
+ # the application name and URI issued to you during your
93
93
  # LaunchPad setup process
94
94
  source: {
95
95
  name: "Acme Widgets, LLC.",
@@ -110,7 +110,7 @@ The responses returned will almost always be JSON responses (see [API documentat
110
110
 
111
111
  ### Rails Integration
112
112
 
113
- There is a module to extend controllers to support easily handling incoming JWE requests and a Rails helper to assist with POSTing signed redirects. Below is a usage example.
113
+ There is a module to extend controllers to support easily handling incoming JWE requests and a Rails helper to assist with POSTing signed redirects. Below is a usage example.
114
114
 
115
115
  If the URL includes query parameters they will be stripped from the URL and encoded into the JWE as signed parameters.
116
116
 
@@ -147,12 +147,12 @@ The `SSO` module below is just one example of how you might wrap up all the piec
147
147
  class YourController < ActionController::Base
148
148
  include Faria::Launchpad::Controller
149
149
  launchpad_config SSO
150
-
150
+
151
151
  def action
152
- post_encrypted_redirect_to SSO.client.pairing_request_url,
152
+ post_encrypted_redirect_to SSO.client.pairing_request_url,
153
153
  params_to_pass
154
154
  end
155
-
155
+
156
156
  end
157
157
  ```
158
158
 
@@ -172,4 +172,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/eduvo/
172
172
  ## License
173
173
 
174
174
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
175
-
@@ -6,8 +6,8 @@ require 'faria/launchpad/api/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "faria-launchpad-api"
8
8
  spec.version = Faria::Launchpad::Api::VERSION
9
- spec.authors = ["Josh Goebel"]
10
- spec.email = ["me@joshgoebel.com"]
9
+ spec.authors = ["Faria Education Group"]
10
+ spec.email = ["rubygems@fariaedu.com"]
11
11
 
12
12
  spec.summary = %q{Ruby library to interface with Faria LaunchPad.}
13
13
  spec.description = %q{Ruby library to interface with Faria LaunchPad, including an API client and Rails helpers.}
@@ -35,11 +35,13 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "bundler", "~> 1.11"
36
36
  spec.add_development_dependency "rake", "~> 10.0"
37
37
  spec.add_development_dependency "minitest", "~> 5.0"
38
+ spec.add_development_dependency "pry", "~> 0.10"
39
+ spec.add_development_dependency "pry-byebug", "~> 3.4"
40
+ spec.add_development_dependency "simplecov"
41
+ spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
38
42
 
39
- # need 1.5.4 since they have been changing the component API a lot in minor
40
- # point releases
41
- spec.add_dependency "jwt", "~> 1.5.4"
42
- spec.add_dependency "jwe", "~> 0.1.0"
43
+ spec.add_dependency "jwt", "1.5.6"
44
+ spec.add_dependency "jwe", "0.1.1"
43
45
  spec.add_dependency "addressable", "~> 2.4"
44
46
  spec.add_dependency "activesupport"
45
47
  end
@@ -1,7 +1,7 @@
1
1
  module Faria
2
2
  module Launchpad
3
3
  module Api
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
6
6
  end
7
7
  end
@@ -23,7 +23,7 @@ module Faria
23
23
  end
24
24
  end
25
25
 
26
- # encrypting is done with Launchpad public key
26
+ # encrypting is done with LaunchPad public key
27
27
  # signing is done with local private key
28
28
 
29
29
  def self.encrypt(data, options = {}, local_key:, remote_key: )
@@ -39,14 +39,14 @@ module Faria
39
39
  end
40
40
 
41
41
  # for cases where you known in advance the remote key to use (such
42
- # as Launchpad clients which will only be receiving messages from
43
- # Launchpad and therefore will only use it's public key for verifying
42
+ # as LaunchPad clients which will only be receiving messages from
43
+ # LaunchPad and therefore will only use it's public key for verifying
44
44
  # signatures
45
45
  def self.decrypt(raw_data, options = {}, local_key:, remote_key: )
46
- version, jwe = raw_data.split(";", 2)
46
+ _version, jwe = raw_data.split(";", 2)
47
47
  jwt = JWE.decrypt(jwe, local_key)
48
48
  arr = JWT.decode(jwt, remote_key, true, { :algorithm => 'RS512' })
49
- payload, header = arr
49
+ payload, _header = arr
50
50
 
51
51
  # validate_expiration will be handled by JWT decode
52
52
  validate_url!(payload, options[:actual_url])
@@ -57,14 +57,14 @@ module Faria
57
57
  # for cases where the signature key is not known in advance and must
58
58
  # be determined by source information embedded in the JWT header
59
59
  def self.decrypt_variable_key(raw_data, options = {}, local_key:, remote_key_func: )
60
- version, jwe = raw_data.split(";", 2)
60
+ _version, jwe = raw_data.split(";", 2)
61
61
  jwt = JWE.decrypt(jwe, local_key)
62
62
  header, payload = JWT::Decode.new(jwt, nil, false, {}).decode_segments[0..1]
63
63
  remote_key = remote_key_func.call(header, payload)
64
64
  fail(MissingRemoteKey) if remote_key.nil?
65
65
 
66
66
  arr = JWT.decode(jwt, remote_key, true, { :algorithm => 'RS512' })
67
- payload, header = arr
67
+ payload, _header = arr
68
68
 
69
69
  # validate_expiration will be handled by JWT decode
70
70
  validate_url!(payload, options[:actual_url])
@@ -72,8 +72,6 @@ module Faria
72
72
  payload["data"]
73
73
  end
74
74
 
75
- private
76
-
77
75
  def self.add_source(packet, source)
78
76
  packet[:faria_source] = source
79
77
  packet
@@ -5,8 +5,6 @@ module Faria
5
5
  module Launchpad
6
6
  class Service
7
7
 
8
- LAUNCHPAD_NAME = "Launchpad"
9
-
10
8
  def self.noauth(endpoint, quiet: false)
11
9
  unless quiet
12
10
  puts "************************************************************************\n" \
@@ -82,8 +80,12 @@ module Faria
82
80
  patch "identities/#{uuid}", identity: identity_representation
83
81
  end
84
82
 
83
+ def import_identities(api_key, identities)
84
+ post "identities/import", {school_api_key: api_key, identities: identities}
85
+ end
86
+
85
87
  # by_value allows the unique pairing value to be used to perform
86
- # queries or updates instead of Launchpad's internal UUID
88
+ # queries or updates instead of LaunchPad's internal UUID
87
89
  def show_identity_by_pairing_value(pairing_value)
88
90
  get "identities/by_pairing_value/#{pairing_value}"
89
91
  end
@@ -153,11 +155,8 @@ module Faria
153
155
  payload = encrypt_payload(params, a)
154
156
  if verb == :get
155
157
  request['Faria-JWE'] = payload
156
- debug "Faria-JWE: #{payload}"
157
158
  else
158
159
  request['Content-Type'] = "application/jwe"
159
- debug "Content-Type: application/jwe"
160
- debug "POST BODY: #{payload}"
161
160
  request.body = payload
162
161
  end
163
162
  http.request request
@@ -176,10 +175,6 @@ module Faria
176
175
 
177
176
  private
178
177
 
179
- def debug(s)
180
- puts s
181
- end
182
-
183
178
  VALID_VERBS = %w(get put patch post get delete)
184
179
 
185
180
  # can't guarantee we have Rails or AS so we use eval vs
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faria-launchpad-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
- - Josh Goebel
7
+ - Faria Education Group
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-26 00:00:00.000000000 Z
11
+ date: 2017-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,33 +53,89 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: jwt
56
+ name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.5.4
62
- type: :runtime
61
+ version: '0.10'
62
+ type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.5.4
68
+ version: '0.10'
69
69
  - !ruby/object:Gem::Dependency
70
- name: jwe
70
+ name: pry-byebug
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.1.0
76
- type: :runtime
75
+ version: '3.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: codeclimate-test-reporter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.0.0
104
+ type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
108
  - - "~>"
81
109
  - !ruby/object:Gem::Version
82
- version: 0.1.0
110
+ version: 1.0.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: jwt
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.5.6
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.5.6
125
+ - !ruby/object:Gem::Dependency
126
+ name: jwe
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.1.1
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.1.1
83
139
  - !ruby/object:Gem::Dependency
84
140
  name: addressable
85
141
  requirement: !ruby/object:Gem::Requirement
@@ -111,13 +167,14 @@ dependencies:
111
167
  description: Ruby library to interface with Faria LaunchPad, including an API client
112
168
  and Rails helpers.
113
169
  email:
114
- - me@joshgoebel.com
170
+ - rubygems@fariaedu.com
115
171
  executables:
116
172
  - console
117
173
  - setup
118
174
  extensions: []
119
175
  extra_rdoc_files: []
120
176
  files:
177
+ - CHANGELOG.md
121
178
  - Gemfile
122
179
  - LICENSE.txt
123
180
  - README.md
@@ -152,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
209
  version: '0'
153
210
  requirements: []
154
211
  rubyforge_project:
155
- rubygems_version: 2.4.5
212
+ rubygems_version: 2.6.8
156
213
  signing_key:
157
214
  specification_version: 4
158
215
  summary: Ruby library to interface with Faria LaunchPad.