Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problém s RevalidatingServerAuthenticationStateProvider #4

Open
milantru opened this issue Mar 7, 2023 · 1 comment
Open

Problém s RevalidatingServerAuthenticationStateProvider #4

milantru opened this issue Mar 7, 2023 · 1 comment
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@milantru
Copy link
Owner

milantru commented Mar 7, 2023

Ak sa užívateľ prihlási, otvorí nový tab a v novom tabe sa odhlási, tak potom ako sa vráti do prvého tabu vidí, že je stále prihlásený. Myslel som, že použitím triedy RevalidatingServerAuthenticationStateProvider by sa problém vyriešil. Po uplynutí času stanovenom v RevalidationInterval by sa mala volať validácia definovaná v ValidateAuthenticationStateAsync(AuthenticationState, CancellationToken). Ak sa auth state vyhodnotí ako neplaný (teda validácia vrátila false), tak je uživateľ odhlásený. Lenže z nejakého dôvodu sa spomínaná validačná metóda nevolá.

@milantru milantru self-assigned this Mar 7, 2023
@milantru milantru added the bug Something isn't working label Mar 7, 2023
@milantru
Copy link
Owner Author

milantru commented Mar 26, 2023

Update: RevalidatingServerAuthenticationStateProvider má v sebe metódu RevalidationLoop, ktorá má volať našu implementáciu metódy ValidateAuthenticationStateAsync, lenže riadok predtým je await Task.Delay(RevalidationInterval, cancellationToken);. Keď sa program dostane na tento riadok, preskočí do metódy IDisposable.Dispose, tam sa zavolá Cancel na cancellation tokene, čo spôsobí vyhodenie výnimky, tá sa odchytí v catch bloku (volanie ValidateAuthenticationStateAsync sa preskočilo), v ňom je break, ktorý nás vyhodí z whilu a RevalidationLoop sa tým končí.

V skratke...
Po zmene auth statu sa zavolá RevalidationLoop, ktorý by mal zavolať našu implementáciu metódy ValidateAuthenticationStateAsync, ale namiesto toho pri dojdení na await sa aktivuje cancellation token, ktorý ukončí RevalidationLoop. Takže sa nestane nič.

Dôvod volania Dispose zostáva neznámy.

@milantru milantru added the invalid This doesn't seem right label Apr 6, 2023
@milantru milantru added enhancement New feature or request and removed invalid This doesn't seem right labels May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant