1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 01:23:44 +08:00
Commit Graph

32 Commits

Author SHA1 Message Date
Bartłomiej Dach
000ddc14ac
Fix broken locking in OAuth
Closes https://github.com/ppy/osu/issues/26824... I think?

Can be reproduced via something like

diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs
index 485274f349..e6e93ab4c7 100644
--- a/osu.Game/Online/API/OAuth.cs
+++ b/osu.Game/Online/API/OAuth.cs
@@ -151,6 +151,11 @@ internal string RequestAccessToken()
         {
             if (!ensureAccessToken()) return null;

+            for (int i = 0; i < 10000; ++i)
+            {
+                _ = Token.Value.AccessToken;
+            }
+
             return Token.Value.AccessToken;
         }

The cause is `SecondFactorAuthForm` calling `Logout()`, which calls
`OAuth.Clear()`, _while_ the `APIAccess` connect loop is checking if
`authentication.HasValidAccessToken` is true, which happens to
internally check `Token.Value.AccessToken`, which the clearing of
tokens can brutally interrupt.
2024-01-30 21:05:23 +01:00
Dean Herbert
c78b5112c6
Fix OAuth refresh attempt when no network available causing full logout (part 2)
This time for `SocketException`s. I seem to recall looking at this and
deciding there was a reason to not catch socket exceptions, but on
revisiting it seems sane to do so.

This covers a fail case like reported:

```
2023-10-06 03:24:17 [verbose]: Request to https://lazer.ppy.sh/oauth/token failed with System.Net.Http.HttpRequestException: No such host is known. (lazer.ppy.sh:443)
2023-10-06 03:24:17 [verbose]: ---> System.Net.Sockets.SocketException (11001): No such host is known.
2023-10-06 03:24:17 [verbose]: at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
```

Closes https://github.com/ppy/osu/issues/24890 (again).
2023-10-06 18:24:22 +09:00
Dean Herbert
3c62521e69 Fix OAuth refresh attempt when no network available causing full logout 2023-09-24 10:50:07 +09:00
Dan Balasescu
f8830c6850 Automated #nullable processing 2022-06-17 16:37:17 +09:00
Dean Herbert
ad112cbbc5 Fix intendation in a way it doesn't regress with older inspectcode 2021-10-18 14:28:29 +09:00
Dean Herbert
6d6eed61aa Fix new indentation inspections 2021-10-18 14:00:35 +09:00
Dean Herbert
3a0b7ba8ff Add fallback to use Message when Hint is not available 2021-10-04 16:18:55 +09:00
Dean Herbert
5aaafce597 Make AuthenticateWithLogin throw instead of return a bool success status 2021-10-04 15:40:00 +09:00
smoogipoo
2187523bf3 Fix json web requests having incorrect user agents 2020-01-17 19:21:27 +09:00
smoogipoo
d8c55bc729 Adjust namespaces 2019-02-21 19:05:52 +09:00
Dean Herbert
8617aaa2a7 Update licence header (and remove year) 2019-01-24 17:43:03 +09:00
Dean Herbert
f42d4a9382 Add wildcard scope to oauth requests 2018-11-28 19:02:23 +09:00
Dean Herbert
7cd547a760 Update chat to work with new API version 2018-09-25 20:53:24 +09:00
Dean Herbert
32a74f95a5 Normalize all the line endings 2018-04-13 18:26:38 +09:00
smoogipoo
baae4427ff Move string-token property to OAuth 2018-04-12 14:30:28 +09:00
smoogipoo
e007365916 Save OAuth token to config on every token change 2018-04-12 14:23:49 +09:00
smoogipoo
b500b76407 Merge branch 'master' into update-branch 2018-02-08 23:35:48 +09:00
Dean Herbert
37d393bca0 Update licence headers 2018-01-05 20:21:19 +09:00
smoogipoo
b3bf6e7bee Merge master into netstandard 2017-11-21 16:39:21 +09:00
Dean Herbert
4f6263ef86 Make many internal classes and methods public
This is important when using dynamic compiling to rapidly iterate. Until we actually split projects out into pieces (like the abstract ruleset project we have talked about) there is no advantage to using internal in the osu! game code.
2017-11-21 12:06:16 +09:00
smoogipoo
aac41d2de6 Disable resharper inspections on case-by-case basis 2017-11-20 18:55:48 +09:00
Dean Herbert
b0785b2f09 Fix a possible horrendous endless auth loop 2017-11-02 20:26:26 +09:00
smoogipoo
cd5324f1d1 Update API code to use the new Add* methods on requests 2017-10-30 21:33:44 +09:00
Dean Herbert
8fab6abf90 Update WebRequest usage in line with framework changes 2017-10-23 14:46:17 +09:00
TocoToucan
51a5e963bb Dispose IDisposable object before method returns 2017-09-16 15:10:24 +03:00
Dean Herbert
c3d2cdd2f2 Fix typo 2017-05-11 19:49:28 +09:00
Dean Herbert
4e881644f6 Add thread-safety on access token validation logic. 2017-05-11 19:39:01 +09:00
Thomas Müller
a5dfa7ab06 Remove unnecessary using statements 2017-02-23 21:38:10 +01:00
Dean Herbert
50bd80cb0c
Update and standardise license headers. 2017-02-07 14:27:41 +09:00
Dean Herbert
3fa80d2376 Update client id/secret and bring API endpoints up-to-date. 2016-11-30 18:30:24 +09:00
Dean Herbert
997c6f45f6 Update framework again. 2016-09-21 17:37:33 +09:00
Dean Herbert
8870935a4b Add basic online API support. 2016-08-31 20:14:01 +09:00