51 Commits

Author SHA1 Message Date
Remco Burema
fc0d1a54f3 Merge remote-tracking branch 'origin/main' into CURA-11406_fix_auth_refresh_after_sleep 2024-02-14 10:31:17 +01:00
Erwan MATHIEU
330dfd8be0 Add retry to OAuth token refresh failure
CURA-11406
2024-01-10 15:13:42 +01:00
Erwan MATHIEU
3c86bf140c Add support for OAuth2 client secret 2023-12-04 19:48:20 +01:00
Remco Burema
abe7c1bf7f
Search/replace Qt5->Qt6.
part of upgrading Qt to v6.2: CURA-8591
2021-12-28 14:46:02 +01:00
Jelle Spijker
0a43366ffc
Fixed some styling and typing issues
Some boyscouting.
Contributes to: CURA-8539
2021-11-23 11:10:22 +01:00
Ghostkeeper
1ee9f73075
Only call success_callback if it's not None
It could also be called as a fire-and-forget update thing.

Contributes to issue CURA-8539.
2021-11-22 16:20:37 +01:00
Ghostkeeper
595a6580f5
Use error callback and with correct number of parameters
It gives two parameters, additionally an error code. However our callback wrapper gets the error code from the reply itself so it doesn't need it.

Contributes to issue CURA-8539.
2021-11-22 16:17:30 +01:00
Ghostkeeper
8ea8cc752f
Also call processing functions for error callbacks
Otherwise the appropriate callbacks might not get called.

Contributes to issue CURA-8539.
2021-11-22 14:44:52 +01:00
Ghostkeeper
c36863da56
Only call failed_callback if provided
Otherwise we'd crash because NoneType can't be called.

Contributes to issue CURA-8539.
2021-11-22 11:59:23 +01:00
Ghostkeeper
ffb891fb69
Fix call to failed_callback
It provides 2 arguments (reply and error) which we both ignore and proceed to call failed_callback. And failed_callback may also be None in which case we don't call anything.

Contributes to issue CURA-8539.
2021-11-19 17:09:33 +01:00
Ghostkeeper
7091c5f3aa
Make getAuthenticationTokenUsingXYZ asynchronous
As a result, the local webserver now needs to synchronise that with a lock. Otherwise the do_GET function would no longer block, and wouldn't properly be able to return the correct redirect URL.

Contributes to issue CURA-8539.
2021-11-19 16:55:45 +01:00
Ghostkeeper
9b55ae6dda
Remove unused imports of requests
This was the objective, really.

Contributes to issue CURA-8539.
2021-11-19 16:25:50 +01:00
Ghostkeeper
aff0764c1d
Add failed callback for when the request fails
Maybe we should add a parameter to this to respond with an error message. But maybe later.

Contributes to issue CURA-8539.
2021-11-18 17:19:05 +01:00
Ghostkeeper
a9990eaa75
Make parseJWT asynchronous
This involves returning the user profile via a callback.
No longer use the Requests library, which doesn't properly use the SSL certificates locally on the computer like the QNetworkManager does.

Contributes to issue CURA-8539.
2021-11-18 17:11:27 +01:00
Ghostkeeper
f1c763ad9f
Use HttpRequestManager to acquire new tokens
This is a re-write from a previous attempt. Instead of requests, which doesn't properly use SSL certificates installed on the computer among other things, we'll now use the HttpRequestManager which uses QNetworkManager under the hood and properly uses system settings.
The QNetworkManager is asynchronous which would normally be very nice, but due to the nature of this call we want to make it synchronous so we'll use a lock here.

Contributes to issue CURA-8539.
2021-11-17 14:32:53 +01:00
Jaime van Kessel
8b5cfc9c28 Use token_hex from secrets instead of choice
CURA-8401
2021-09-03 09:57:04 +02:00
Jaime van Kessel
e24a844d17 Use secrets instead of random
Since we're no longer stuck on python 3.5, we can use secrets instead of random
which provides better randomness.

