mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Implement refresh token flow and refactor session handling
Added refresh token endpoint and controller, introduced IUserSessionRefresher and UserSessionRefresher for token renewal, and updated session handling to return both access and refresh tokens. Refactored AuthController, tests, and related interfaces to support new token flow. Fixed JwtAccessOption property typo, updated configuration, and extended UserSessionsRepository to support lookup by refresh token.
This commit is contained in:
@@ -62,6 +62,14 @@ public class UserSessionsRepository : IUserSessionsRepository
|
||||
.ToListOrThrowIfEmpty(new NotFoundByKeyException<bool>(isRevoked, "Sessions is revoked does not exist"));
|
||||
}
|
||||
|
||||
public async Task<UserSession> GetByRefreshTokenAsync(string refreshToken)
|
||||
{
|
||||
return await _context.UserSessions
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync(session => session.RefreshToken == refreshToken)
|
||||
?? throw new NotFoundByKeyException<string>(refreshToken, "Session with given refresh token does not exist");
|
||||
}
|
||||
|
||||
public async Task AddAsync(UserSession userSession)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user