Adds supports for RefreshTokens
This commit is contained in:
@@ -13,7 +13,7 @@ public static class PasswordGenerator
|
||||
|
||||
private static readonly Random Random = new();
|
||||
|
||||
public static string GeneratePassword(
|
||||
public static string Next(
|
||||
int length = 15,
|
||||
bool requireNumber = true,
|
||||
bool requireLowercase = true,
|
||||
|
||||
14
backend/src/Web/Common/Security/RefreshTokenGenerator.cs
Normal file
14
backend/src/Web/Common/Security/RefreshTokenGenerator.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Hutopy.Web.Common.Security;
|
||||
|
||||
public static class RefreshTokenGenerator
|
||||
{
|
||||
public static string Next()
|
||||
{
|
||||
var randomNumber = new byte[32];
|
||||
using var rng = RandomNumberGenerator.Create();
|
||||
rng.GetBytes(randomNumber);
|
||||
return Convert.ToBase64String(randomNumber);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user