Skip to content

Commit 84833ee

Browse files
committed
Use allowed_origins instead of origin argument to WebAuthn::RelyingParty.new to avoid deprecation warning in webauthn 3.4.0+
1 parent d353563 commit 84833ee

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

CHANGELOG

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
=== master
22

3+
* Use allowed_origins instead of origin argument to WebAuthn::RelyingParty.new to avoid deprecation warning in webauthn 3.4.0+ (jeremyevans)
4+
35
* Change JSON.fast_generate to JSON.generate in jwt feature to avoid deprecation warning in recent json versions (jeremyevans)
46

57
* Avoid exceeding 4K cookie size limit by setting an upper limit on path size when using login_return_to_requested_location? (jeremyevans)

lib/rodauth/features/webauthn.rb

+19-7
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,25 @@ def possible_authentication_methods
410410
private
411411

412412
if WebAuthn::VERSION >= '3'
413-
def webauthn_relying_party
414-
# No need to memoize, only called once per request
415-
WebAuthn::RelyingParty.new(
416-
origin: webauthn_origin,
417-
id: webauthn_rp_id,
418-
name: webauthn_rp_name,
419-
)
413+
if WebAuthn::RelyingParty.instance_method(:initialize).parameters.include?([:key, :allowed_origins])
414+
def webauthn_relying_party
415+
# No need to memoize, only called once per request
416+
WebAuthn::RelyingParty.new(
417+
allowed_origins: [webauthn_origin],
418+
id: webauthn_rp_id,
419+
name: webauthn_rp_name,
420+
)
421+
end
422+
# :nocov:
423+
else
424+
def webauthn_relying_party
425+
WebAuthn::RelyingParty.new(
426+
origin: webauthn_origin,
427+
id: webauthn_rp_id,
428+
name: webauthn_rp_name,
429+
)
430+
end
431+
# :nocov:
420432
end
421433

422434
def webauthn_create_relying_party_opts

0 commit comments

Comments
 (0)