mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Verify that CN is present when uploading CSR/CRT
This commit is contained in:
parent
e18942e8ee
commit
c2f8589044
3 changed files with 29 additions and 17 deletions
|
@ -64,18 +64,22 @@ class ApiUserTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_verifies_pki_status
|
||||
certificate = certificates(:one)
|
||||
certificate = certificates(:api)
|
||||
|
||||
assert @user.pki_ok?(certificate.crt, certificate.common_name, api: true)
|
||||
assert_not @user.pki_ok?(certificate.crt, 'invalid-cn', api: true)
|
||||
|
||||
certificate.update(interface: 'registrar')
|
||||
certificate = certificates(:registrar)
|
||||
|
||||
assert @user.pki_ok?(certificate.crt, certificate.common_name, api: false)
|
||||
assert_not @user.pki_ok?(certificate.crt, 'invalid-cn', api: false)
|
||||
|
||||
certificate.update(revoked: true)
|
||||
assert_not @user.pki_ok?(certificate.crt, certificate.common_name, api: false)
|
||||
|
||||
certificate = certificates(:api)
|
||||
certificate.update(revoked: true)
|
||||
assert_not @user.pki_ok?(certificate.crt, certificate.common_name, api: true)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue