File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1212 'TokenAuthentication' ,
1313 'BasicHTTPAuthentication' ,
1414 'AuthenticationBase' ,
15+ 'X509Authentication'
1516]
1617
1718
@@ -137,3 +138,23 @@ def get_request(self, request):
137138
138139 def __repr__ (self ):
139140 return f"BearerAuthentication(username={ self .username } , token={ self .api_key } )"
141+
142+ class X509Authentication (AuthenticationBase ):
143+ """X509Authentication authentication class.
144+
145+ :param certificate str: Path to a users SSL certificate for authentication
146+ :param CA Cert str: Path to the CA bundle for softlayer hostnames.
147+ """
148+
149+ def __init__ (self , cert , ca_cert ):
150+ self .cert = cert
151+ self .ca_cert = ca_cert
152+
153+ def get_request (self , request ):
154+ """Sets token-based auth headers."""
155+ request .cert = self .cert
156+ request .ca_cert = self .ca_cert
157+ return request
158+
159+ def __repr__ (self ):
160+ return f"X509Authentication(cert={ cert } , ca_cert={ ca_cert } )"
Original file line number Diff line number Diff line change @@ -59,9 +59,12 @@ def __init__(self):
5959 #: Boolean specifying if the server certificate should be verified.
6060 self .verify = None
6161
62- #: Client certificate file path.
62+ #: Client certificate file path. (Used by X509Authentication)
6363 self .cert = None
6464
65+ #: CA certificate for softlayer domains (Used by X509Authentication)
66+ self .ca_cert = None
67+
6568 #: InitParameter/identifier of an object.
6669 self .identifier = None
6770
You can’t perform that action at this time.
0 commit comments