64 Commits

Author SHA1 Message Date
Jelle Spijker
387fc36dc6
Small aesthetic code changes
CURA-7180 keyring storage
2021-03-17 09:30:31 +01:00
Jelle Spijker
d06a25595a
Use a descriptor to optionally store to Keyring
CURA-7180 keyring storage
2021-03-16 19:28:56 +01:00
Jelle Spijker
96e39810f2
Sync after log in works again
Needed to restore the access token after the
auth data was written to the preference file.

CURA-7180 keyring storage
2021-03-15 14:35:00 +01:00
Jelle Spijker
b604bbd255
Store secrets as securely as possible
Use the keyring if allowed, available, otherwise use preference

CURA-7180 keyring storage
2021-03-15 11:48:42 +01:00
Jelle Spijker
47df060bee
Added fundaments of SecretStorage vault
This class will handle the storing and processing
of secrets. Such as tokens. It will try to use the system
keyring by default. Falling back to less secure methods,
if the user doesn't allow access to the keyring or if
the back-end is unsupported.

CURA-7180 keyring storage
2021-03-11 14:21:51 +01:00
Jelle Spijker
720b356221
Merge remote-tracking branch 'origin/master' into CURA-7180_keyring_storage 2021-03-08 15:23:46 +01:00
Jaime van Kessel
f85cad37cf
Expand the logging for the auth data a bit more
We're getting some reports that people are suddenly logged out. The working
theory is that they are mixing staging & production builds. This logging
should tell us enough to find out if that is the case!
2021-01-28 10:31:47 +01:00
Ghostkeeper
4380cdbd86
Don't crash on malformed JSON structures
JSON dictionaries need to have a certain structure such as strings as keys. If that's not correct it gives a TypeError. Don't crash on those; give a similar error message as when the values in the JSON are invalid.
2021-01-19 16:31:31 +01:00
Remco Burema
a25a51eddb
Windows workaround for OAuth data removal from config.
Windows won't allow long keys in the backend the keyring python package uses as a backend. This means the access_token part can't be stored in the obvious way. Timeboxed some attempts at working around this limitation, but couldn't make it work within the time set. As this is mostly an extra precaustion protecting users that share config folders around against themselves (in other words, if this goes wrong it's not unreasonable to blame the user) it's not top critical, and the important part of that (the refresh_token) can proceed, giving any potential attacker only a 10 minute window from the moment any user shares their %appdata%/cura files (again, this is not how we intent for users to behave, but they can and will do it this way).

CURA-7180
2020-12-24 14:39:22 +01:00
Jaime van Kessel
bff3ba577b
Store auth & refresh key in keyring instead of in preferences
People tend to share configuration folders, which just isn't secure.

CURA-7180
2020-12-21 14:02:45 +01:00
Nino van Hooff
89f0970a88 Remove trailing whitespace from Python files 2020-05-29 14:30:33 +02:00
Nino van Hooff
8e347c1034 Merge remote-tracking branch 'origin/doxygen_to_restructuredtext_comments' into doxygen_to_restructuredtext_comments
# Conflicts:
#	cura/OAuth2/AuthorizationService.py
2020-05-15 13:40:22 +02:00
Kostas Karmas
898ca852f0 Fix mypy complaint about Optional type
CURA-7427
2020-05-12 13:40:27 +02:00
Kostas Karmas
32efb8d7bb Fix description comment of _generate_auth_url()
CURA-7427
2020-05-12 13:17:18 +02:00
Kostas Karmas
d3fb002d9b Transfer the generation of the auth link into its own function
The authentication link should be prepended with a logoff link from
mycloud, if it is requested. In order to make this process testable
this commit separates the generation of the authentication link,
based on whether it requests for a browser logoff first, into its
own function.

This commit also adds tests for this function.

CURA-7427
2020-05-12 13:07:39 +02:00
Kostas Karmas
b717755f20 Add "Sign in with another account" button in AddCloudPrintersView
There are cases where Cura and the browser fall out of sync when it
comes to accounts. In such cases, you may be logged in cura with an
account that has no cloud printers and in the browser with an account
that has printers. So when you press the "Add cloud printer" button,
you are redirected to mycloud and you see cloud printers that are not
detected by Cura (because Cura is in a different acconut). In such
cases, the user can now press the "Sign in with a different account"
link in the "Waiting for cloud response" page, which will log him/her
out in Cura AND in the browser, and then reinitiate the whole
authorization flow, to make sure the accounts are in sync.

