mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Refactor ID card sign-in
- Extract to Devise custom strategy - Use `SSL_CLIENT_S_DN_CN` env variable instead of `SSL_CLIENT_S_DN` to get ID card data - Remove `database_authenticatable` strategy from `RegistrantUser` Closes #1047
This commit is contained in:
parent
27976c3fbd
commit
a08f063640
20 changed files with 266 additions and 89 deletions
31
test/integration/registrant_area/sign_in/id_card_test.rb
Normal file
31
test/integration/registrant_area/sign_in/id_card_test.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrantAreaIdCardSignInTest < ApplicationIntegrationTest
|
||||
setup do
|
||||
allow_business_registry_component_reach_server
|
||||
end
|
||||
|
||||
def test_succeeds
|
||||
post_via_redirect registrant_id_card_sign_in_path, nil,
|
||||
'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234',
|
||||
'SSL_CLIENT_I_DN_C' => 'US'
|
||||
|
||||
assert_response :ok
|
||||
assert_equal registrant_root_path, path
|
||||
assert_not_nil controller.current_registrant_user
|
||||
end
|
||||
|
||||
def test_fails_when_certificate_is_absent
|
||||
post_via_redirect registrant_id_card_sign_in_path, nil, 'SSL_CLIENT_S_DN_CN' => ''
|
||||
|
||||
assert_response :ok
|
||||
assert_equal registrant_id_card_sign_in_path, path
|
||||
assert_nil controller.current_registrant_user
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def allow_business_registry_component_reach_server
|
||||
WebMock.allow_net_connect!
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue