- `AsymmetricPublicKey` in `ClientPublicKey` umbenannt - `ClientPublicKey` von `RSAKeyBase` abgeleitet für RSA-Funktionalität - Dynamischen PEM-Import in `UpdateContent` hinzugefügt
45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using Microsoft.AspNetCore.SignalR.Client;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace DigitalData.Auth.Client;
|
|
|
|
public class ClientParams
|
|
{
|
|
public string Url { get; set; } = string.Empty;
|
|
|
|
private readonly Lazy<IRetryPolicy?> _lazyRetryPolicy;
|
|
|
|
/// <summary>
|
|
/// Controls when the client attempts to reconnect and how many times it does so.
|
|
/// </summary>
|
|
public IRetryPolicy? RetryPolicy => _lazyRetryPolicy.Value;
|
|
|
|
/// <summary>
|
|
/// To simplify the assignment of <seealso cref="RetryPolicy"/>
|
|
/// </summary>
|
|
public Func<RetryContext, TimeSpan?>? NextRetryDelay { get; set; }
|
|
|
|
/// <summary>
|
|
/// To be able to serilize the simple <seealso cref="RetryPolicy"/>
|
|
/// </summary>
|
|
public TimeSpan? RetryDelay { get; set; }
|
|
|
|
public event ClientEvent OnPublicKeyReceived = ClientEvents.UpdatePublicKeys;
|
|
|
|
internal void TriggerOnPublicReceivedEvent(AuthClient client, string issuer, string audience, string key, ILogger? logger = null)
|
|
=> OnPublicKeyReceived(client, issuer, audience, key, logger);
|
|
|
|
public ClientParams()
|
|
{
|
|
_lazyRetryPolicy = new(() =>
|
|
{
|
|
if (RetryDelay is not null)
|
|
return new RetryPolicy(ctx => RetryDelay);
|
|
else if(NextRetryDelay is not null)
|
|
return new RetryPolicy(NextRetryDelay);
|
|
return null;
|
|
});
|
|
}
|
|
|
|
public List<ClientPublicKey> PublicKeys { get; set; } = new();
|
|
} |