Commit 351d48ea authored by SIMONIN Matthieu's avatar SIMONIN Matthieu

Merge branch 'defaultuser' into 'master'

Users can now specify the default user when using an SSL client certificate.

See merge request !3
parents 96269849 2b36e852
Pipeline #120174 passed with stage
in 2 minutes and 56 seconds
...@@ -63,6 +63,7 @@ class Grid5000(object): ...@@ -63,6 +63,7 @@ class Grid5000(object):
session=None, session=None,
sslcert=None, sslcert=None,
sslkey=None, sslkey=None,
ssluser='anonymous',
**kwargs **kwargs
): ):
self._uri = uri self._uri = uri
...@@ -75,6 +76,7 @@ class Grid5000(object): ...@@ -75,6 +76,7 @@ class Grid5000(object):
self.client_cert = None self.client_cert = None
if sslcert is not None: if sslcert is not None:
self.client_ssl = True self.client_ssl = True
self.default_ssl_user = ssluser
if sslkey is not None: if sslkey is not None:
self.client_cert = (sslcert, sslkey) self.client_cert = (sslcert, sslkey)
else: else:
...@@ -161,8 +163,8 @@ class Grid5000(object): ...@@ -161,8 +163,8 @@ class Grid5000(object):
request_headers["X-Api-User-CN"] = user_id request_headers["X-Api-User-CN"] = user_id
request_headers["X-Remote-Ident"] = user_id request_headers["X-Remote-Ident"] = user_id
else: else:
request_headers["X-Api-User-CN"] = "anonymous" request_headers["X-Api-User-CN"] = self.default_ssl_user
request_headers["X-Remote-Ident"] = "anonymous" request_headers["X-Remote-Ident"] = self.default_ssl_user
else: else:
res["auth"] = self._http_auth res["auth"] = self._http_auth
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment