Repository navigation
Conversation
5 tasks done
Aleks334
force-pushed
the
65-jwt-authentication
branch
3 times, most recently
from
October 24, 2026 23:16
52f564b to
9829537
Compare
Aleks334
marked this pull request as ready for review
October 25, 2026 09:18
Joszkooo
requested changes
Oct 29, 2026
Joszkooo
left a comment
Collaborator
There was a problem hiding this comment.
Git gut, poniżej masz co znalazłem
| [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] | ||
| [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)] | ||
| [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status502BadGateway)] | ||
| public async Task<IActionResult> Callback( |
Collaborator
There was a problem hiding this comment.
Sekret request tokena OAuth trzyma IMemoryCache pod kluczem oauth_token, więc callback nie jest związany z przeglądarką, która zaczęła logowanie. Do tej pory nie miało to dużego znaczenia, ale ten PR sprawia, że callback ustanawia sesję (ustawia cookies). Scenariusz:
- Atakujący woła /api/auth/login, loguje się w USOS swoim kontem i przechwytuje URL .../api/auth/callback oauth_token=T&oauth_verifier=V (nie wchodzi w niego).
- W ciągu 10 minut (TTL cache) wysyła link ofierze.
- Ofiara klika i jej przeglądarka dostaje cookies sesji atakującego. Wszystko, co ofiara potem zrobi na wiki (komentarze, oceny prowadzących), trafia na konto atakującego.
Member
Author
There was a problem hiding this comment.
musze to zobaczyc, bo juz nie pamietam jak byl pisany serwis pod USOS OAuth1
…ew fixture methods
Aleks334
force-pushed
the
65-jwt-authentication
branch
from
November 12, 2026 15:42
5e275d1 to
4c43b4f
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Access token - shortlived (30 min), gives access to resources on server, appened in every request in domain. The only claim that I set is sub equal to user's id.
Refresh token - longlived (7 days), appended only when requesting /api/auth/refresh. Allows user session refreshing (getting new tokens). It is stored in database (later it can use cache like redis) and revoked once user refreshes session. In fact this is not JWT but random sequence of 64 bytes encoded in base64 string
How to test (optional)
GET /api/auth/loginto provision user and issue JWTs that are set in response as cookiesPATCH /api/users/{userId}/nicknameendpoint. You should get the resultGET /api/auth/refresh. If your refresh token is not stale you will get new JWT pair as cookies in return. Repeat step 4, you should get 200 status this timeI implemented it based on:
Screenshots / recordings (for UI stuff)
Checklist
To have your PR reviewed put the link e.g.
https://github.com/akai-org/put-wiki/pull/0to theReview PRthread on put-wiki dc channel (you must be member of the AKAI discord server)