elsa-core/src/modules/Elsa.Identity/Services/DefaultSecretGenerator.cs
Sipke Schoorstra 30c4e5b1e7
Implement API key authentication (#3834)
* Implement API key storage

* Implement API key validation

* Implement EF Core providers
2023-03-26 23:53:17 +02:00

22 lines
734 B
C#

using Elsa.Identity.Constants;
using Elsa.Identity.Contracts;
namespace Elsa.Identity.Services;
/// <inheritdoc />
public class DefaultSecretGenerator : ISecretGenerator
{
private readonly IRandomStringGenerator _randomStringGenerator;
/// <summary>
/// Initializes a new instance of the <see cref="DefaultSecretGenerator"/> class.
/// </summary>
/// <param name="randomStringGenerator"></param>
public DefaultSecretGenerator(IRandomStringGenerator randomStringGenerator)
{
_randomStringGenerator = randomStringGenerator;
}
/// <inheritdoc />
public string Generate(int length = 32) => _randomStringGenerator.Generate(length, CharacterSequences.AlphanumericAndSymbolSequence);
}