signet 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d6cce64f05742592f4945a2a394ab1fc239107e9c5d8145f38a4189689e46ea
4
- data.tar.gz: a20b6a81fac21113e804c8cbac63db3464da5357aa7428bc17509212217e50a3
3
+ metadata.gz: 7bc1d85dc2f8c727e54436bb38a284576cb81ea5ee0b0af58860678cb069bde9
4
+ data.tar.gz: e0b149f3ee841fe5f30af08a2d0e6cebbfbc173d1370d4e4a8fc3b2109fa54a0
5
5
  SHA512:
6
- metadata.gz: b1f2c4ab3031aa346f118bc152f129559436f92ae8b3d0008f3a2efa51fb82e0e45fec0f999c6984772be58661c90f6fbe1a1c973cf6ccdec8329696da4e1101
7
- data.tar.gz: fc909052f1a89ec0f79d9b9a36ca7196cef5be879595e8c1e7699050ced959b3062881e1418fc9b8258985819f3c2bb64e7e9f60008f25e5ddccb6375934c2f5
6
+ metadata.gz: 2ef091d389b3ac52e87dba96f8647a072acf11a346244600bca551b23ead3c24bb73d75209af7c79c261769d5589053c84a3bb837fb57f2b063e19d3516d0ad4
7
+ data.tar.gz: d8a38134dd48453e0e976639b7ded1838ee363ab3b27917847f27e8de98adcb9f60f28359a90459a75537a03595417bd7275e4b3f291019cb13ea4eb09383495
data/.yardopts ADDED
@@ -0,0 +1,11 @@
1
+ --no-private
2
+ --title=Signet
3
+ --markup markdown
4
+ --markup-provider redcarpet
5
+
6
+ ./lib/**/*.rb
7
+ -
8
+ README.md
9
+ CHANGELOG.md
10
+ CODE_OF_CONDUCT.md
11
+ LICENSE
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Release History
2
2
 
