Skip to content
Snippets Groups Projects
Commit d9f25c99 authored by Daniel's avatar Daniel
Browse files

DOC: Better documentation of the `input` password method.

parent 8a2c243f
No related branches found
No related tags found
No related merge requests found
...@@ -6,17 +6,28 @@ ...@@ -6,17 +6,28 @@
[Connection] [Connection]
cacert=/path/to/caosdb.ca.pem cacert=/path/to/caosdb.ca.pem
url=https://localhost:10443/ url=https://localhost:10443/
## If this option is set, the SSL certtificate will be ignored. Use with care!
# ssl_insecure=1
username=admin username=admin
## optional: password in plain text ## The password input method can be chosen with the `password_method` setting,
## which by default is set to `plain`.
##
## DEFAULT: the password method is `plain`, now the password must be saved as
## plain text.
password_method=plain password_method=plain
password=caosdb password=caosdb
## OR: password using "pass" password manager ## OR: `input`: username is optional, password is entered by the user directly
# password_method=input
## OR: `pass`: password is retrieved from the "pass" password manager
# password_method=pass # password_method=pass
# password_identifier=... # password_identifier=...
## OR: using the system keyring/wallet (macOS, GNOME, KDE, Windows) ## OR: `keyring`: using the system keyring/wallet (macOS, GNOME, KDE, Windows)
## requires installation of the keyring python package: ## requires installation of the keyring python package:
## pip install keyring ## pip install keyring
# password_method=keyring # password_method=keyring
...@@ -167,7 +167,10 @@ class _DefaultCaosDBServerConnection(CaosDBServerConnection): ...@@ -167,7 +167,10 @@ class _DefaultCaosDBServerConnection(CaosDBServerConnection):
context.verify_mode = ssl.CERT_REQUIRED context.verify_mode = ssl.CERT_REQUIRED
if config.get("ssl_insecure"): if config.get("ssl_insecure"):
print("Relaxed SSL mode.") print("*** Warning! ***\n"
"Insecure SSL mode, certificate will not be checked! "
"Please consider removing the `ssl_insecure` configuration option.\n"
"****************")
context.verify_mode = ssl.CERT_NONE context.verify_mode = ssl.CERT_NONE
if (not context.verify_mode == ssl.CERT_NONE and if (not context.verify_mode == ssl.CERT_NONE and
...@@ -281,7 +284,7 @@ def _get_authenticator(**config): ...@@ -281,7 +284,7 @@ def _get_authenticator(**config):
def configure_connection(**kwargs): def configure_connection(**kwargs):
"""Configures the caosdb connection and return the Connection object. """Configures the caosdb connection and returns the Connection object.
The effective configuration is governed by the default values (see The effective configuration is governed by the default values (see
'Parameters'), the global configuration (see `caosdb.get_config()`) and the 'Parameters'), the global configuration (see `caosdb.get_config()`) and the
...@@ -296,12 +299,23 @@ def configure_connection(**kwargs): ...@@ -296,12 +299,23 @@ def configure_connection(**kwargs):
implementation : CaosDBServerConnection implementation : CaosDBServerConnection
The class which implements the connection. (Default: The class which implements the connection. (Default:
_DefaultCaosDBServerConnection) _DefaultCaosDBServerConnection)
password_method : str password_method : str
The name of a submodule of caosdb.connection.authentication which The name of a submodule of caosdb.connection.authentication which
implements the AbstractAuthenticator interface. (Default: 'plain') implements the AbstractAuthenticator interface. (Default: 'plain')
Possible values are, for example:
- "plain" Need username and password arguments.
- "input" Asks for the password.
- "pass" Uses the `pass` password manager.
- "keyring" Uses the `keyring` library.
timeout : int timeout : int
A connection timeout in seconds. (Default: 210) A connection timeout in seconds. (Default: 210)
ssl_insecure : bool
Whether SSL certificate warnings should be ignored. Only use this for
development purposes! (Default: False)
Returns Returns
------- -------
_Connection _Connection
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment