feat(ConfiguredConsumerService): ReadLocalAsync Methode hinzugefügt, um den Verbraucher von Auth.API zu erhalten

This commit is contained in:
Developer 02 2025-01-22 15:53:48 +01:00
parent 17c00240a6
commit b25c9538a4
3 changed files with 5 additions and 1 deletions

View File

@ -68,6 +68,6 @@
public bool IsEssential { get => _optionsBase.IsEssential; set => _optionsBase.IsEssential = value; }
#endregion
public CookieOptions Create(TimeSpan? lifetime = null) => new(_optionsBase) { Expires = DateTime.UtcNow.AddTicks(lifetime?.Ticks ?? Lifetime.Ticks) };
public CookieOptions Create() => new(_optionsBase) { Expires = DateTime.UtcNow.AddTicks(Lifetime.Ticks) };
}
}

View File

@ -21,6 +21,8 @@ namespace DigitalData.Auth.API.Services
public Task<Consumer?> ReadByNameAsync(string name) => Task.Run(() => _consumers.FirstOrDefault(api => api.Name == name));
public Task<Consumer> ReadLocalAsync() => Task.Run(() => _consumers.FirstOrDefault() ?? throw new InvalidOperationException("Unable to read the local consumer because no consumers are available."));
public async Task<bool> VerifyAsync(string name, string password) => (await ReadByNameAsync(name))?.Password == password;
}
}

View File

@ -8,6 +8,8 @@ namespace DigitalData.Auth.API.Services.Contracts
public Task<Consumer?> ReadByNameAsync(string name);
public Task<Consumer> ReadLocalAsync();
public Task<bool> VerifyAsync(string name, string password);
}
}