CURA-8401
SEC-207
2021-09-02 14:25:57 +02:00
Konstantinos Karmas
e5856bf6bc Log the connection error message produced by the request 2021-08-17 15:52:12 +02:00
Ghostkeeper
e60e44b919
Interpret timeouts as general connection errors
It's a similar problem for us.
We should really have used the HttpRequestManager for these things.

Fixes Sentry issue CURA-295.
2021-06-07 15:03:46 +02: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
640e038ce7
Catch OSError when authorizing connection
Fixes Sentry issue CURA-1GW.
2021-01-19 11:05:55 +01:00
Kostas Karmas
881e4406a4 Ensure the organization_id is None 2020-11-04 09:21:28 +01:00
Kostas Karmas
1521430d42 Include all subscription information in the slice data
CURA-7717
2020-10-14 11:43:22 +02:00
Kostas Karmas
ceda3e70bd Include organization id and type of enterprise plan in slice data
CURA-7717
2020-10-13 16:30:29 +02:00
Nino van Hooff
89f0970a88 Remove trailing whitespace from Python files 2020-05-29 14:30:33 +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
Jaime van Kessel
ca25ec3dbc
Increase size of the verificationCode
It's mostly a theoretical problem, but 16 could theoretically be brute
forced. Bumping it up to 32 won't break anything, but it does make it
exteremely unlikely that it gets broken
2020-01-31 15:00:03 +01:00
Jaime van Kessel
e2414ed5c9
Also log the exception when the connection failed to connect 2019-11-11 15:58:39 +01:00
Jaime van Kessel
48f37d03a4 Add debug log for when we are refreshing the access token 2019-04-18 09:29:04 +02: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
62f913802f Prevent crash if the connection was lost for auth token 2019-02-28 12:58:41 +01:00
Ghostkeeper
650204dae7
Merge branch '4.0' 2019-02-21 09:09:19 +01:00
Ian Paschal
a11878b199 Log warning instead of exception if no connection
Contributes to CL-1245
2019-02-20 10:40:23 +01:00
Jaime van Kessel
a8f66a558c Merge branch '4.0' of github.com:Ultimaker/Cura 2019-02-14 10:53:01 +01:00
ChrisTerBeke
62c7ba5659
remove unused argument 2019-02-08 22:31:36 +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
Ghostkeeper
473633de2c
Merge branch '4.0' 2019-02-08 11:28:06 +01:00
Ghostkeeper
1b29ff2b8a
Make authorisation error messages translatable
Because they weren't. Foreigners might not understand them.
2019-02-08 11:19:22 +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
Jaime van Kessel
2a0954f246 Gracefully handle the conectionError when logging in 2018-12-07 09:35:53 +01:00
Lipu Fei
1bee201cfd Remove unused code 2018-09-28 14:24:40 +02:00
Lipu Fei
5761d28f7f Use old data dict code style, more readable 2018-09-28 14:24:21 +02:00
Lipu Fei
3bc91f15c3 Fix mypy complains 2018-09-28 14:17:00 +02:00
Jaime van Kessel
3b70e5eb6b Fix typing
For some reason, my MyPy started acting up once I started using the PythonPath while calling it.
2018-09-27 20:01:55 +02:00
Jaime van Kessel
0ccbabd857 Switch SHA512 implementation to use the one from hashlib
CURA-5744
2018-09-27 11:37:44 +02:00
Jaime van Kessel
1c8804ff2c Changed documentation style to doxygen
CURA-5744
2018-09-27 11:03:17 +02:00
Jaime van Kessel
d0fc4878c2 Fix number of mypy mistakes
CURA-5744
2018-09-21 13:54:37 +02:00
Jaime van Kessel
3ae223334f Removed relative imports
Since the oauth module isn't just in a plugin anymore, there is no need for any of the relative imports

CURA-5744
2018-09-21 12:02:11 +02:00