~ren/magentasso-rb

567f127b975b8857f5abd9c9cb0c80a3cbd18990 — Lauren Jenkinson 3 months ago d93b482 main v0.1.0
Fix tests after changing the padding option in #encode_and_sign
3 files changed, 4 insertions(+), 4 deletions(-)

M spec/magentasso_request_spec.rb
M spec/magentasso_response_spec.rb
M spec/magentasso_spec.rb
M spec/magentasso_request_spec.rb => spec/magentasso_request_spec.rb +1 -1
@@ 11,7 11,7 @@ RSpec.describe MagentaSSO::Request do
    )

    _, signature = request.sign
    expect(signature).to eq "QrPlvDbAZk0aH46Wl2qbGWpBL1EqU8H6QTgemxdR-kM"
    expect(signature).to eq "-tW2aZK8IDH7RyWoWb_4qwNHJQr9hzChR-ptGFCG1kA="
  end

  it "verifies a signed request" do

M spec/magentasso_response_spec.rb => spec/magentasso_response_spec.rb +2 -2
@@ 11,7 11,7 @@ RSpec.describe MagentaSSO::Response do # rubocop:disable Metrics/BlockLength
    )

    _, signature = response.sign
    expect(signature).to eq "dfVZ0jF8tGlWc7umZVstuqb9Y731-NRyA3J2Ye_CqE8"
    expect(signature).to eq "dfVZ0jF8tGlWc7umZVstuqb9Y731-NRyA3J2Ye_CqE8="
  end

  it "verifies a signed response" do


@@ 19,7 19,7 @@ RSpec.describe MagentaSSO::Response do # rubocop:disable Metrics/BlockLength
      "eyJjbGllbnRfaWQiOiJ0ZXN0Iiwibm9uY2UiOjEyMzQ1NiwidXNlcl9kYXRhIjp7ImV4d" \
      "GVybmFsX2lkIjoxLCJlbWFpbCI6InRlc3RAZXhhbXBsZS5jb20ifSwic2NvcGVfZGF0YS" \
      "I6eyJwcm9maWxlIjp7Im5hbWVfY29tYmluZWQiOiJUZXN0IFVzZXIifX19"
    signature = "dfVZ0jF8tGlWc7umZVstuqb9Y731-NRyA3J2Ye_CqE8"
    signature = "dfVZ0jF8tGlWc7umZVstuqb9Y731-NRyA3J2Ye_CqE8="

    response = MagentaSSO::Response.verify(
      payload,

M spec/magentasso_spec.rb => spec/magentasso_spec.rb +1 -1
@@ 15,7 15,7 @@ RSpec.describe MagentaSSO do

    it "signs the payload" do
      _, signature = MagentaSSO.encode_and_sign({ "test" => true }, MagentaSSO::TEST_SECRET)
      expect(signature).to eq "AHlrP-r0AtZ_zK-uQTUqdBPH85q-Ezu3mDUdlSnndMQ"
      expect(signature).to eq "oATdmo0RGp204cG0awcqGhOaY6R2OWMIut4hEp51pI4="
    end
  end