Skip to content

Commit

Permalink
one of many
Browse files Browse the repository at this point in the history
Signed-off-by: Hermann Mayer <[email protected]>
  • Loading branch information
Jack12816 committed Jan 3, 2025
1 parent 1ce9f97 commit d24c753
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spec/keyless/jwt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@ def new_signed_token(custom_private_key: nil, **payload)
exp: 1.hour.from_now.to_i,
aud: audience }
end
let(:valid) { new_signed_token(payload) }
let(:wrong_issuer) { new_signed_token(payload.merge(iss: 'wrong')) }
let(:expired) { new_signed_token(payload.merge(exp: 1.week.ago.to_i)) }
let(:wrong_audience) { new_signed_token(payload.merge(aud: 'wrong')) }
let(:missing_issued_at) { new_signed_token(payload.merge(iat: nil)) }
let(:valid) { new_signed_token(**payload) }
let(:wrong_issuer) { new_signed_token(**payload, iss: 'wrong') }
let(:expired) { new_signed_token(**payload, exp: 1.week.ago.to_i) }
let(:wrong_audience) { new_signed_token(**payload, aud: 'wrong') }
let(:missing_issued_at) { new_signed_token(**payload, iat: nil) }
let(:invalid_sign) do
key = OpenSSL::PKey::RSA.new(2048)
new_signed_token(custom_private_key: key, **payload)
end
let(:manipulated_payload) do
parts = new_signed_token(payload).split('.')
parts = new_signed_token(**payload).split('.')
new_payload = Base64.urlsafe_encode64({ test: true }.to_json)
"#{parts.first}.#{new_payload}.#{parts.last}"
end
Expand Down Expand Up @@ -189,7 +189,7 @@ def configure_valid
end

it 'detects valid tokens' do
token = described_class.new(new_signed_token(payload))
token = described_class.new(new_signed_token(**payload))
configure_valid
expect(token.valid?).to be(true)
end
Expand Down

0 comments on commit d24c753

Please sign in to comment.