signet 0.11.0 → 0.14.1
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 +4 -4
- data/CHANGELOG.md +51 -15
- data/Gemfile +5 -4
- data/README.md +4 -6
- data/Rakefile +107 -37
- data/lib/signet.rb +17 -14
- data/lib/signet/errors.rb +4 -4
- data/lib/signet/oauth_1.rb +129 -154
- data/lib/signet/oauth_1/client.rb +309 -343
- data/lib/signet/oauth_1/credential.rb +40 -37
- data/lib/signet/oauth_1/server.rb +197 -203
- data/lib/signet/oauth_1/signature_methods/hmac_sha1.rb +11 -10
- data/lib/signet/oauth_1/signature_methods/plaintext.rb +8 -7
- data/lib/signet/oauth_1/signature_methods/rsa_sha1.rb +11 -11
- data/lib/signet/oauth_2.rb +41 -43
- data/lib/signet/oauth_2/client.rb +328 -313
- data/lib/signet/version.rb +2 -73
- data/signet.gemspec +37 -39
- data/spec/signet/oauth_1/client_spec.rb +313 -315
- data/spec/signet/oauth_1/credential_spec.rb +64 -56
- data/spec/signet/oauth_1/server_spec.rb +362 -362
- data/spec/signet/oauth_1/signature_methods/hmac_sha1_spec.rb +26 -26
- data/spec/signet/oauth_1/signature_methods/plaintext_spec.rb +28 -28
- data/spec/signet/oauth_1/signature_methods/rsa_sha1_spec.rb +34 -35
- data/spec/signet/oauth_1_spec.rb +553 -524
- data/spec/signet/oauth_2/client_spec.rb +652 -576
- data/spec/signet/oauth_2_spec.rb +88 -89
- data/spec/signet_spec.rb +41 -41
- data/spec/spec_helper.rb +7 -7
- data/spec/spec_helper_spec.rb +8 -8
- metadata +64 -52
- data/tasks/clobber.rake +0 -2
- data/tasks/gem.rake +0 -34
- data/tasks/git.rake +0 -40
- data/tasks/metrics.rake +0 -41
- data/tasks/spec.rake +0 -34
- data/tasks/wiki.rake +0 -38
- data/tasks/yard.rake +0 -21
    
        data/spec/signet/oauth_2_spec.rb
    CHANGED
    
    | @@ -11,72 +11,72 @@ | |
| 11 11 | 
             
            #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         | 
| 12 12 | 
             
            #    See the License for the specific language governing permissions and
         | 
| 13 13 | 
             
            #    limitations under the License.
         | 
| 14 | 
            -
            require  | 
| 15 | 
            -
            require  | 
| 16 | 
            -
            require  | 
| 14 | 
            +
            require "spec_helper"
         | 
| 15 | 
            +
            require "signet/errors"
         | 
| 16 | 
            +
            require "signet/oauth_2"
         | 
| 17 17 |  | 
| 18 18 | 
             
            describe Signet::OAuth2 do
         | 
| 19 19 | 
             
              # This behavior will almost certainly change in subsequent updates.
         | 
| 20 | 
            -
              describe  | 
| 21 | 
            -
                it  | 
| 20 | 
            +
              describe "when parsing an Authorization header" do
         | 
| 21 | 
            +
                it "should correctly handle HTTP Basic auth-scheme" do
         | 
| 22 22 | 
             
                  parameters = Signet::OAuth2.parse_authorization_header(
         | 
| 23 | 
            -
                     | 
| 24 | 
            -
                  ). | 
