Skip to content
Snippets Groups Projects
Commit 6ef7b733 authored by Lucca Santangelo's avatar Lucca Santangelo
Browse files

get all refresh tokens

parent d5dc0082
No related branches found
No related tags found
1 merge request!31Develop
Pipeline #10416 failed
......@@ -482,5 +482,12 @@ namespace Tsi1.Api.Controllers
return Ok();
}
[AllowAnonymous]
[HttpGet("GetAllRefreshTokens")]
public async Task<IActionResult> GetAllRefreshTokens()
{
return Ok(_jwtAuthManager.GetRefreshTokens());
}
}
}
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
......@@ -17,5 +18,6 @@ namespace Tsi1.Api.Infrastructure
int GenerateVerificationCode(string username, DateTime now);
bool ValidateVerificationCode(string username, int code);
public void RemoveExpiredVerificationCodes(DateTime now);
public IEnumerable<RefreshToken> GetRefreshTokens();
}
}
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
......@@ -150,6 +151,11 @@ namespace Tsi1.Api.Infrastructure
}
}
public IEnumerable<RefreshToken> GetRefreshTokens()
{
return _usersRefreshTokens.Select(x => x.Value).ToList();
}
private static string GenerateRefreshTokenString()
{
var randomNumber = new byte[32];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment