Difference between revisions of "PKI 10.8 Python Changes"

From Dogtag
Jump to: navigation, search
m (Changes in PKIConnection)
m (Changes in PKIConnection)
Line 1: Line 1:
 
= Changes in PKIConnection =
 
= Changes in PKIConnection =
  
Previously PKIConnection object has to be created for a specific subsystem, limiting its use to that subsystem only.
+
Prior to PKI 10.8 the PKIConnection object had to be created for a specific subsystem, limiting its use to that subsystem only.
Also, the URL path for get(), post(), put(), delete() has to be a relative path.
+
Also, the get(), post(), put(), delete() had to be used with relative paths except when use_root_uri=True.
 
For example:
 
For example:
  
Line 9: Line 9:
 
kra_connection = PKIConnection(hostname='localhost', port='8080', subsystem='kra')
 
kra_connection = PKIConnection(hostname='localhost', port='8080', subsystem='kra')
  
 +
ca_login_client = AccountClient(ca_connection)
 +
kra_login_client = AccountClient(kra_connection)
 +
 +
cert_client = CertClient(ca_connection)
 +
key_client = KeyClient(kra_connection)
 +
 +
info = ca_connection.get('/pki/rest/info', use_root_uri=True)
 
certs = ca_connection.get('/rest/certs')
 
certs = ca_connection.get('/rest/certs')
keys = kra_connection.get('/rest/keys')
+
keys = kra_connection.get('/rest/agent/keys')
  
 
cert_client = CertClient(ca_connection)
 
cert_client = CertClient(ca_connection)
Line 16: Line 23:
 
</pre>
 
</pre>
  
Since PKI 10.8 the subsystem should be specified when creating the objects.
+
Since PKI 10.8 the subsystem should be specified when creating client objects instead of the connection object.
The URL path for get(), post(), put(), delete() has to be an absolute path.
+
The get(), post(), put(), delete() should be used with absolute paths in all cases.
 
This allows the connection object to be used with various subsystems.
 
This allows the connection object to be used with various subsystems.
 
For example:
 
For example:
Line 24: Line 31:
 
connection = PKIConnection(hostname='localhost', port='8080')
 
connection = PKIConnection(hostname='localhost', port='8080')
  
 +
ca_login_client = AccountClient(connection, subsystem='ca')
 +
kra_login_client = AccountClient(connection, subsystem='kra')
 +
 +
cert_client = CertClient(connection)  # always uses CA subsystem
 +
key_client = KeyClient(connection)    # always uses KRA subsystem
 +
 +
info = connection.get('/pki/rest/info')
 
certs = connection.get('/ca/rest/certs')
 
certs = connection.get('/ca/rest/certs')
keys = connection.get('/kra/rest/keys')
+
keys = connection.get('/kra/rest/agent/keys')
 
 
cert_client = CertClient(connection, subsystem='ca')
 
key_client = KeyClient(connection, subsystem='kra')
 
 
</pre>
 
</pre>
  

Revision as of 16:55, 9 September 2019

Changes in PKIConnection

Prior to PKI 10.8 the PKIConnection object had to be created for a specific subsystem, limiting its use to that subsystem only. Also, the get(), post(), put(), delete() had to be used with relative paths except when use_root_uri=True. For example:

ca_connection = PKIConnection(hostname='localhost', port='8080', subsystem='ca')
kra_connection = PKIConnection(hostname='localhost', port='8080', subsystem='kra')

ca_login_client = AccountClient(ca_connection)
kra_login_client = AccountClient(kra_connection)

cert_client = CertClient(ca_connection)
key_client = KeyClient(kra_connection)

info = ca_connection.get('/pki/rest/info', use_root_uri=True)
certs = ca_connection.get('/rest/certs')
keys = kra_connection.get('/rest/agent/keys')

cert_client = CertClient(ca_connection)
key_client = KeyClient(kra_connection)

Since PKI 10.8 the subsystem should be specified when creating client objects instead of the connection object. The get(), post(), put(), delete() should be used with absolute paths in all cases. This allows the connection object to be used with various subsystems. For example:

connection = PKIConnection(hostname='localhost', port='8080')

ca_login_client = AccountClient(connection, subsystem='ca')
kra_login_client = AccountClient(connection, subsystem='kra')

cert_client = CertClient(connection)  # always uses CA subsystem
key_client = KeyClient(connection)    # always uses KRA subsystem

info = connection.get('/pki/rest/info')
certs = connection.get('/ca/rest/certs')
keys = connection.get('/kra/rest/agent/keys')

See Also