| 25 | 
            -
                  expect(parameters[ | 
| 26 | 
            -
                  expect(parameters[ | 
| 23 | 
            +
                    "Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW"
         | 
| 24 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 25 | 
            +
                  expect(parameters["client_id"]).to eq "s6BhdRkqt3"
         | 
| 26 | 
            +
                  expect(parameters["client_secret"]).to eq "gX1fBat3bV"
         | 
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 | 
            -
                it  | 
| 29 | 
            +
                it "should correctly handle OAuth auth-scheme" do
         | 
| 30 30 | 
             
                  parameters = Signet::OAuth2.parse_authorization_header(
         | 
| 31 | 
            -
                     | 
| 32 | 
            -
                  ). | 
| 33 | 
            -
                  expect(parameters[ | 
| 31 | 
            +
                    "OAuth vF9dft4qmT"
         | 
| 32 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 33 | 
            +
                  expect(parameters["access_token"]).to eq "vF9dft4qmT"
         | 
| 34 34 | 
             
                end
         | 
| 35 35 |  | 
| 36 | 
            -
                it  | 
| 36 | 
            +
                it "should correctly handle OAuth auth-scheme with realm" do
         | 
| 37 37 | 
             
                  parameters = Signet::OAuth2.parse_authorization_header(
         | 
| 38 38 | 
             
                    'OAuth vF9dft4qmT, realm="http://sp.example.com/"'
         | 
| 39 | 
            -
                  ). | 
| 40 | 
            -
                  expect(parameters[ | 
| 41 | 
            -
                  expect(parameters[ | 
| 39 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 40 | 
            +
                  expect(parameters["access_token"]).to eq "vF9dft4qmT"
         | 
| 41 | 
            +
                  expect(parameters["realm"]).to eq "http://sp.example.com/"
         | 
| 42 42 | 
             
                end
         | 
| 43 43 |  | 
| 44 | 
            -
                it  | 
| 44 | 
            +
                it "should correctly handle OAuth auth-scheme with multiple auth-params" do
         | 
| 45 45 | 
             
                  parameters = Signet::OAuth2.parse_authorization_header(
         | 
| 46 46 | 
             
                    'OAuth vF9dft4qmT, first="one", second="two"'
         | 
| 47 | 
            -
                  ). | 
| 48 | 
            -
                  expect(parameters[ | 
| 49 | 
            -
                  expect(parameters[ | 
| 50 | 
            -
                  expect(parameters[ | 
| 47 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 48 | 
            +
                  expect(parameters["access_token"]).to eq "vF9dft4qmT"
         | 
| 49 | 
            +
                  expect(parameters["first"]).to eq "one"
         | 
| 50 | 
            +
                  expect(parameters["second"]).to eq "two"
         | 
| 51 51 | 
             
                end
         | 
| 52 52 |  | 
| 53 | 
            -
                it  | 
| 53 | 
            +
                it "should liberally handle auth-params with single-quoted strings" do
         | 
| 54 54 | 
             
                  parameters = Signet::OAuth2.parse_authorization_header(
         | 
| 55 | 
            -
                     | 
| 56 | 
            -
                  ). | 
| 57 | 
            -
                  expect(parameters[ | 
| 58 | 
            -
                  expect(parameters[ | 
| 59 | 
            -
                  expect(parameters[ | 
| 55 | 
            +
                    "OAuth vF9dft4qmT, first='one', second='two'"
         | 
| 56 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 57 | 
            +
                  expect(parameters["access_token"]).to eq "vF9dft4qmT"
         | 
| 58 | 
            +
                  expect(parameters["first"]).to eq "one"
         | 
| 59 | 
            +
                  expect(parameters["second"]).to eq "two"
         | 
| 60 60 | 
             
                end
         | 
| 61 61 |  | 
| 62 | 
            -
                it  | 
| 62 | 
            +
                it "should liberally handle auth-params with unquoted strings" do
         | 
| 63 63 | 
             
                  parameters = Signet::OAuth2.parse_authorization_header(
         | 
| 64 | 
            -
                     | 
| 65 | 
            -
                  ). | 
| 66 | 
            -
                  expect(parameters[ | 
| 67 | 
            -
                  expect(parameters[ | 
| 68 | 
            -
                  expect(parameters[ | 
| 64 | 
            +
                    "OAuth vF9dft4qmT, first=one, second=two"
         | 
| 65 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 66 | 
            +
                  expect(parameters["access_token"]).to eq "vF9dft4qmT"
         | 
| 67 | 
            +
                  expect(parameters["first"]).to eq "one"
         | 
| 68 | 
            +
                  expect(parameters["second"]).to eq "two"
         | 
| 69 69 | 
             
                end
         | 
| 70 70 |  | 
| 71 | 
            -
                it  | 
| 71 | 
            +
                it "should not allow unquoted strings that do not match tchar" do
         | 
| 72 72 | 
             
                  expect(lambda do
         | 
| 73 73 | 
             
                    parameters = Signet::OAuth2.parse_authorization_header(
         | 
| 74 | 
            -
                       | 
| 74 | 
            +
                      "OAuth vF9dft4qmT, first=one:1"
         | 
| 75 75 | 
             
                    )
         | 
| 76 76 | 
             
                  end).to raise_error(Signet::ParseError)
         | 
| 77 77 | 
             
                end
         | 
| 78 78 |  | 
| 79 | 
            -
                it  | 
| 79 | 
            +
                it "should not parse non-OAuth auth-schemes" do
         | 
| 80 80 | 
             
                  expect(lambda do
         | 
| 81 81 | 
             
                    Signet::OAuth2.parse_authorization_header(
         | 
| 82 82 | 
             
                      'AuthSub token="GD32CMCL25aZ-v____8B"'
         | 
| @@ -86,57 +86,57 @@ describe Signet::OAuth2 do | |
| 86 86 | 
             
              end
         | 
| 87 87 |  | 
| 88 88 | 
             
              # This behavior will almost certainly change in subsequent updates.
         | 
| 89 | 
            -
              describe  | 
| 90 | 
            -
                it  | 
| 89 | 
            +
              describe "when parsing a WWW-Authenticate header" do
         | 
| 90 | 
            +
                it "should correctly handle OAuth challenge with auth-params" do
         | 
| 91 91 | 
             
                  parameters = Signet::OAuth2.parse_www_authenticate_header(
         | 
| 92 | 
            -
                    'OAuth realm="http://sp.example.com/", error="expired_token", '  | 
| 92 | 
            +
                    'OAuth realm="http://sp.example.com/", error="expired_token", ' \
         | 
| 93 93 | 
             
                    'error_description="The access token has expired."'
         | 
| 94 | 
            -
                  ). | 
| 95 | 
            -
                  expect(parameters[ | 
| 96 | 
            -
                  expect(parameters[ | 
| 97 | 
            -
                  expect(parameters[ | 
| 94 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 95 | 
            +
                  expect(parameters["realm"]).to eq "http://sp.example.com/"
         | 
| 96 | 
            +
                  expect(parameters["error"]).to eq "expired_token"
         | 
| 97 | 
            +
                  expect(parameters["error_description"]).to eq "The access token has expired."
         | 
| 98 98 | 
             
                end
         | 
| 99 99 |  | 
| 100 | 
            -
                it  | 
| 100 | 
            +
                it "should liberally handle auth-params with single-quoted strings" do
         | 
| 101 101 | 
             
                  parameters = Signet::OAuth2.parse_www_authenticate_header(
         | 
| 102 | 
            -
                     | 
| 103 | 
            -
                     | 
| 104 | 
            -
                  ). | 
| 105 | 
            -
                  expect(parameters[ | 
| 106 | 
            -
                  expect(parameters[ | 
| 107 | 
            -
                  expect(parameters[ | 
| 102 | 
            +
                    "OAuth realm='http://sp.example.com/', error='expired_token', " \
         | 
| 103 | 
            +
                    "error_description='The access token has expired.'"
         | 
| 104 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 105 | 
            +
                  expect(parameters["realm"]).to eq "http://sp.example.com/"
         | 
| 106 | 
            +
                  expect(parameters["error"]).to eq "expired_token"
         | 
| 107 | 
            +
                  expect(parameters["error_description"]).to eq "The access token has expired."
         | 
| 108 108 | 
             
                end
         | 
| 109 109 |  | 
| 110 | 
            -
                it  | 
| 110 | 
            +
                it "should liberally handle auth-params with token strings" do
         | 
| 111 111 | 
             
                  parameters = Signet::OAuth2.parse_www_authenticate_header(
         | 
| 112 | 
            -
                    'OAuth realm="http://sp.example.com/", error=expired_token, '  | 
| 112 | 
            +
                    'OAuth realm="http://sp.example.com/", error=expired_token, ' \
         | 
| 113 113 | 
             
                    'error_description="The access token has expired."'
         | 
| 114 | 
            -
                  ). | 
| 115 | 
            -
                  expect(parameters[ | 
| 116 | 
            -
                  expect(parameters[ | 
| 117 | 
            -
                  expect(parameters[ | 
| 114 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 115 | 
            +
                  expect(parameters["realm"]).to eq "http://sp.example.com/"
         | 
| 116 | 
            +
                  expect(parameters["error"]).to eq "expired_token"
         | 
| 117 | 
            +
                  expect(parameters["error_description"]).to eq "The access token has expired."
         | 
| 118 118 | 
             
                end
         | 
| 119 119 |  | 
| 120 | 
            -
                it  | 
| 120 | 
            +
                it "should liberally handle out-of-order auth-params" do
         | 
| 121 121 | 
             
                  parameters = Signet::OAuth2.parse_www_authenticate_header(
         | 
| 122 | 
            -
                     | 
| 123 | 
            -
                     | 
| 124 | 
            -
                  ). | 
| 125 | 
            -
                  expect(parameters[ | 
| 126 | 
            -
                  expect(parameters[ | 
| 127 | 
            -
                  expect(parameters[ | 
| 122 | 
            +
                    "OAuth error_description='The access token has expired.', " \
         | 
| 123 | 
            +
                    "error='expired_token', realm='http://sp.example.com/'"
         | 
| 124 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 125 | 
            +
                  expect(parameters["realm"]).to eq "http://sp.example.com/"
         | 
| 126 | 
            +
                  expect(parameters["error"]).to eq "expired_token"
         | 
| 127 | 
            +
                  expect(parameters["error_description"]).to eq "The access token has expired."
         | 
| 128 128 | 
             
                end
         | 
| 129 129 |  | 
| 130 | 
            -
                it  | 
| 130 | 
            +
                it "should not allow unquoted strings that do not match tchar" do
         | 
| 131 131 | 
             
                  expect(lambda do
         | 
| 132 132 | 
             
                    Signet::OAuth2.parse_www_authenticate_header(
         | 
| 133 | 
            -
                       | 
| 133 | 
            +
                      "OAuth realm=http://sp.example.com/, error=expired_token, " \
         | 
| 134 134 | 
             
                      'error_description="The access token has expired."'
         | 
| 135 135 | 
             
                    )
         | 
| 136 136 | 
             
                  end).to raise_error(Signet::ParseError)
         | 
| 137 137 | 
             
                end
         | 
| 138 138 |  | 
| 139 | 
            -
                it  | 
| 139 | 
            +
                it "should not parse non-OAuth challenges" do
         | 
| 140 140 | 
             
                  expect(lambda do
         | 
| 141 141 | 
             
                    Signet::OAuth2.parse_www_authenticate_header(
         | 
| 142 142 | 
             
                      'AuthSub realm="https://www.google.com/accounts/AuthSubRequest"'
         | 
| @@ -145,50 +145,49 @@ describe Signet::OAuth2 do | |
| 145 145 | 
             
                end
         | 
| 146 146 | 
             
              end
         | 
| 147 147 |  | 
| 148 | 
            -
              describe  | 
| 149 | 
            -
                it  | 
| 148 | 
            +
              describe "when generating a Basic Authorization header" do
         | 
| 149 | 
            +
                it "should correctly handle client ID and password pairs" do
         | 
| 150 150 | 
             
                  # Example from OAuth 2 spec
         | 
| 151 151 | 
             
                  expect(Signet::OAuth2.generate_basic_authorization_header(
         | 
| 152 | 
            -
             | 
| 153 | 
            -
             | 
| 152 | 
            +
                           "s6BhdRkqt3", "gX1fBat3bV"
         | 
| 153 | 
            +
                         )).to eq "Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW"
         | 
| 154 154 | 
             
                end
         | 
| 155 155 |  | 
| 156 | 
            -
                it  | 
| 156 | 
            +
                it "should correctly encode using the alogrithm given in RFC 2617" do
         | 
| 157 157 | 
             
                  # Example from RFC 2617
         | 
| 158 158 | 
             
                  expect(Signet::OAuth2.generate_basic_authorization_header(
         | 
| 159 | 
            -
             | 
| 160 | 
            -
             | 
| 159 | 
            +
                           "Aladdin", "open sesame"
         | 
| 160 | 
            +
                         )).to eq "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
         | 
| 161 161 | 
             
                end
         | 
| 162 162 | 
             
              end
         | 
| 163 163 |  | 
| 164 | 
            -
              describe  | 
| 165 | 
            -
             | 
| 166 | 
            -
                it 'should correctly handle just an access token' do
         | 
| 164 | 
            +
              describe "when parsing a token response body" do
         | 
| 165 | 
            +
                it "should correctly handle just an access token" do
         | 
| 167 166 | 
             
                  expect(Signet::OAuth2.parse_credentials(
         | 
| 168 | 
            -
             | 
| 169 | 
            -
             | 
| 170 | 
            -
             | 
| 167 | 
            +
                           '{"access_token": "12345"}',
         | 
| 168 | 
            +
                           "application/json; charset=utf-8"
         | 
| 169 | 
            +
                         )).to eq ({ "access_token" => "12345" })
         | 
| 171 170 | 
             
                end
         | 
| 172 171 |  | 
| 173 | 
            -
                it  | 
| 172 | 
            +
                it "should handle form encoded responses" do
         | 
| 174 173 | 
             
                  expect(Signet::OAuth2.parse_credentials(
         | 
| 175 | 
            -
             | 
| 176 | 
            -
             | 
| 177 | 
            -
             | 
| 174 | 
            +
                           "access_token=12345&expires=1000",
         | 
| 175 | 
            +
                           "application/x-www-form-urlencoded; charset=utf-8"
         | 
| 176 | 
            +
                         )).to eq("access_token" => "12345", "expires" => "1000")
         | 
| 178 177 | 
             
                end
         | 
| 179 178 |  | 
| 180 | 
            -
                it  | 
| 179 | 
            +
                it "should raise an error for an invalid body" do
         | 
| 181 180 | 
             
                  expect(lambda do
         | 
| 182 181 | 
             
                    Signet::OAuth2.parse_credentials(
         | 
| 183 | 
            -
                       | 
| 184 | 
            -
                       | 
| 182 | 
            +
                      "This is not JSON.",
         | 
| 183 | 
            +
                      "application/json"
         | 
| 185 184 | 
             
                    )
         | 
| 186 185 | 
             
                  end).to raise_error(MultiJson::DecodeError)
         | 
| 187 186 | 
             
                end
         | 
| 188 187 |  | 
| 189 | 
            -
                it  | 
| 188 | 
            +
                it "should raise an error for a bogus body" do
         | 
| 190 189 | 
             
                  expect(lambda do
         | 
| 191 | 
            -
                    Signet::OAuth2.parse_credentials | 
| 190 | 
            +
                    Signet::OAuth2.parse_credentials :bogus, "application/json"
         | 
| 192 191 | 
             
                  end).to raise_error(TypeError)
         | 
| 193 192 | 
             
                end
         | 
| 194 193 | 
             
              end
         | 
    
        data/spec/signet_spec.rb
    CHANGED
    
    | @@ -11,68 +11,68 @@ | |
| 11 11 | 
             
            #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         | 
| 12 12 | 
             
            #    See the License for the specific language governing permissions and
         | 
| 13 13 | 
             
            #    limitations under the License.
         | 
| 14 | 
            -
            require  | 
| 15 | 
            -
            require  | 
| 14 | 
            +
            require "spec_helper"
         | 
| 15 | 
            +
            require "signet/oauth_2"
         | 
| 16 16 |  | 
| 17 17 | 
             
            describe Signet do
         | 
| 18 | 
            -
              describe  | 
| 19 | 
            -
                it  | 
| 18 | 
            +
              describe "when parsing an auth param list" do
         | 
| 19 | 
            +
                it "should correctly handle commas" do
         | 
| 20 20 | 
             
                  parameters = Signet.parse_auth_param_list(
         | 
| 21 21 | 
             
                    'a="1, 2" , b="3,4",c="5 , 6" ,d="7 ,8"'
         | 
| 22 | 
            -
                  ). | 
| 23 | 
            -
                  expect(parameters[ | 
| 24 | 
            -
                  expect(parameters[ | 
| 25 | 
            -
                  expect(parameters[ | 
| 26 | 
            -
                  expect(parameters[ | 
| 22 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 23 | 
            +
                  expect(parameters["a"]).to eq "1, 2"
         | 
| 24 | 
            +
                  expect(parameters["b"]).to eq "3,4"
         | 
| 25 | 
            +
                  expect(parameters["c"]).to eq "5 , 6"
         | 
| 26 | 
            +
                  expect(parameters["d"]).to eq "7 ,8"
         | 
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 | 
            -
                it  | 
| 29 | 
            +
                it "should correctly handle backslash-escaped pairs" do
         | 
| 30 30 | 
             
                  parameters = Signet.parse_auth_param_list(
         | 
| 31 31 | 
             
                    'token="\t\o\k\e\n" sigalg="\s\i\g\a\l\g" data="\d\a\t\a"'
         | 
| 32 | 
            -
                  ). | 
| 33 | 
            -
                  expect(parameters[ | 
| 34 | 
            -
                  expect(parameters[ | 
| 35 | 
            -
                  expect(parameters[ | 
| 32 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 33 | 
            +
                  expect(parameters["token"]).to eq "token"
         | 
| 34 | 
            +
                  expect(parameters["sigalg"]).to eq "sigalg"
         | 
| 35 | 
            +
                  expect(parameters["data"]).to eq "data"
         | 
| 36 36 | 
             
                end
         | 
| 37 37 |  | 
| 38 | 
            -
                it  | 
| 38 | 
            +
                it "should liberally handle space-separated auth-param lists" do
         | 
| 39 39 | 
             
                  parameters = Signet.parse_auth_param_list(
         | 
| 40 40 | 
             
                    'token="token" sigalg="sigalg" data="data" sig="sig"'
         | 
| 41 | 
            -
                  ). | 
| 42 | 
            -
                  expect(parameters[ | 
| 43 | 
            -
                  expect(parameters[ | 
| 44 | 
            -
                  expect(parameters[ | 
| 45 | 
            -
                  expect(parameters[ | 
| 41 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 42 | 
            +
                  expect(parameters["token"]).to eq "token"
         | 
| 43 | 
            +
                  expect(parameters["sigalg"]).to eq "sigalg"
         | 
| 44 | 
            +
                  expect(parameters["data"]).to eq "data"
         | 
| 45 | 
            +
                  expect(parameters["sig"]).to eq "sig"
         | 
| 46 46 | 
             
                end
         | 
| 47 47 |  | 
| 48 | 
            -
                it  | 
| 48 | 
            +
                it "should liberally handle single-quoted auth-param lists" do
         | 
| 49 49 | 
             
                  parameters = Signet.parse_auth_param_list(
         | 
| 50 | 
            -
                     | 
| 51 | 
            -
                  ). | 
| 52 | 
            -
                  expect(parameters[ | 
| 53 | 
            -
                  expect(parameters[ | 
| 54 | 
            -
                  expect(parameters[ | 
| 55 | 
            -
                  expect(parameters[ | 
| 50 | 
            +
                    "token='token' sigalg='sigalg' data='data' sig='sig'"
         | 
| 51 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 52 | 
            +
                  expect(parameters["token"]).to eq "token"
         | 
| 53 | 
            +
                  expect(parameters["sigalg"]).to eq "sigalg"
         | 
| 54 | 
            +
                  expect(parameters["data"]).to eq "data"
         | 
| 55 | 
            +
                  expect(parameters["sig"]).to eq "sig"
         | 
| 56 56 | 
             
                end
         | 
| 57 57 |  | 
| 58 | 
            -
                it  | 
| 58 | 
            +
                it "should liberally handle unquoted auth-param lists" do
         | 
| 59 59 | 
             
                  parameters = Signet.parse_auth_param_list(
         | 
| 60 | 
            -
                     | 
| 61 | 
            -
                  ). | 
| 62 | 
            -
                  expect(parameters[ | 
| 63 | 
            -
                  expect(parameters[ | 
| 64 | 
            -
                  expect(parameters[ | 
| 65 | 
            -
                  expect(parameters[ | 
| 60 | 
            +
                    "token=token sigalg=sigalg data=data sig=sig"
         | 
| 61 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 62 | 
            +
                  expect(parameters["token"]).to eq "token"
         | 
| 63 | 
            +
                  expect(parameters["sigalg"]).to eq "sigalg"
         | 
| 64 | 
            +
                  expect(parameters["data"]).to eq "data"
         | 
| 65 | 
            +
                  expect(parameters["sig"]).to eq "sig"
         | 
| 66 66 | 
             
                end
         | 
| 67 67 |  | 
| 68 | 
            -
                it  | 
| 68 | 
            +
                it "should liberally handle auth-param lists with empty sections" do
         | 
| 69 69 | 
             
                  parameters = Signet.parse_auth_param_list(
         | 
| 70 | 
            -
                     | 
| 71 | 
            -
                  ). | 
| 72 | 
            -
                  expect(parameters[ | 
| 73 | 
            -
                  expect(parameters[ | 
| 74 | 
            -
                  expect(parameters[ | 
| 75 | 
            -
                  expect(parameters[ | 
| 70 | 
            +
                    "token=token, , sigalg=sigalg,, data=data, sig=sig"
         | 
| 71 | 
            +
                  ).each_with_object({}) { |(k, v), h| h[k] = v; }
         | 
| 72 | 
            +
                  expect(parameters["token"]).to eq "token"
         | 
| 73 | 
            +
                  expect(parameters["sigalg"]).to eq "sigalg"
         | 
| 74 | 
            +
                  expect(parameters["data"]).to eq "data"
         | 
| 75 | 
            +
                  expect(parameters["sig"]).to eq "sig"
         | 
| 76 76 | 
             
                end
         | 
| 77 77 | 
             
              end
         | 
| 78 78 | 
             
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -1,10 +1,10 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            $LOAD_PATH.uniq!
         | 
| 2 2 |  | 
| 3 | 
            -
            require  | 
| 4 | 
            -
            require  | 
| 5 | 
            -
            require  | 
| 6 | 
            -
            require  | 
| 7 | 
            -
            require  | 
| 3 | 
            +
            require "rubygems"
         | 
| 4 | 
            +
            require "signet"
         | 
| 5 | 
            +
            require "rspec"
         | 
| 6 | 
            +
            require "simplecov"
         | 
| 7 | 
            +
            require "faraday"
         | 
| 8 8 |  | 
| 9 9 | 
             
            SimpleCov.start if ENV["COVERAGE"]
         | 
| 10 | 
            -
            Faraday::Adapter.load_middleware | 
| 10 | 
            +
            Faraday::Adapter.load_middleware :test
         | 
    
        data/spec/spec_helper_spec.rb
    CHANGED
    
    | @@ -1,16 +1,16 @@ | |
| 1 | 
            -
            RSpec.describe  | 
| 2 | 
            -
              let(:spec_dir) {  | 
| 3 | 
            -
              let(:root_dir) { File.expand_path | 
| 4 | 
            -
              let(:lib_dir) { File.expand_path | 
| 1 | 
            +
            RSpec.describe "spec_helper.rb" do
         | 
| 2 | 
            +
              let(:spec_dir) { __dir__ }
         | 
| 3 | 
            +
              let(:root_dir) { File.expand_path File.join(spec_dir, "..") }
         | 
| 4 | 
            +
              let(:lib_dir) { File.expand_path File.join(root_dir, "lib") }
         | 
| 5 5 |  | 
| 6 | 
            -
              describe  | 
| 7 | 
            -
                it  | 
| 6 | 
            +
              describe "spec_dir" do
         | 
| 7 | 
            +
                it "is already in $LOAD_PATH" do
         | 
| 8 8 | 
             
                  expect($LOAD_PATH).to include spec_dir
         | 
| 9 9 | 
             
                end
         | 
| 10 10 | 
             
              end
         | 
| 11 11 |  | 
| 12 | 
            -
              describe  | 
| 13 | 
            -
                it  | 
| 12 | 
            +
              describe "lib_dir" do
         | 
| 13 | 
            +
                it "is already in $LOAD_PATH" do
         | 
| 14 14 | 
             
                  expect($LOAD_PATH).to include lib_dir
         | 
| 15 15 | 
             
                end
         | 
| 16 16 | 
             
              end
         | 
    
        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. | 
| 4 | 
            +
              version: 0.14.1
         | 
| 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:  | 
| 12 | 
            +
            date: 2021-01-27 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: addressable
         | 
| @@ -29,30 +29,22 @@ dependencies: | |
| 29 29 | 
             
              name: faraday
         | 
| 30 30 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 31 31 | 
             
                requirements:
         | 
| 32 | 
            -
                - - " | 
| 33 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 34 | 
            -
                    version: '0.9'
         | 
| 35 | 
            -
              type: :runtime
         | 
| 36 | 
            -
              prerelease: false
         | 
| 37 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 38 | 
            -
                requirements:
         | 
| 39 | 
            -
                - - "~>"
         | 
| 32 | 
            +
                - - ">="
         | 
| 40 33 | 
             
                  - !ruby/object:Gem::Version
         | 
| 41 | 
            -
                    version:  | 
| 42 | 
            -
            -  | 
| 43 | 
            -
              name: multi_json
         | 
| 44 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 45 | 
            -
                requirements:
         | 
| 46 | 
            -
                - - "~>"
         | 
| 34 | 
            +
                    version: 0.17.3
         | 
| 35 | 
            +
                - - "<"
         | 
| 47 36 | 
             
                  - !ruby/object:Gem::Version
         | 
| 48 | 
            -
                    version: ' | 
| 37 | 
            +
                    version: '2.0'
         | 
| 49 38 | 
             
              type: :runtime
         | 
| 50 39 | 
             
              prerelease: false
         | 
| 51 40 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 52 41 | 
             
                requirements:
         | 
| 53 | 
            -
                - - " | 
| 42 | 
            +
                - - ">="
         | 
| 54 43 | 
             
                  - !ruby/object:Gem::Version
         | 
| 55 | 
            -
                    version:  | 
| 44 | 
            +
                    version: 0.17.3
         | 
| 45 | 
            +
                - - "<"
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '2.0'
         | 
| 56 48 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 57 49 | 
             
              name: jwt
         | 
| 58 50 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -74,53 +66,47 @@ dependencies: | |
| 74 66 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 67 | 
             
                    version: '3.0'
         | 
| 76 68 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 77 | 
            -
              name:  | 
| 69 | 
            +
              name: multi_json
         | 
| 78 70 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 79 71 | 
             
                requirements:
         | 
| 80 72 | 
             
                - - "~>"
         | 
| 81 73 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version: ' | 
| 83 | 
            -
              type: : | 
| 74 | 
            +
                    version: '1.10'
         | 
| 75 | 
            +
              type: :runtime
         | 
| 84 76 | 
             
              prerelease: false
         | 
| 85 77 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 86 78 | 
             
                requirements:
         | 
| 87 79 | 
             
                - - "~>"
         | 
| 88 80 | 
             
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            -
                    version: ' | 
| 81 | 
            +
                    version: '1.10'
         | 
| 90 82 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 91 | 
            -
              name:  | 
| 83 | 
            +
              name: google-style
         | 
| 92 84 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 93 85 | 
             
                requirements:
         | 
| 94 86 | 
             
                - - "~>"
         | 
| 95 87 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            -
                    version: '0. | 
| 97 | 
            -
                - - ">="
         | 
| 98 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 99 | 
            -
                    version: 0.9.12
         | 
| 88 | 
            +
                    version: '0.3'
         | 
| 100 89 | 
             
              type: :development
         | 
| 101 90 | 
             
              prerelease: false
         | 
| 102 91 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 103 92 | 
             
                requirements:
         | 
| 104 93 | 
             
                - - "~>"
         | 
| 105 94 | 
             
                  - !ruby/object:Gem::Version
         | 
| 106 | 
            -
                    version: '0. | 
| 107 | 
            -
                - - ">="
         | 
| 108 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 109 | 
            -
                    version: 0.9.12
         | 
| 95 | 
            +
                    version: '0.3'
         | 
| 110 96 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 111 | 
            -
              name:  | 
| 97 | 
            +
              name: kramdown
         | 
| 112 98 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 113 99 | 
             
                requirements:
         | 
| 114 100 | 
             
                - - "~>"
         | 
| 115 101 | 
             
                  - !ruby/object:Gem::Version
         | 
| 116 | 
            -
                    version: ' | 
| 102 | 
            +
                    version: '1.5'
         | 
| 117 103 | 
             
              type: :development
         | 
| 118 104 | 
             
              prerelease: false
         | 
| 119 105 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 120 106 | 
             
                requirements:
         | 
| 121 107 | 
             
                - - "~>"
         | 
| 122 108 | 
             
                  - !ruby/object:Gem::Version
         | 
| 123 | 
            -
                    version: ' | 
| 109 | 
            +
                    version: '1.5'
         | 
| 124 110 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 125 111 | 
             
              name: launchy
         | 
| 126 112 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -136,19 +122,33 @@ dependencies: | |
| 136 122 | 
             
                  - !ruby/object:Gem::Version
         | 
| 137 123 | 
             
                    version: '2.4'
         | 
| 138 124 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 139 | 
            -
              name:  | 
| 125 | 
            +
              name: rake
         | 
| 140 126 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 141 127 | 
             
                requirements:
         | 
| 142 128 | 
             
                - - "~>"
         | 
| 143 129 | 
             
                  - !ruby/object:Gem::Version
         | 
| 144 | 
            -
                    version: ' | 
| 130 | 
            +
                    version: '12.0'
         | 
| 145 131 | 
             
              type: :development
         | 
| 146 132 | 
             
              prerelease: false
         | 
| 147 133 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 148 134 | 
             
                requirements:
         | 
| 149 135 | 
             
                - - "~>"
         | 
| 150 136 | 
             
                  - !ruby/object:Gem::Version
         | 
| 151 | 
            -
                    version: ' | 
| 137 | 
            +
                    version: '12.0'
         | 
| 138 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 139 | 
            +
              name: rspec
         | 
| 140 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 141 | 
            +
                requirements:
         | 
| 142 | 
            +
                - - "~>"
         | 
| 143 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 144 | 
            +
                    version: '3.1'
         | 
| 145 | 
            +
              type: :development
         | 
| 146 | 
            +
              prerelease: false
         | 
| 147 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 148 | 
            +
                requirements:
         | 
| 149 | 
            +
                - - "~>"
         | 
| 150 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 151 | 
            +
                    version: '3.1'
         | 
| 152 152 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 153 153 | 
             
              name: simplecov
         | 
| 154 154 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -163,6 +163,26 @@ dependencies: | |
| 163 163 | 
             
                - - "~>"
         | 
| 164 164 | 
             
                  - !ruby/object:Gem::Version
         | 
| 165 165 | 
             
                    version: '0.9'
         | 
| 166 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 167 | 
            +
              name: yard
         | 
| 168 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 169 | 
            +
                requirements:
         | 
| 170 | 
            +
                - - "~>"
         | 
| 171 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 172 | 
            +
                    version: '0.9'
         | 
| 173 | 
            +
                - - ">="
         | 
| 174 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 175 | 
            +
                    version: 0.9.12
         | 
| 176 | 
            +
              type: :development
         | 
| 177 | 
            +
              prerelease: false
         | 
| 178 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 179 | 
            +
                requirements:
         | 
| 180 | 
            +
                - - "~>"
         | 
| 181 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 182 | 
            +
                    version: '0.9'
         | 
| 183 | 
            +
                - - ">="
         | 
| 184 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 185 | 
            +
                    version: 0.9.12
         | 
| 166 186 | 
             
            description: 'Signet is an OAuth 1.0 / OAuth 2.0 implementation.
         | 
| 167 187 |  | 
| 168 188 | 
             
            '
         | 
| @@ -203,21 +223,14 @@ files: | |
| 203 223 | 
             
            - spec/spec.opts
         | 
| 204 224 | 
             
            - spec/spec_helper.rb
         | 
| 205 225 | 
             
            - spec/spec_helper_spec.rb
         | 
| 206 | 
            -
            - tasks/clobber.rake
         | 
| 207 | 
            -
            - tasks/gem.rake
         | 
| 208 | 
            -
            - tasks/git.rake
         | 
| 209 | 
            -
            - tasks/metrics.rake
         | 
| 210 | 
            -
            - tasks/spec.rake
         | 
| 211 | 
            -
            - tasks/wiki.rake
         | 
| 212 | 
            -
            - tasks/yard.rake
         | 
| 213 226 | 
             
            - website/index.html
         | 
| 214 | 
            -
            homepage: https://github.com/ | 
| 227 | 
            +
            homepage: https://github.com/googleapis/signet
         | 
| 215 228 | 
             
            licenses:
         | 
| 216 229 | 
             
            - Apache-2.0
         | 
| 217 230 | 
             
            metadata:
         | 
| 218 | 
            -
              changelog_uri: https://github.com/ | 
| 219 | 
            -
              source_code_uri: https://github.com/ | 
| 220 | 
            -
              bug_tracker_uri: https://github.com/ | 
| 231 | 
            +
              changelog_uri: https://github.com/googleapis/signet/blob/master/CHANGELOG.md
         | 
| 232 | 
            +
              source_code_uri: https://github.com/googleapis/signet
         | 
| 233 | 
            +
              bug_tracker_uri: https://github.com/googleapis/signet/issues
         | 
| 221 234 | 
             
            post_install_message: 
         | 
| 222 235 | 
             
            rdoc_options:
         | 
| 223 236 | 
             
            - "--main"
         | 
| @@ -228,15 +241,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 228 241 | 
             
              requirements:
         | 
| 229 242 | 
             
              - - ">="
         | 
| 230 243 | 
             
                - !ruby/object:Gem::Version
         | 
| 231 | 
            -
                  version:  | 
| 244 | 
            +
                  version: 2.4.0
         | 
| 232 245 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 233 246 | 
             
              requirements:
         | 
| 234 247 | 
             
              - - ">="
         | 
| 235 248 | 
             
                - !ruby/object:Gem::Version
         | 
| 236 249 | 
             
                  version: 1.3.5
         | 
| 237 250 | 
             
            requirements: []
         | 
| 238 | 
            -
             | 
| 239 | 
            -
            rubygems_version: 2.7.6
         | 
| 251 | 
            +
            rubygems_version: 3.2.6
         | 
| 240 252 | 
             
            signing_key: 
         | 
| 241 253 | 
             
            specification_version: 4
         | 
| 242 254 | 
             
            summary: Signet is an OAuth 1.0 / OAuth 2.0 implementation.
         |