mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Create a Certificate parameter
Up until now, Bytes parameter was used for certificate parameters throughout the framework. However, the Bytes parameter does nothing special for certificates, like validation, so this had to be done for each of the parameters which were supposed to represent a certificate. This commit introduces a special Certificate parameter which takes care of certificate validation so this does not have to be done separately. It also makes sure that the certificates represented by this parameter are always converted to DER format so that we can work with them in a unified manner throughout the framework. This commit also makes it possible to pass bytes directly during instantiation of the Certificate parameter and they are still represented correctly after their conversion in the _convert_scalar() method. https://pagure.io/freeipa/issue/4985 Reviewed-By: Fraser Tweedale <ftweedal@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
committed by
Pavel Vomacka
parent
5ff1de8490
commit
5a44ca6383
@@ -12,6 +12,8 @@ import tempfile
|
||||
import types
|
||||
import zipfile
|
||||
|
||||
from cryptography import x509 as crypto_x509
|
||||
|
||||
import six
|
||||
|
||||
from ipaclient.frontend import ClientCommand, ClientMethod
|
||||
@@ -44,6 +46,7 @@ _TYPES = {
|
||||
'list': list,
|
||||
'tuple': tuple,
|
||||
'unicode': unicode,
|
||||
'Certificate': crypto_x509.Certificate,
|
||||
}
|
||||
|
||||
_PARAMS = {
|
||||
@@ -57,6 +60,7 @@ _PARAMS = {
|
||||
'dict': parameters.Dict,
|
||||
'int': parameters.Int,
|
||||
'str': parameters.Str,
|
||||
'Certificate': parameters.Certificate,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user