3
+ ## [0.16.0](https://www.github.com/googleapis/signet/compare/signet/v0.15.0...signet/v0.16.0) (2021-09-03)
4
+
5
+
6
+ ### Features
7
+
8
+ * Support for fetching an access token with basic auth ([3c43e32](https://www.github.com/googleapis/signet/commit/3c43e3201d79b1e2303e672f3c07e060c5079423))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Remove extraneous files from the gem ([e515bb6](https://www.github.com/googleapis/signet/commit/e515bb627a64e32ec885412fed8b01eb73067ee0))
14
+ * Require addressable 2.8 to remediate vulnerability ([9a2f899](https://www.github.com/googleapis/signet/commit/9a2f8996f522538c4bb7998535e2a50331d564fc))
15
+
3
16
  ## [0.15.0](https://www.github.com/googleapis/signet/compare/v0.14.1...v0.15.0) (2021-03-04)
4
17
 
5
18
 
@@ -0,0 +1,43 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project,
4
+ and in the interest of fostering an open and welcoming community,
5
+ we pledge to respect all people who contribute through reporting issues,
6
+ posting feature requests, updating documentation,
7
+ submitting pull requests or patches, and other activities.
8
+
9
+ We are committed to making participation in this project
10
+ a harassment-free experience for everyone,
11
+ regardless of level of experience, gender, gender identity and expression,
12
+ sexual orientation, disability, personal appearance,
13
+ body size, race, ethnicity, age, religion, or nationality.
14
+
15
+ Examples of unacceptable behavior by participants include:
16
+
17
+ * The use of sexualized language or imagery
18
+ * Personal attacks
19
+ * Trolling or insulting/derogatory comments
20
+ * Public or private harassment
21
+ * Publishing other's private information,
22
+ such as physical or electronic
23
+ addresses, without explicit permission
24
+ * Other unethical or unprofessional conduct.
25
+
26
+ Project maintainers have the right and responsibility to remove, edit, or reject
27
+ comments, commits, code, wiki edits, issues, and other contributions
28
+ that are not aligned to this Code of Conduct.
29
+ By adopting this Code of Conduct,
30
+ project maintainers commit themselves to fairly and consistently
31
+ applying these principles to every aspect of managing this project.
32
+ Project maintainers who do not follow or enforce the Code of Conduct
33
+ may be permanently removed from the project team.
34
+
35
+ This code of conduct applies both within project spaces and in public spaces
36
+ when an individual is representing the project or its community.
37
+
38
+ Instances of abusive, harassing, or otherwise unacceptable behavior
39
+ may be reported by opening an issue
40
+ or contacting one or more of the project maintainers.
41
+
42
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
43
+ available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
data/SECURITY.md ADDED
@@ -0,0 +1,7 @@
1
+ # Security Policy
2
+
3
+ To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
4
+
5
+ The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
6
+
7
+ We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- module Signet #:nodoc:
15
+ module Signet # :nodoc:
16
16
  module OAuth1
17
17
  class Credential
18
18
  ##
@@ -1,7 +1,7 @@
1
1
  require "openssl"
2
2
  require "signet"
3
3
 
4
- module Signet #:nodoc:
4
+ module Signet # :nodoc:
5
5
  module OAuth1
6
6
  module HMACSHA1
7
7
  def self.generate_signature \
@@ -1,6 +1,6 @@
1
1
  require "signet"
2
2
 
3
- module Signet #:nodoc:
3
+ module Signet # :nodoc:
4
4
  module OAuth1
5
5
  module PLAINTEXT
6
6
  def self.generate_signature \
@@ -3,7 +3,7 @@ require "base64"
3
3
  require "openssl"
4
4
  require "signet"
5
5
 
6
- module Signet #:nodoc:
6
+ module Signet # :nodoc:
7
7
  module OAuth1
8
8
  module RSASHA1
9
9
  def self.generate_signature \
@@ -3,7 +3,7 @@ require "signet"
3
3
 
4
4
  require "securerandom"
5
5
 
6
- module Signet #:nodoc:
6
+ module Signet # :nodoc:
7
7
  module OAuth1
8
8
  OUT_OF_BAND = "oob".freeze
9
9
 
@@ -880,13 +880,13 @@ module Signet
880
880
  end
881
881
 
882
882
  def grant_type= new_grant_type
883
- case new_grant_type
884
- when "authorization_code", "refresh_token",
885
- "password", "client_credentials"
886
- @grant_type = new_grant_type
887
- else
888
- @grant_type = Addressable::URI.parse new_grant_type
889
- end
883
+ @grant_type =
884
+ case new_grant_type
885
+ when "authorization_code", "refresh_token", "password", "client_credentials"
886
+ new_grant_type
887
+ else
888
+ Addressable::URI.parse new_grant_type
889
+ end
890
890
  end
891
891
 
892
892
  def to_jwt options = {}
@@ -972,8 +972,8 @@ module Signet
972
972
  end
973
973
  parameters.merge! extension_parameters
974
974
  end
975
- parameters["client_id"] = client_id unless client_id.nil?
976
- parameters["client_secret"] = client_secret unless client_secret.nil?
975
+ parameters["client_id"] = client_id if !options[:use_basic_auth] && !client_id.nil?
976
+ parameters["client_secret"] = client_secret if !options[:use_basic_auth] && !client_secret.nil?
977
977
  if options[:scope]
978
978
  parameters["scope"] = options[:scope]
979
979
  elsif options[:use_configured_scope] && !scope.nil?
@@ -990,10 +990,11 @@ module Signet
990
990
  options = deep_hash_normalize options
991
991
 
992
992
  client = options[:connection] ||= Faraday.default_connection
993
- url = Addressable::URI.parse(token_credential_uri).normalize.to_s
993
+ url = Addressable::URI.parse token_credential_uri
994
994
  parameters = generate_access_token_request options
995
995
  if client.is_a? Faraday::Connection
996
- response = client.post url,
996
+ client.basic_auth client_id, client_secret if options[:use_basic_auth]
997
+ response = client.post url.normalize.to_s,
997
998
  Addressable::URI.form_encode(parameters),
998
999
  "Content-Type" => "application/x-www-form-urlencoded"
999
1000
  status = response.status.to_i
@@ -1001,7 +1002,11 @@ module Signet
1001
1002
  content_type = response.headers["Content-type"]
1002
1003
  else
1003
1004
  # Hurley
1004
- response = client.post url, parameters
1005
+ if options[:use_basic_auth]
1006
+ url.user = client_id
1007
+ url.password = client_secret
1008
+ end
1009
+ response = client.post url.normalize.to_s, parameters
1005
1010
  status = response.status_code.to_i
1006
1011
  body = response.body
1007
1012
  content_type = response.header[:content_type]
@@ -16,7 +16,7 @@ require "base64"
16
16
  require "signet"
17
17
  require "multi_json"
18
18
 
19
- module Signet #:nodoc:
19
+ module Signet # :nodoc:
20
20
  ##
21
21
  # An implementation of http://tools.ietf.org/html/draft-ietf-oauth-v2-10
22
22
  #
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module Signet
16
- VERSION = "0.15.0".freeze
16
+ VERSION = "0.16.0".freeze
17
17
  end
data/lib/signet.rb CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  require "signet/version"
16
16
 
17
- module Signet #:nodoc:
17
+ module Signet # :nodoc:
18
18
  def self.parse_auth_param_list auth_param_string
19
19
  # Production rules from:
20
20
  # http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-12
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Aman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-04 00:00:00.000000000 Z
12
+ date: 2021-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '2.3'
20
+ version: '2.8'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '2.3'
27
+ version: '2.8'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: faraday
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -127,14 +127,28 @@ dependencies:
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '12.0'
130
+ version: '13.0'
131
131
  type: :development
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '12.0'
137
+ version: '13.0'
138
+ - !ruby/object:Gem::Dependency
139
+ name: redcarpet
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '3.0'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '3.0'
138
152
  - !ruby/object:Gem::Dependency
139
153
  name: rspec
140
154
  requirement: !ruby/object:Gem::Requirement
@@ -192,11 +206,12 @@ extensions: []
192
206
  extra_rdoc_files:
193
207
  - README.md
194
208
  files:
209
+ - ".yardopts"
195
210
  - CHANGELOG.md
196
- - Gemfile
211
+ - CODE_OF_CONDUCT.md
197
212
  - LICENSE
198
213
  - README.md
199
- - Rakefile
214
+ - SECURITY.md
200
215
  - lib/signet.rb
201
216
  - lib/signet/errors.rb
202
217
  - lib/signet/oauth_1.rb
@@ -209,21 +224,6 @@ files:
209
224
  - lib/signet/oauth_2.rb
210
225
  - lib/signet/oauth_2/client.rb
211
226
  - lib/signet/version.rb
212
- - signet.gemspec
213
- - spec/signet/oauth_1/client_spec.rb
214
- - spec/signet/oauth_1/credential_spec.rb
215
- - spec/signet/oauth_1/server_spec.rb
216
- - spec/signet/oauth_1/signature_methods/hmac_sha1_spec.rb
217
- - spec/signet/oauth_1/signature_methods/plaintext_spec.rb
218
- - spec/signet/oauth_1/signature_methods/rsa_sha1_spec.rb
219
- - spec/signet/oauth_1_spec.rb
220
- - spec/signet/oauth_2/client_spec.rb
221
- - spec/signet/oauth_2_spec.rb
222
- - spec/signet_spec.rb
223
- - spec/spec.opts
224
- - spec/spec_helper.rb
225
- - spec/spec_helper_spec.rb
226
- - website/index.html
227
227
  homepage: https://github.com/googleapis/signet
228
228
  licenses:
229
229
  - Apache-2.0
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  - !ruby/object:Gem::Version
249
249
  version: 1.3.5
250
250
  requirements: []
251
- rubygems_version: 3.2.11
251
+ rubygems_version: 3.2.17
252
252
  signing_key:
253
253
  specification_version: 4
254
254
  summary: Signet is an OAuth 1.0 / OAuth 2.0 implementation.
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- gem "bundler", ">= 1.15"
6
- gem "gems", "~> 1.2"
7
- gem "hurley"
8
- gem "jruby-openssl", platforms: :jruby
data/Rakefile DELETED
@@ -1,112 +0,0 @@
1
- require "rubygems"
2
- require "json"
3
- require "rake"
4
- require "bundler/gem_tasks"
5
-
6
- task :release_gem, :tag do |_t, args|
7
- tag = args[:tag]
8
- raise "You must provide a tag to release." if tag.nil?
9
-
10
- # Verify the tag format "vVERSION"
11
- m = tag.match /v(?<version>\S*)/
12
- raise "Tag #{tag} does not match the expected format." if m.nil?
13
-
14
- version = m[:version]
15
- raise "You must provide a version." if version.nil?
16
-
17
- api_token = ENV["RUBYGEMS_API_TOKEN"]
18
-
19
- require "gems"
20
- if api_token
21
- ::Gems.configure do |config|
22
- config.key = api_token
23
- end
24
- end
25
-
26
- Bundler.with_clean_env do
27
- sh "rm -rf pkg"
28
- sh "bundle update"
29
- sh "bundle exec rake build"
30
- end
31
-
32
- path_to_be_pushed = "pkg/signet-#{version}.gem"
33
- gem_was_published = nil
34
- if File.file? path_to_be_pushed
35
- begin
36
- response = ::Gems.push File.new(path_to_be_pushed)
37
- puts response
38
- raise unless response.include? "Successfully registered gem:"
39
- gem_was_published = true
40
- puts "Successfully built and pushed signet for version #{version}"
41
- rescue StandardError => e
42
- gem_was_published = false
43
- puts "Error while releasing signet version #{version}: #{e.message}"
44
- end
45
- else
46
- raise "Cannot build signet for version #{version}"
47
- end
48
-
49
- Rake::Task["kokoro:publish_docs"].invoke if gem_was_published
50
- end
51
-
52
- task :ci do
53
- header "Using Ruby - #{RUBY_VERSION}"
54
- sh "bundle exec rubocop"
55
- sh "bundle exec rspec"
56
- end
57
-
58
- namespace :kokoro do
59
- task :load_env_vars do
60
- service_account = "#{ENV['KOKORO_GFILE_DIR']}/service-account.json"
61
- ENV["GOOGLE_APPLICATION_CREDENTIALS"] = service_account
62
- filename = "#{ENV['KOKORO_GFILE_DIR']}/env_vars.json"
63
- env_vars = JSON.parse File.read(filename)
64
- env_vars.each { |k, v| ENV[k] = v }
65
- end
66
-
67
- task :presubmit do
68
- Rake::Task["ci"].invoke
69
- end
70
-
71
- task :continuous do
72
- Rake::Task["ci"].invoke
73
- end
74
-
75
- task :nightly do
76
- Rake::Task["ci"].invoke
77
- end
78
-
79
- task :release do
80
- version = "0.1.0"
81
- Bundler.with_clean_env do
82
- version = `bundle exec gem list`
83
- .split("\n").select { |line| line.include? "signet" }
84
- .first.split("(").last.split(")").first || "0.1.0"
85
- end
86
- Rake::Task["kokoro:load_env_vars"].invoke
87
- Rake::Task["release_gem"].invoke "v#{version}"
88
- end
89
-
90
- task :post do
91
- require_relative "rakelib/link_checker.rb"
92
-
93
- link_checker = LinkChecker.new
94
- link_checker.run
95
- exit link_checker.exit_status
96
- end
97
-
98
- task :publish_docs do
99
- require_relative "rakelib/devsite_builder.rb"
100
-
101
- DevsiteBuilder.new(__dir__).publish
102
- end
103
- end
104
-
105
- def header str, token = "#"
106
- line_length = str.length + 8
107
- puts ""
108
- puts token * line_length
109
- puts "#{token * 3} #{str} #{token * 3}"
110
- puts token * line_length
111
- puts ""
112
- end