Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into v3.1.0-rc-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble committed Oct 23, 2023
2 parents 71a4e8a + 8f1d75d commit 09fc99f
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 93 deletions.
174 changes: 86 additions & 88 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion docs/getting_started/credentials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,16 @@ Use :code:`.synapseConfig`

For writing code using the Synapse Python client that is easy to share with others, please do not include your credentials in the code. Instead, please use `.synapseConfig` file to manage your credentials.

When installing the Synapse Python client, the `.synapseConfig` is added to your home directory. Open the `.synapseConfig` file and find the following section::
When installing the Synapse Python client, the :code:`.synapseConfig` is added to your home directory.

You may also create the :code:`~/.synapseConfig` file by utilizing the command line client command and following the interactive prompts::

synapse config


The following describes how to add your credentials to the :code:`.synapseConfig` file without the use of the :code:`synapse config` command.

Open the :code:`.synapseConfig` file and find the following section::

#[authentication]
#username = <username>
Expand Down Expand Up @@ -92,3 +101,4 @@ For more information, see:
- :py:class:`synapseclient.Synapse`
- :py:func:`synapseclient.Synapse.login`
- :py:func:`synapseclient.Synapse.logout`
- `synapse config <../articles/cli.html#config>`__
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ python_requires = >=3.8
install_requires =
# "requests>=2.22.0,<2.30.0; python_version<'3.10'",
requests>=2.22.0,<3.0
urllib3<2
urllib3>=1.26.18,<2
# "urllib3>=2; python_version>='3.10'",
keyring>=15,<23.5
keyrings.alt==3.1; sys_platform == "linux"
Expand Down
11 changes: 8 additions & 3 deletions synapseclient/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1792,18 +1792,23 @@ def _authenticate_login(syn, user, secret, **login_kwargs):

login_attempts = (
# a username is required when attempting a password login
("password", lambda user, secret: user is not None and secret is not None),
(
"password",
lambda user, secret: user is not None and user != "" and secret is not None,
),
# auth token login can be attempted without a username.
# although tokens are technically encoded, the client treats them as opaque so we don't do an encoding check
# on the secret itself
("authToken", lambda user, secret: secret is not None),
# username is required for an api key and secret is base 64 encoded
(
"apiKey",
lambda user, secret: user is not None and utils.is_base64_encoded(secret),
lambda user, secret: user is not None
and user != ""
and utils.is_base64_encoded(secret),
),
# an inputless login (i.e. derived from config or cache)
(None, lambda user, secret: user is None and secret is None),
(None, lambda user, secret: (user is None or user == "") and secret is None),
)

first_auth_ex = None
Expand Down

0 comments on commit 09fc99f

Please sign in to comment.