Skip to content

Commit

Permalink
Add tests for webauthn & webauthn passwordless extra origins property
Browse files Browse the repository at this point in the history
  • Loading branch information
TuningYourCode committed Jun 17, 2024
1 parent 29ee7af commit 133715a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions spec/acceptance/2_realm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ class { 'keycloak': }
web_authn_policy_create_timeout => 600,
web_authn_policy_avoid_same_authenticator_register => true,
web_authn_policy_acceptable_aaguids => ['d1d1d1d1-d1d1-d1d1-d1d1-d1d1d1d1d1d1'],
web_authn_policy_extra_origins => ['https://example.com'],
web_authn_policy_passwordless_rp_entity_name => 'Keycloak',
web_authn_policy_passwordless_signature_algorithms => ['ES256', 'ES384', 'ES512', 'RS256', 'RS384', 'RS512'],
web_authn_policy_passwordless_rp_id => 'https://example.com',
Expand All @@ -249,6 +250,7 @@ class { 'keycloak': }
web_authn_policy_passwordless_create_timeout => 600,
web_authn_policy_passwordless_avoid_same_authenticator_register => true,
web_authn_policy_passwordless_acceptable_aaguids => ['d1d1d1d1-d1d1-d1d1-d1d1-d1d1d1d1d1d1'],
web_authn_policy_passwordless_extra_origins => ['https://example.com'],
}
PUPPET_PP

Expand Down Expand Up @@ -321,6 +323,7 @@ class { 'keycloak': }
expect(data['webAuthnPolicyCreateTimeout']).to eq(600)
expect(data['webAuthnPolicyAvoidSameAuthenticatorRegister']).to eq(true)
expect(data['webAuthnPolicyAcceptableAaguids']).to eq(['d1d1d1d1-d1d1-d1d1-d1d1-d1d1d1d1d1d1'])
expect(data['webAuthnPolicyExtraOrigins']).to eq(['https://example.com'])
expect(data['webAuthnPolicyPasswordlessRpEntityName']).to eq('Keycloak')
expect(data['webAuthnPolicyPasswordlessSignatureAlgorithms']).to eq(['ES256', 'ES384', 'ES512', 'RS256', 'RS384', 'RS512'])
expect(data['webAuthnPolicyPasswordlessRpId']).to eq('https://example.com')
Expand All @@ -331,6 +334,7 @@ class { 'keycloak': }
expect(data['webAuthnPolicyPasswordlessCreateTimeout']).to eq(600)
expect(data['webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister']).to eq(true)
expect(data['webAuthnPolicyPasswordlessAcceptableAaguids']).to eq(['d1d1d1d1-d1d1-d1d1-d1d1-d1d1d1d1d1d1'])
expect(data['webAuthnPolicyPasswordlessExtraOrigins']).to eq(['https://example.com'])
end
end

Expand Down
8 changes: 6 additions & 2 deletions spec/unit/puppet/type/keycloak_realm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
web_authn_policy_create_timeout: 0,
web_authn_policy_avoid_same_authenticator_register: :false,
web_authn_policy_acceptable_aaguids: [],
web_authn_policy_extra_origins: [],
web_authn_policy_passwordless_rp_entity_name: 'keycloak',
web_authn_policy_passwordless_signature_algorithms: ['ES256'],
web_authn_policy_passwordless_rp_id: '',
Expand All @@ -91,7 +92,8 @@
web_authn_policy_passwordless_user_verification_requirement: 'not specified',
web_authn_policy_passwordless_create_timeout: 0,
web_authn_policy_passwordless_avoid_same_authenticator_register: :false,
web_authn_policy_passwordless_acceptable_aaguids: []
web_authn_policy_passwordless_acceptable_aaguids: [],
web_authn_policy_passwordless_extra_origins: []
}

describe 'otp_policy_digits' do
Expand Down Expand Up @@ -348,8 +350,10 @@
:roles,
:web_authn_policy_signature_algorithms,
:web_authn_policy_acceptable_aaguids,
:web_authn_policy_extra_origins,
:web_authn_policy_passwordless_signature_algorithms,
:web_authn_policy_passwordless_acceptable_aaguids
:web_authn_policy_passwordless_acceptable_aaguids,
:web_authn_policy_passwordless_extra_origins
].each do |p|
it "accepts array for #{p}" do
config[p] = ['foo', 'bar']
Expand Down

0 comments on commit 133715a

Please sign in to comment.