CURA-7427
2020-05-11 17:47:09 +02:00
jelle Spijker
b032101e55
Updated comments in cura/OAuth2
Used DOX_2_RST.py to convert doxygen style comments to sphinx style comments
2020-05-11 13:16:29 +02:00
Nino van Hooff
ea00ff3c47 Update wording for authorization server error message
CURA-7346
2020-04-09 16:59:43 +02:00
Jaime van Kessel
849e012756
Gracefully handle binding erorr for local OAUTH2 Server
CURA-7346
2020-04-08 13:08:12 +02:00
Jaime van Kessel
1269de744f
Use state in AuthorizationService
It's a paranoid safety precaution, but beter safe than sorry.
Reported by WhiteHats; F-1.1.1
2020-01-31 16:11:59 +01:00
Jaime van Kessel
00078fd659
Remove a bunch of unused imports 2019-11-08 13:38:42 +01:00
Jaime van Kessel
1e130637ee
Remove retry action from login
It doesn't work anyway and there is another way that does work (eg; login via the top right)
2019-09-13 10:38:52 +02:00
Lipu Fei
4762711c33 chdir to ~ on Linux if frozen 2019-08-20 11:18:54 +02:00
Lipu Fei
f4dc9cc6a2 Fix QDesktopServices.openUrl() for AppImage on Linux 2019-08-20 09:57:13 +02:00
Lipu Fei
4c792419e3 Use QDesktopServices.openUrl() instead of webbrowser 2019-08-15 08:57:19 +02:00
Jaime van Kessel
5f76070f05 Fix situation where authtoken wasnt updated for the toolbox request headers 2019-04-25 16:16:44 +02:00
Jaime van Kessel
b2e2f088c4 Add even more logging to the auth service 2019-04-24 16:44:13 +02:00
Jaime van Kessel
d69eb89f17 Fix refresh token not being stored in the bootup refresh case 2019-04-24 16:03:12 +02:00
Jaime van Kessel
d8f193870f Added more logging to the authorization service 2019-04-17 16:11:39 +02:00
Jaime van Kessel
e9d4eb741a Merge branch '4.0' of github.com:Ultimaker/Cura 2019-03-11 10:52:14 +01:00
Jaime van Kessel
50999a075e Fix stupid mistake (signals need an emit, not a direct call)
CURA-6278
2019-03-11 10:46:41 +01:00
Jaime van Kessel
38a9206898 Merge branch '4.0' of github.com:Ultimaker/Cura 2019-02-28 16:01:40 +01:00
Jaime van Kessel
a8128556f3 Don't drop refresh token if request failed 2019-02-28 14:54:59 +01:00
Ghostkeeper
1c6cce316a
Merge branch '4.0' 2019-02-27 11:47:47 +01:00
ChrisTerBeke
9ba342c541 Fix codestyle failure on float conversion 2019-02-27 10:43:15 +01:00
ChrisTerBeke
365f67cbf8 Have some overlap in token expiry to prevent unauthorized issues 2019-02-27 10:32:30 +01:00
Ghostkeeper
3040fde9eb
Merge branch '4.0'
Conflicts:
	cura/OAuth2/AuthorizationService.py -> Code style change vs. fixing logging in while no internet connection.
2019-02-21 08:25:21 +01:00
Ghostkeeper
6143906fa4
Add type for message saying it's unable to connect
Contributes to issue CURA-6231.
2019-02-19 15:57:09 +01:00
Jaime van Kessel
c35aabd2c4 Add message to indicate that Cura was unable to connect with account server
This happens when you were logged previously, but currently don't have internet acces.

CURA-6231
2019-02-19 13:34:04 +01:00
Jaime van Kessel
a8f66a558c Merge branch '4.0' of github.com:Ultimaker/Cura 2019-02-14 10:53:01 +01:00
ChrisTerBeke
14c361a297 Add comment to clarify usage of fallback date 2019-02-11 09:45:50 +01:00
ChrisTerBeke
48c756b01d
Fixes for storing timestamp 2019-02-08 22:24:14 +01:00
ChrisTerBeke
05c4b6012e
Calculate expiry date to determine if token refresh is needed 2019-02-08 21:39:45 +01:00
ChrisTerBeke
9d6bd4b29a
Check access token before using it 2019-02-08 21:03:59 +01:00
Ghostkeeper
473633de2c
Merge branch '4.0' 2019-02-08 11:28:06 +01:00
Ghostkeeper
12b2154a96
Fix code style and documentation formatting 2019-02-08 11:10:43 +01:00
Jaime van Kessel
91f0d76c8a Fix crash when user was logged in but there was no internet connection on boot 2019-02-08 10:50:17 +01:00
ChrisTerBeke
0edeb11a78 Merge branch '4.0' into STAR-322_cloud-connection 2018-12-20 13:14:24 +01:00
Jaime van Kessel
36efa171c6 Add a bit more logging to the authorization service 2018-12-20 11:31:01 +01:00
Daniel Schiavini
9f4b7bd703 STAR-322: Improving logging and cluster connection 2018-12-17 11:28:16 +01:00