Skip to content

Commit e46d791

Browse files
Merge pull request #461 from cedarcode/nt--fix-deprecation-warnings-in-tests
Use `allowed_origins` instead of deprecated `origin` in test
2 parents 90f62bf + cc36cb4 commit e46d791

6 files changed

+20
-20
lines changed

spec/webauthn/authenticator_assertion_response_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
end
2828

2929
before do
30-
WebAuthn.configuration.origin = origin
30+
WebAuthn.configuration.allowed_origins = [origin]
3131
end
3232

3333
context "when everything's in place" do

spec/webauthn/authenticator_attestation_response_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
context "when everything's in place" do
3838
context "when there is a single origin" do
3939
before do
40-
WebAuthn.configuration.origin = origin
40+
WebAuthn.configuration.allowed_origins = [origin]
4141
end
4242

4343
it_behaves_like "a valid attestation response"
@@ -131,7 +131,7 @@
131131

132132
before do
133133
WebAuthn.configuration.attestation_root_certificates_finders = finder_for('feitian_ft_fido_0200.pem')
134-
WebAuthn.configuration.origin = origin
134+
WebAuthn.configuration.allowed_origins = [origin]
135135
end
136136

137137
it_behaves_like "a valid attestation response"
@@ -209,7 +209,7 @@
209209
end
210210

211211
before do
212-
WebAuthn.configuration.origin = origin
212+
WebAuthn.configuration.allowed_origins = [origin]
213213
end
214214

215215
it_behaves_like "a valid attestation response"
@@ -250,7 +250,7 @@
250250

251251
before do
252252
WebAuthn.configuration.attestation_root_certificates_finders = finder_for('yubico_u2f_root.pem')
253-
WebAuthn.configuration.origin = origin
253+
WebAuthn.configuration.allowed_origins = [origin]
254254
end
255255

256256
it_behaves_like "a valid attestation response"
@@ -286,7 +286,7 @@
286286
end
287287

288288
before do
289-
WebAuthn.configuration.origin = origin
289+
WebAuthn.configuration.allowed_origins = [origin]
290290
WebAuthn.configure do |config|
291291
config.algorithms.concat(%w(RS1))
292292
end
@@ -347,7 +347,7 @@
347347
end
348348

349349
before do
350-
WebAuthn.configuration.origin = origin
350+
WebAuthn.configuration.allowed_origins = [origin]
351351
allow(attestation_response.attestation_statement).to receive(:time).and_return(time)
352352
end
353353

@@ -391,7 +391,7 @@
391391
let(:origin) { seeds[:android_key_direct][:origin] }
392392

393393
before do
394-
WebAuthn.configuration.origin = origin
394+
WebAuthn.configuration.allowed_origins = [origin]
395395
end
396396

397397
it_behaves_like "a valid attestation response"
@@ -481,7 +481,7 @@
481481
end
482482

483483
before do
484-
WebAuthn.configuration.origin = origin
484+
WebAuthn.configuration.allowed_origins = [origin]
485485

486486
# Apple credential certificate expires after 3 days apparently.
487487
# Seed data was obtained 22nd Feb 2021, so we are simulating validation within that 3 day timeframe
@@ -504,7 +504,7 @@
504504

505505
context "when no client data received" do
506506
before do
507-
WebAuthn.configuration.origin = origin
507+
WebAuthn.configuration.allowed_origins = [origin]
508508
end
509509

510510
it "returns user-friendly error if no client data received" do
@@ -534,7 +534,7 @@
534534
end
535535

536536
before do
537-
WebAuthn.configuration.origin = origin
537+
WebAuthn.configuration.allowed_origins = [origin]
538538
end
539539

540540
context "matches the default one" do
@@ -610,7 +610,7 @@
610610
let(:client) { WebAuthn::FakeClient.new(origin, token_binding: token_binding, encoding: false) }
611611

612612
before do
613-
WebAuthn.configuration.origin = origin
613+
WebAuthn.configuration.allowed_origins = [origin]
614614
end
615615

616616
context "it has stuff" do
@@ -718,7 +718,7 @@
718718

719719
describe "user verification" do
720720
before do
721-
WebAuthn.configuration.origin = origin
721+
WebAuthn.configuration.allowed_origins = [origin]
722722
end
723723

724724
context "when UV is not set" do
@@ -738,7 +738,7 @@
738738

739739
describe "attested credential data verification" do
740740
before do
741-
WebAuthn.configuration.origin = origin
741+
WebAuthn.configuration.allowed_origins = [origin]
742742
end
743743

744744
context "when AT is not set" do
@@ -783,7 +783,7 @@
783783
before do
784784
attestation_response.attestation_statement.instance_variable_get(:@statement)["sig"] =
785785
"corrupted signature".b
786-
WebAuthn.configuration.origin = origin
786+
WebAuthn.configuration.allowed_origins = [origin]
787787
end
788788

789789
context "when verification is set to true" do

spec/webauthn/credential_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
let(:origin) { fake_origin }
1010

1111
before do
12-
WebAuthn.configuration.origin = origin
12+
WebAuthn.configuration.allowed_origins = [origin]
1313
end
1414

1515
describe ".from_create" do

spec/webauthn/public_key_credential_with_assertion_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
end
4747

4848
before do
49-
WebAuthn.configuration.origin = origin
49+
WebAuthn.configuration.allowed_origins = [origin]
5050
end
5151

5252
it "works" do

spec/webauthn/public_key_credential_with_attestation_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
let(:origin) { fake_origin }
4141

4242
before do
43-
WebAuthn.configuration.origin = origin
43+
WebAuthn.configuration.allowed_origins = [origin]
4444
end
4545

4646
it "works" do

spec/webauthn/relying_party_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278

279279
before do
280280
WebAuthn.configure do |config|
281-
config.origin = "https://www.example.com"
281+
config.allowed_origins = ["https://www.example.com"]
282282
config.rp_name = "Example Consumer page"
283283
end
284284
end
@@ -391,7 +391,7 @@
391391

392392
before do
393393
WebAuthn.configure do |config|
394-
config.origin = "https://www.example.com"
394+
config.allowed_origins = ["https://www.example.com"]
395395
config.rp_name = "Example Consumer page"
396396
end
397397
end

0 commit comments

Comments
 (0)