Reworked encryption to use less heap allocated buffers for secrets.
Also some work on plugin system.
This commit is contained in:
parent
8782ef39c6
commit
054754f553
42 changed files with 1452 additions and 242 deletions
17
IdentityShroud.Core/Security/Jwt/JwtSignerFactory.cs
Normal file
17
IdentityShroud.Core/Security/Jwt/JwtSignerFactory.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
namespace IdentityShroud.Core;
|
||||
|
||||
public class JwtSignerFactory(IEnumerable<IJwtSigner> signers) : IJwtSignerFactory
|
||||
{
|
||||
private readonly IReadOnlyDictionary<JwtSigAlgName, IJwtSigner> _signers = signers
|
||||
.SelectMany(s => s.Algorithms.Select(alg => (alg, signer: s)))
|
||||
.ToDictionary(x => x.alg, x => x.signer);
|
||||
|
||||
public IJwtSigner Create(JwtSigAlgName algorithm)
|
||||
{
|
||||
if (_signers.TryGetValue(algorithm, out var signer))
|
||||
return signer;
|
||||
|
||||
throw new NotSupportedException($"JWT signing algorithm '{algorithm}' is not registered.");
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue